-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #209 from TogetherCrew/delete-guildCommands-for-rn…
…dao-and-make-question-command-public Delete guild commands for rndao and make question command public
- Loading branch information
Showing
4 changed files
with
32 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import 'dotenv/config'; | ||
import { REST, Routes } from 'discord.js'; | ||
import parentLogger from '../config/logger'; | ||
import config from '../config'; | ||
const logger = parentLogger.child({ module: `deleteRnDAOGuildCommands` }); | ||
|
||
/** | ||
* Delete RnDAO guild commands | ||
*/ | ||
async function deleteRnDAOGuildCommands(): Promise<void> { | ||
try { | ||
const rest = new REST().setToken(config.discord.botToken); | ||
const guildCommands: any = await rest.get( | ||
// RnDAO:915914985140531240 | ||
Routes.applicationGuildCommands(config.discord.clientId, '915914985140531240'), | ||
); | ||
guildCommands.forEach(async (command: any) => { | ||
await rest.delete(Routes.applicationGuildCommand(config.discord.clientId, '915914985140531240', command.id)); | ||
}); | ||
} catch (error) { | ||
console.log(error); | ||
logger.error('Failed to delete RnDAO guild commands', error); | ||
} | ||
} | ||
|
||
deleteRnDAOGuildCommands().catch((error) => { | ||
logger.error('Unhandled exception in deleting RnDAO guild commands', error); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters