From d6c9d4b1128c5cddda74b3a84575388670edf221 Mon Sep 17 00:00:00 2001 From: Max Isom Date: Sat, 29 Jan 2022 11:36:24 -0500 Subject: [PATCH] Update invite permissions, send message to owner --- src/bot.ts | 4 ++-- src/events/guild-create.ts | 4 ++++ src/events/{handle-guild-update.ts => guild-update.ts} | 0 3 files changed, 6 insertions(+), 2 deletions(-) rename src/events/{handle-guild-update.ts => guild-update.ts} (100%) diff --git a/src/bot.ts b/src/bot.ts index 29cf818..0a041ec 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -7,6 +7,7 @@ import Command from './commands/index.js'; import debug from './utils/debug.js'; import handleGuildCreate from './events/guild-create.js'; import handleVoiceStateUpdate from './events/voice-state-update.js'; +import handleGuildUpdate from './events/guild-update.js'; import errorMsg from './utils/error-msg.js'; import {isUserInVoice} from './utils/channels.js'; import Config from './services/config.js'; @@ -14,7 +15,6 @@ import {generateDependencyReport} from '@discordjs/voice'; import {REST} from '@discordjs/rest'; import {Routes} from 'discord-api-types/v9'; import updatePermissionsForGuild from './utils/update-permissions-for-guild.js'; -import handleGuildUpdate from './events/handle-guild-update.js'; @injectable() export default class { @@ -152,7 +152,7 @@ export default class { spinner.text = '📡 updating permissions...'; await Promise.all(this.client.guilds.cache.map(async guild => updatePermissionsForGuild(guild))); - spinner.succeed(`Ready! Invite the bot with https://discordapp.com/oauth2/authorize?client_id=${this.client.user?.id ?? ''}&scope=bot%20applications.commands&permissions=2184236096`); + spinner.succeed(`Ready! Invite the bot with https://discordapp.com/oauth2/authorize?client_id=${this.client.user?.id ?? ''}&scope=bot%20applications.commands&permissions=36700160`); }); this.client.on('error', console.error); diff --git a/src/events/guild-create.ts b/src/events/guild-create.ts index 8db7e2f..630d6cb 100644 --- a/src/events/guild-create.ts +++ b/src/events/guild-create.ts @@ -32,4 +32,8 @@ export default async (guild: Guild): Promise => { {body: container.getAll(TYPES.Command).map(command => command.slashCommand.toJSON())}, ); } + + const owner = await guild.fetchOwner(); + + await owner.send('👋 Hi! Someone (probably you) just invited me to a server you own. I can\'t be used by your server members until you complete setup by running /config set-role in your server.'); }; diff --git a/src/events/handle-guild-update.ts b/src/events/guild-update.ts similarity index 100% rename from src/events/handle-guild-update.ts rename to src/events/guild-update.ts