From e7d169852851f88b26b386acb2223f2ae4de657b Mon Sep 17 00:00:00 2001 From: Pop Flamingo <8317047+PopFlamingo@users.noreply.github.com> Date: Fri, 9 Sep 2022 07:00:45 +0200 Subject: [PATCH] Set bot's activity (#37) This sets the bot activity to "/horaires trams & bus" which should enable users to know about the bot's purpose as well as how to use it. --- main.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.ts b/main.ts index ee732f6..d80b7ee 100644 --- a/main.ts +++ b/main.ts @@ -10,6 +10,7 @@ require("dotenv").config(); (async () => { const client = new Client({ intents: [Intents.FLAGS.GUILDS] }); + // Store token in a variable from the DISCORD_TOKEN environment variable const token = process.env.DISCORD_TOKEN; @@ -147,5 +148,12 @@ require("dotenv").config(); }); // Login to Discord - client.login(token); + await client.login(token); + + // Set activity to the name of the main command + if (client.user !== null) { + client.user.setActivity('/horaires trams & bus', { type: 'PLAYING' }); + } else { + console.error("Unexpected null client.user") + } })();