Skip to content

Commit

Permalink
GH-292: Add MessageContent intent if using text command
Browse files Browse the repository at this point in the history
  • Loading branch information
utarwyn committed Jul 27, 2022
1 parent b5f0ead commit 529b814
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/index.ts
Expand Up @@ -57,10 +57,21 @@ class TicTacToe {
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions
GatewayIntentBits.GuildMessageReactions,
...(this.config.textCommand ? [GatewayIntentBits.MessageContent] : [])
]
});
await client.login(loginToken);

try {
await client.login(loginToken);
} catch (e: any) {
if (e.message?.startsWith('Privileged')) {
throw new Error('You must enable Message Content intent to use the text command.');
} else {
throw e;
}
}

this.bot.attachToClient(client);
}

Expand Down

0 comments on commit 529b814

Please sign in to comment.