Last active
July 5, 2022 07:56
-
-
Save PhantomNimbi/78abe4334c3d455112c2303634d57fb2 to your computer and use it in GitHub Desktop.
Simple Pylon.bot About Command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as app from '../config'; | |
const config = { | |
slashCommands: discord.interactions.commands, | |
links: { | |
studio: '[Pylon Studio](https://pylon.bot/studio)', | |
website: '[Pylon.bot](https://pylon.bot/)', | |
discord: '[Discord](https://discord.gg/6DbcNPz)', | |
}, | |
embeds: { | |
image: | |
'https://github.com/NimbiDev/Pylon-Bot/raw/main/.github/assets/banner.png', | |
color: discord.decor.RoleColors.BLUE, | |
}, | |
}; | |
const slashCommands = config.slashCommands; | |
const links = { | |
discord: config.links.discord, | |
pylon: config.links.website, | |
studio: config.links.studio, | |
}; | |
const embeds = { | |
image: config.embeds.image, | |
color: config.embeds.color, | |
}; | |
slashCommands.register( | |
{ | |
name: 'about', | |
description: 'Get information about Pylon', | |
ackBehavior: slashCommands.AckBehavior.AUTO_EPHEMERAL, | |
}, | |
async (interaction) => { | |
let self = await discord.getBotUser(); | |
const embed = new discord.Embed(); | |
embed.setTitle('Pylon.bot'); | |
embed.setDescription( | |
[`You write it. We run it.`, ``].join('\n\n') + | |
[ | |
`Build and deploy Discord bots in minutes using our simple online studio.`, | |
`Forget about renting or maintaining servers.`, | |
`Use our simple JavaScript SDK to build your bots and we'll do the heavy lifting.`, | |
].join(' ' + ' ') | |
); | |
embed.setFields([ | |
{ | |
name: 'Links', | |
value: [ | |
`:white_small_square: ${links.pylon}`, | |
`:white_small_square: ${links.studio}`, | |
`:white_small_square: ${links.discord}`, | |
].join('\n'), | |
}, | |
]); | |
embed.setImage({ url: embeds.image }); | |
embed.setFooter({ | |
text: 'Powered by ' + self.username, | |
iconUrl: self.getAvatarUrl(), | |
}); | |
embed.setColor(embeds.color); | |
embed.setTimestamp(new Date().toISOString()); | |
await interaction.respond({ embeds: [embed] }).catch((_) => { | |
interaction.respondEphemeral( | |
[ | |
':warning: **__Error Triggered__** :warning:', | |
'', | |
'```ts', | |
`${_}`, | |
'```', | |
].join('\n') | |
); | |
console.log( | |
`>> | (${_.code}) ${_.name}: ${_.message} \n------------------------------------------------------------\n${_.stack}` | |
); | |
}); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment