mirror of
https://github.com/arthur-pbty/selfbot-discord.git
synced 2026-06-03 23:36:23 +02:00
add set prefix
This commit is contained in:
@@ -0,0 +1,34 @@
|
|||||||
|
import { Message, Client } from 'discord.js';
|
||||||
|
import sqlite3 from 'sqlite3';
|
||||||
|
require('dotenv').config();
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
aliases: [],
|
||||||
|
description: 'Change le préfixe du bot.',
|
||||||
|
emote: '⏱️',
|
||||||
|
utilisation: '',
|
||||||
|
|
||||||
|
async execute(message: Message, args: string[], client: Client) {
|
||||||
|
const dbName = process.env.DB_NAME || 'db.db';
|
||||||
|
let db = new sqlite3.Database(dbName, sqlite3.OPEN_READWRITE | sqlite3.OPEN_CREATE, (err: any) => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const prefix = args[0] || '!!';
|
||||||
|
db.run('UPDATE config SET value = ? WHERE name = "prefix"', [prefix], (err: any) => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
db.close((err) => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
message.edit(`Le préfixe a été changé pour \`${prefix}\``);
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -55,9 +55,6 @@ module.exports = {
|
|||||||
rows.forEach((row: any) => {
|
rows.forEach((row: any) => {
|
||||||
if (row.name === 'autovoc') {
|
if (row.name === 'autovoc') {
|
||||||
voc = row.value || 'None';
|
voc = row.value || 'None';
|
||||||
if (voc !== 'None') {
|
|
||||||
joinVC(client, voc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+17
-11
@@ -9,18 +9,24 @@ module.exports = function addBaseInDB(client: any) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const prefix = process.env.DEFAULT_PREFIX || '!!';
|
db.serialize(() => {
|
||||||
db.run('INSERT OR IGNORE INTO config(name, value) VALUES(?, ?)', ['prefix', prefix], (err) => {
|
db.run('BEGIN TRANSACTION');
|
||||||
if (err) {
|
|
||||||
console.error(err.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const voc = 'None';
|
const prefix = process.env.DEFAULT_PREFIX || '!!';
|
||||||
db.run('INSERT OR IGNORE INTO config(name, value) VALUES(?, ?)', ['autovoc', voc], (err) => {
|
db.run('INSERT OR IGNORE INTO config(name, value) VALUES(?, ?)', ['prefix', prefix], (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err.message);
|
console.error(err.message);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const voc = 'None';
|
||||||
|
db.run('INSERT OR IGNORE INTO config(name, value) VALUES(?, ?)', ['autovoc', voc], (err) => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
db.run('COMMIT');
|
||||||
});
|
});
|
||||||
|
|
||||||
db.close((err) => {
|
db.close((err) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user