From a26c05c69e7fa1cb4000e77d2388b2d4b1cde6a3 Mon Sep 17 00:00:00 2001 From: amy Date: Sat, 22 Feb 2025 17:43:28 +0330 Subject: [PATCH] src --- src/commands/nowplaying.ts | 4 ++-- src/commands/src.ts | 41 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 src/commands/src.ts diff --git a/src/commands/nowplaying.ts b/src/commands/nowplaying.ts index ea1f492..2ed2e4e 100644 --- a/src/commands/nowplaying.ts +++ b/src/commands/nowplaying.ts @@ -43,7 +43,7 @@ export default class PingCommand extends Command { const preferredApi = getSongOnPreferredProvider(await fetch(`https://api.song.link/v1-alpha.1/links?url=${link}`).then(a => a.json()), link) if (!preferredApi) { - interaction.followUp("song not found") + await interaction.followUp("song not found") return } const embed = new EmbedBuilder() @@ -56,7 +56,7 @@ export default class PingCommand extends Command { text: "amy jr", }); const nya = new ActionRowBuilder().addComponents(new ButtonBuilder().setURL(preferredApi.link).setLabel("link").setStyle(ButtonStyle.Link)) - interaction.followUp({ + await interaction.followUp({ components: [ nya ], diff --git a/src/commands/src.ts b/src/commands/src.ts new file mode 100644 index 0000000..f39cf72 --- /dev/null +++ b/src/commands/src.ts @@ -0,0 +1,41 @@ +import {Command} from "../command.ts"; +import { + ActionRowBuilder, + ApplicationIntegrationType, ButtonBuilder, ButtonStyle, + ChatInputCommandInteraction, EmbedBuilder, + InteractionContextType, + SlashCommandBuilder +} from "discord.js"; + +export default class PingCommand extends Command { + async run(interaction: ChatInputCommandInteraction, config) { + const repo = interaction.options.getString("repo") + const meow = await fetch(config.gitapi + repo).then(res => res.json()); + const embed = new EmbedBuilder() + .setAuthor({ + name: meow.name, + }) + .setTitle(meow.description) + .setImage(meow.owner.avatar_url); + const nya = new ActionRowBuilder().addComponents(new ButtonBuilder().setURL(meow.html_url).setLabel("link").setStyle(ButtonStyle.Link)) + await interaction.reply({ + components: [ + nya + ], + embeds: [embed], + }); + } + + slashCommand = new SlashCommandBuilder() + .setName("src") + .setDescription("get src of shit").setIntegrationTypes([ + ApplicationIntegrationType.UserInstall + ]).addStringOption(option => { + return option.setName("repo").setDescription("name").setRequired(true); + }) + .setContexts([ + InteractionContextType.BotDM, + InteractionContextType.Guild, + InteractionContextType.PrivateChannel + ]); +} \ No newline at end of file