Skip to content

Commit

Permalink
fix: add guard for missing internal guild
Browse files Browse the repository at this point in the history
  • Loading branch information
Snazzah committed Apr 9, 2024
1 parent 7b1a249 commit 1dfe8a8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
6 changes: 6 additions & 0 deletions apps/bot/src/commands/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ export default class Info extends GeneralCommand {
emoji: {
id: this.client.config.craig.emoji
}
},
{
type: ComponentType.BUTTON,
style: ButtonStyle.LINK,
label: 'Support Server',
url: 'https://discord.gg/craig'
}
]
}
Expand Down
21 changes: 20 additions & 1 deletion apps/bot/src/commands/join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,26 @@ export default class Join extends GeneralCommand {

async run(ctx: CommandContext) {
if (!ctx.guildID) return 'This command can only be used in a guild.';
const guild = this.client.bot.guilds.get(ctx.guildID)!;
const guild = this.client.bot.guilds.get(ctx.guildID);

if (!guild)
return {
content: 'There is a rare issue occuring with this server, try re-inviting this bot. If the issue persists, join the support server.',
ephemeral: true,
components: [
{
type: ComponentType.ACTION_ROW,
components: [
{
type: ComponentType.BUTTON,
style: ButtonStyle.LINK,
label: 'Join Support Server',
url: 'https://discord.gg/craig'
}
]
}
]
};

if (await checkBan(ctx.user.id))
return {
Expand Down

0 comments on commit 1dfe8a8

Please sign in to comment.