2022-04-04 22:14:12 +02:00
|
|
|
import { Client } from '@janderedev/revolt.js';
|
2022-04-18 19:05:31 +02:00
|
|
|
import axios from 'axios';
|
2022-04-04 22:14:12 +02:00
|
|
|
import { logger } from '..';
|
|
|
|
|
2022-04-18 19:05:31 +02:00
|
|
|
let AUTUMN_URL = `http://autumnUrl`;
|
|
|
|
|
2022-04-04 22:14:12 +02:00
|
|
|
const client = new Client({
|
|
|
|
messageTimeoutFix: true,
|
|
|
|
autoReconnect: true,
|
|
|
|
onPongTimeout: 'RECONNECT',
|
|
|
|
});
|
|
|
|
|
|
|
|
const login = () => new Promise((resolve: (value: Client) => void) => {
|
|
|
|
client.loginBot(process.env['REVOLT_TOKEN']!);
|
2022-04-18 19:05:31 +02:00
|
|
|
client.once('ready', async () => {
|
2022-04-04 22:14:12 +02:00
|
|
|
logger.info(`Revolt: ${client.user?.username} ready - ${client.servers.size} servers`);
|
2022-04-18 19:05:31 +02:00
|
|
|
|
|
|
|
const apiConfig = await axios.get(client.apiURL);
|
|
|
|
AUTUMN_URL = apiConfig.data?.features?.autumn?.url;
|
|
|
|
|
2022-04-04 22:14:12 +02:00
|
|
|
resolve(client);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
import('./events');
|
|
|
|
|
2022-04-18 19:05:31 +02:00
|
|
|
export { client, login, AUTUMN_URL }
|