the first commit
This commit is contained in:
commit
d5920470cc
18 changed files with 1887 additions and 0 deletions
50
commands/misc/lyrics.js
Normal file
50
commands/misc/lyrics.js
Normal 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
31
commands/misc/myname.js
Normal 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 });
|
||||
}
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue