mirror of
https://github.com/Burn-E99/TheArtificer.git
synced 2026-01-06 20:37:54 -05:00
Add opt-out/opt-in commands
Allows users to be globally ignored by the bot.
This commit is contained in:
@ -19,8 +19,20 @@ await dbClient.execute(`DROP PROCEDURE IF EXISTS INC_HEATMAP;`);
|
||||
await dbClient.execute(`DROP TABLE IF EXISTS roll_time_heatmap;`);
|
||||
await dbClient.execute(`DROP PROCEDURE IF EXISTS INC_CNT;`);
|
||||
await dbClient.execute(`DROP TABLE IF EXISTS command_cnt;`);
|
||||
await dbClient.execute(`DROP TABLE IF EXISTS ignore_list;`);
|
||||
console.log('Tables dropped');
|
||||
|
||||
// Table to hold list of users who want to be ignored by the bot
|
||||
console.log('Attempting to create table ignore_list');
|
||||
await dbClient.execute(`
|
||||
CREATE TABLE ignore_list (
|
||||
userid bigint unsigned NOT NULL,
|
||||
PRIMARY KEY (userid),
|
||||
UNIQUE KEY ignore_list_userid_UNIQUE (userid)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
`);
|
||||
console.log('Table created');
|
||||
|
||||
// Light telemetry on how many commands have been run
|
||||
console.log('Attempting to create table command_cnt');
|
||||
await dbClient.execute(`
|
||||
|
||||
@ -10,7 +10,7 @@ await dbClient.execute('INSERT INTO all_keys(userid,apiKey) values(?,?)', [confi
|
||||
console.log('Inesrtion done');
|
||||
|
||||
console.log('Attempting to insert default commands into command_cnt');
|
||||
const commands = ['ping', 'rip', 'rollhelp', 'help', 'info', 'version', 'report', 'stats', 'roll', 'emojis', 'api', 'privacy', 'mention', 'audit', 'heatmap', 'rollDecorators'];
|
||||
const commands = ['ping', 'rip', 'rollhelp', 'help', 'info', 'version', 'report', 'stats', 'roll', 'emojis', 'api', 'privacy', 'mention', 'audit', 'heatmap', 'rollDecorators', 'opt-out', 'opt-in'];
|
||||
for (const command of commands) {
|
||||
await dbClient.execute('INSERT INTO command_cnt(command) values(?)', [command]).catch((e) => {
|
||||
console.log(`Failed to insert ${command} into database`, e);
|
||||
|
||||
Reference in New Issue
Block a user