src
This commit is contained in:
parent
6ea0e02ee8
commit
a26c05c69e
2 changed files with 43 additions and 2 deletions
|
|
@ -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)
|
const preferredApi = getSongOnPreferredProvider(await fetch(`https://api.song.link/v1-alpha.1/links?url=${link}`).then(a => a.json()), link)
|
||||||
if (!preferredApi) {
|
if (!preferredApi) {
|
||||||
interaction.followUp("song not found")
|
await interaction.followUp("song not found")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
|
|
@ -56,7 +56,7 @@ export default class PingCommand extends Command {
|
||||||
text: "amy jr",
|
text: "amy jr",
|
||||||
});
|
});
|
||||||
const nya = new ActionRowBuilder<ButtonBuilder>().addComponents(new ButtonBuilder().setURL(preferredApi.link).setLabel("link").setStyle(ButtonStyle.Link))
|
const nya = new ActionRowBuilder<ButtonBuilder>().addComponents(new ButtonBuilder().setURL(preferredApi.link).setLabel("link").setStyle(ButtonStyle.Link))
|
||||||
interaction.followUp({
|
await interaction.followUp({
|
||||||
components: [
|
components: [
|
||||||
nya
|
nya
|
||||||
],
|
],
|
||||||
|
|
|
||||||
41
src/commands/src.ts
Normal file
41
src/commands/src.ts
Normal file
|
|
@ -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<ButtonBuilder>().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
|
||||||
|
]);
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue