Browse Source

Update join message and set slash commands on guild join

pull/10/head
Abheek Dhawan 4 years ago
parent
commit
d41e91c8e4
  1. 11
      bot/awesomescibo.js

11
bot/awesomescibo.js

@ -16,8 +16,7 @@ const gitlog = require("gitlog").default;
const helpMessage = const helpMessage =
"`do be helping`: display this help message\n`do be roundgen`: send a pdf round to the channel\n`do be scoring`: start a scoring session\n > `do be scoring (a/b)(4/10)`: add points to Team A or Team B\n > `do be scoring stop`: end scoring session and post final points\n > `do be servers`: send the number of servers this bot is a part of\n > `do be iss`: show the current location of the International Space Station\n`do be training`: send a quick practice problem (you **must** react to your answer, or the bot will yell at you)\n > subject options: astro, phys, chem, math, bio, ess, energy\n`do be top`: list cross-server top 10 players\n `do be about`: List people who contributed to this bot\n Source Code: https://github.com/ADawesomeguy/AwesomeSciBo (don't forget to star!)"; "`do be helping`: display this help message\n`do be roundgen`: send a pdf round to the channel\n`do be scoring`: start a scoring session\n > `do be scoring (a/b)(4/10)`: add points to Team A or Team B\n > `do be scoring stop`: end scoring session and post final points\n > `do be servers`: send the number of servers this bot is a part of\n > `do be iss`: show the current location of the International Space Station\n`do be training`: send a quick practice problem (you **must** react to your answer, or the bot will yell at you)\n > subject options: astro, phys, chem, math, bio, ess, energy\n`do be top`: list cross-server top 10 players\n `do be about`: List people who contributed to this bot\n Source Code: https://github.com/ADawesomeguy/AwesomeSciBo (don't forget to star!)";
client.once("ready", () => { const slashCommands = [
client.application.commands.set([
{ {
"name": "train", "name": "train",
"description": "Sends a single training question to be answered", "description": "Sends a single training question to be answered",
@ -91,7 +90,10 @@ client.once("ready", () => {
"name": "iss", "name": "iss",
"description": "Shows the location of the ISS on a map as well as all of the current astronauts within it" "description": "Shows the location of the ISS on a map as well as all of the current astronauts within it"
} }
]); ]
client.once("ready", () => {
client.application.commands.set(slashCommands);
// Connect to MongoDB using mongoose // Connect to MongoDB using mongoose
if (!process.env.CI) { if (!process.env.CI) {
@ -113,6 +115,7 @@ client.once("ready", () => {
}); });
client.on("guildCreate", (guild) => { client.on("guildCreate", (guild) => {
guild.commands.set(slashCommands);
const welcomeChannel = guild.channels.cache const welcomeChannel = guild.channels.cache
.find( .find(
(channel) => (channel) =>
@ -120,7 +123,7 @@ client.on("guildCreate", (guild) => {
channel.name === "general" && channel.type === "text" channel.name === "general" && channel.type === "text"
) )
if (welcomeChannel) { if (welcomeChannel) {
welcomeChannel.send("'Sup, I'm the AwesomeSciBo bot!") welcomeChannel.send("'Sup, I'm the AwesomeSciBo bot! Use `/help` to learn more about me!");
.catch(console.error); .catch(console.error);
} }
}); });

Loading…
Cancel
Save