the first commit

This commit is contained in:
adrianvic 2023-09-21 14:51:06 -03:00
commit d5920470cc
18 changed files with 1887 additions and 0 deletions

25
commands/bot/about.js Normal file
View file

@ -0,0 +1,25 @@
const { SlashCommandBuilder } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
const fs = require('fs');
module.exports = {
data: new SlashCommandBuilder()
.setName(`about`)
.setDescription(`About the bot`),
async execute(interaction) {
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
const botAvatarURL = interaction.client.user.displayAvatarURL();
// Create an embed with the app name, version, and codename from package.json
const responseEmbed = new EmbedBuilder()
.setTitle(`${packageJson.name} *${packageJson.codename}*\n(${packageJson.version}) `)
.setThumbnail(botAvatarURL)
.setDescription(`I'm ${packageJson.name}, click me on the command menu to see what I can do.`)
.setFooter({ text: 'Originally made by 天くま (tenkuma) - Thanks for keeping the credits ;)' });
// interaction.reply() to reply with a ephemeral message
await interaction.reply({ embeds: [responseEmbed], ephemeral: true });
},
};

12
commands/bot/ping.js Normal file
View file

@ -0,0 +1,12 @@
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with Pong!'),
async execute(interaction) {
const member = interaction.guild.members.cache.get(interaction.user.id);
const nickname = member.nickname;
await interaction.reply(`Pong, ${nickname}!`);
},
};

50
commands/misc/lyrics.js Normal file
View file

@ -0,0 +1,50 @@
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { getLyrics } = require('genius-lyrics-api') ;
module.exports = {
data: new SlashCommandBuilder()
.setName('lyrics')
.setDescription('Search for song lyrics')
.addStringOption(option =>
option.setName('artist')
.setDescription('Artist name')
.setRequired(true))
.addStringOption(option =>
option.setName('title')
.setDescription('Song title')
.setRequired(true)),
async execute(interaction) {
const artist = interaction.options.getString('artist');
const title = interaction.options.getString('title');
// Ephemeral message saying the bot is thinking
await interaction.deferReply();
// Use getLyrics to get the lyrics
try {
const lyrics = await getLyrics({
apiKey: 'yourGeniusAPIKey', // Change to your Genius key
title: title,
artist: artist,
});
if (lyrics) {
// Embed with the lyrics
const { EmbedBuilder } = require('discord.js');
const embed = new EmbedBuilder()
.setAuthor({ name: artist })
.setTitle(title)
.setDescription(lyrics)
.setFooter({text : 'Made with Genius API'})
// Send the embed
await interaction.followUp({ content: 'Here is the lyric:', ephemeral: false, embeds: [embed] });
} else {
await interaction.followUp('Could not find the lyric.');
}
} catch (error) {
console.error('Error while searching for the lyric:', error);
await interaction.followUp('Error while searching for the lyric.');
}
},
};

31
commands/misc/myname.js Normal file
View file

@ -0,0 +1,31 @@
const { SlashCommandBuilder, ChannelType } = require(`discord.js`)
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName(`myname`)
.setDescription(`Change your nickname`)
.addStringOption(option =>
option.setName('name')
.setDescription('What is your new nickname?')
.setRequired(true)),
async execute(interaction) {
const nick = interaction.options.getString(`name`)
const member = interaction.guild.members.cache.get(interaction.user.id);
const nickname = member.nickname;
if (interaction.guild) {
try {
await interaction.member.setNickname(nick);
interaction.reply({ content: `Your new nickname is **${nickname}**!`, ephemeral: true });
} catch (error) {
console.error(error);
interaction.reply({ content: `Something went wrong`, ephemeral: true });
}
} else {
interaction.reply({ content: 'Try this in a server', ephemeral: true });
}
},
}

74
commands/mod/ban.js Normal file
View file

@ -0,0 +1,74 @@
const { SlashCommandBuilder } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
const { PermissionsBitField } = require('discord.js')
module.exports = {
data: new SlashCommandBuilder()
.setName('remove')
.setDescription('Remove/Ban someone from this server')
.addBooleanOption(option =>
option.setName('silent')
.setDescription('Only you will see the command result')
.setRequired(true))
.addStringOption(option =>
option.setName('type')
.setRequired(true)
.addChoices(
{ name: 'Kick', value: 'kick' },
{ name: 'Ban', value: 'ban' },
))
.addUserOption(option =>
option.setName('user')
.setDescription('User to remove')
.setRequired(true))
.addStringOption(option =>
option.setName('reason')
.setDescription('Removal reason')
.setMaxLength(500)
.setRequired(false)),
async execute(interaction) {
const banned = interaction.options.getUser('user');
const reason = interaction.options.getString('reason');
const type = interaction.options.getString('type');
const silent = interaction.options.getBoolean('silent');
const banEmbed = new EmbedBuilder();
if (type === 'ban') {
banEmbed.setTitle(`${banned.username} was banned`);
if (reason) {
banEmbed.setDescription(`Reason: ${reason}`);
}
}
else (type === 'kick')
{
banEmbed.setTitle(`${banned.username} was removed`);
if (reason) {
banEmbed.setDescription(`Reason: ${reason}`);
}
}
if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) {
return interaction.reply({ content: `Wait! You does not have enough permissions...`, ephemeral: true });
}
try {
if (type === 'ban') {
await interaction.guild.members.ban(banned, { reason });
} else if (type === 'kick') {
await interaction.guild.members.kick(banned, { reason });
}
interaction.reply({ embeds: [banEmbed], ephemeral: silent });
} catch (error) {
console.error(error);
// Check for specific error code '50013' (Missing Permissions)
if (error.code === 50013) {
interaction.reply({ content: `Strange... I do not have enough permissions (API 50013).`, ephemeral: true });
} else {
interaction.reply({ content: `There was an error while processing the action. (API ${error.code})`, ephemeral: true });
}
}
},
};

41
commands/mod/nuke.js Normal file
View file

@ -0,0 +1,41 @@
const { SlashCommandBuilder } = require('discord.js');
const { PermissionsBitField } = require('discord.js')
module.exports = {
data: new SlashCommandBuilder()
.setName('nuke')
.setDescription('Delete messages')
.addIntegerOption(option =>
option.setName('number')
.setDescription('How many messages?')
.setMaxValue(50)
.setMinValue(1)
.setRequired(true)),
async execute(interaction) {
const number = interaction.options.getInteger('number');
try {
// Check permissions
if (
!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)
) {
return await interaction.reply({ content: 'Error: missing permissions', ephemeral: true });
}
// Defer the action
await interaction.deferReply({ ephemeral: false });
// Delete the messages
await interaction.channel.bulkDelete(number);
// Delay
await new Promise(resolve => setTimeout(resolve, 8000));
// Answer
await interaction.followUp({ content: `${number} messages were deleted`});
} catch (error) {
console.error(error);
await interaction.followUp({ content: 'Unknown error.', ephemeral: true });
}
}
}

View file

@ -0,0 +1,24 @@
const { SlashCommandBuilder, ChannelType } = require(`discord.js`);
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName(`die`)
.setDescription(`You die in roleplay`)
.addStringOption(option =>
option.setName('reason')
.setDescription('Why?')
.setMaxLength(256)
.setRequired(true)),
async execute(interaction) {
const why = interaction.options.getString('reason')
const member = interaction.guild.members.cache.get(interaction.user.id);
const nickname = member.nickname;
const responseEmbed = new EmbedBuilder()
.setTitle(`${nickname} died...`)
.setDescription("..." + why)
interaction.reply({ embeds: [responseEmbed] });
},
}

View file

@ -0,0 +1,30 @@
const { SlashCommandBuilder, ChannelType } = require(`discord.js`)
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName(`do`)
.setDescription(`Indicates an action in roleplay`)
.addStringOption(option =>
option.setName('what')
.setDescription('What you gonna do?')
.setMaxLength(256)
.setRequired(true))
.addStringOption(option =>
option.setName('extra')
.setDescription('Describe the action')
.setMaxLength(4000)),
async execute(interaction) {
const action = interaction.options.getString('what')
const desc = interaction.options.getString(`extra`)
const member = interaction.guild.members.cache.get(interaction.user.id);
const nickname = member.nickname;
const responseEmbed = new EmbedBuilder()
.setTitle(`${nickname} ` + action + "...")
.setFooter({ text: `No one was killed or died` })
if (desc != null) {responseEmbed.setDescription("..." + desc)};
interaction.reply({ embeds: [responseEmbed] });
},
}

View file

@ -0,0 +1,27 @@
const { SlashCommandBuilder, ChannelType } = require(`discord.js`)
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName(`go`)
.setDescription(`Go to a channel in roleplay`)
.addChannelOption(option =>
option.setName('channel')
.setDescription('Where you wanna go?')
.setRequired(true)),
async execute(interaction) {
const chan = interaction.options.getChannel(`channel`)
const member = interaction.guild.members.cache.get(interaction.user.id);
const nickname = member.nickname;
const exitEmbed = new EmbedBuilder()
.setAuthor({ name: nickname })
.setDescription(`Went to <#${chan.id}>`)
const cameEmbed = new EmbedBuilder()
.setAuthor({ name: nickname })
.setDescription(`Came from <#${chan.id}>`)
interaction.reply({ embeds: [exitEmbed] });
chan.send({ embeds: [cameEmbed] });
},
}

View file

@ -0,0 +1,28 @@
const { SlashCommandBuilder, ChannelType } = require(`discord.js`)
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName(`kill`)
.setDescription(`Kill someone in roleplay`)
.addUserOption(option =>
option.setName('who')
.setRequired(true))
.addStringOption(option =>
option.setName('reason')
.setDescription('How?')
.setMaxLength(4000)
.setRequired(true)),
async execute(interaction) {
const member = interaction.guild.members.cache.get(interaction.user.id);
const nickname = member.nickname;
const dead = interaction.options.getUser('who')
const desc = interaction.options.getString(`reason`)
const responseEmbed = new EmbedBuilder()
.setTitle(`${nickname} killed someone:`)
.setDescription(`<@${dead.id}> died ${desc}`)
interaction.reply({ embeds: [responseEmbed] });
},
}

View file

@ -0,0 +1,22 @@
const { SlashCommandBuilder, ChannelType } = require(`discord.js`)
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName(`t`)
.setDescription(`Indicates a thought in roleplay`)
.addStringOption(option =>
option.setName('what')
.setRequired(true)),
async execute(interaction) {
const desc = interaction.options.getString(`what`)
const member = interaction.guild.members.cache.get(interaction.user.id);
const nickname = member.nickname;
const responseEmbed = new EmbedBuilder()
.setTitle(`${nickname} is thinking:`)
.setDescription(desc)
interaction.reply({ embeds: [responseEmbed] });
},
}