mirror of
https://github.com/arthur-pbty/selfbot-discord.git
synced 2026-06-03 23:36:23 +02:00
add autovoc
This commit is contained in:
+47
-2
@@ -1,11 +1,14 @@
|
||||
const { Events, ActivityType } = require("discord.js");
|
||||
const addBaseInDB = require("../fonctions/addBaseInDB");
|
||||
const { Client, RichPresence, CustomStatus } = require('discord.js-selfbot-v13');
|
||||
import sqlite3 from 'sqlite3';
|
||||
require('dotenv').config();
|
||||
const joinVC = require('../fonctions/joinVC');
|
||||
|
||||
module.exports = {
|
||||
name: Events.ClientReady,
|
||||
async execute(client: any) {
|
||||
addBaseInDB(client);
|
||||
await addBaseInDB(client);
|
||||
console.log(`le bot ${client.user.tag} est en ligne`)
|
||||
|
||||
const status = new RichPresence(client)
|
||||
@@ -34,6 +37,48 @@ module.exports = {
|
||||
setInterval(() => {
|
||||
client.user.setPresence({ activities: [status, customs[index]] });
|
||||
index = (index + 1) % customs.length;
|
||||
}, 10000);
|
||||
}, 3000);
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
let voc = 'None';
|
||||
db.all('SELECT * FROM config', (err: any, rows: any) => {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
}
|
||||
rows.forEach((row: any) => {
|
||||
if (row.name === 'autovoc') {
|
||||
voc = row.value || 'None';
|
||||
if (voc !== 'None') {
|
||||
joinVC(client, voc);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
db.close((err) => {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
}
|
||||
});
|
||||
|
||||
setInterval(() => {
|
||||
if (voc !== 'None') {
|
||||
const voiceChannel: any = client.channels.cache.get(voc);
|
||||
if (!voiceChannel) return;
|
||||
const guild = client.guilds.cache.get(voiceChannel.guildId);
|
||||
if (!guild) return;
|
||||
const member = guild.members.cache.get(client.user.id);
|
||||
if (!member.voice.channel) {
|
||||
joinVC(client, voc);
|
||||
}
|
||||
}
|
||||
}, 5000);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user