29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { ExitCode, ExitCodes } from "../../exit-codes/exit-codes";
|
|
import Logger from "../../logger/logger";
|
|
import DB from "../db";
|
|
|
|
const LOG = Logger.create('setup-test-guild');
|
|
|
|
process.on('unhandledRejection', async (reason, promise) => {
|
|
LOG.error('unhandled promise rejection:', reason);
|
|
ExitCodes.exit(ExitCode.GENERAL_ERROR);
|
|
});
|
|
|
|
(async () => {
|
|
await DB.connect();
|
|
try {
|
|
let guilds = await DB.getAllGuilds();
|
|
let targetGuild = guilds.find(guild => guild.name == 'no chicoms');
|
|
let members = await DB.getMembers(targetGuild.id);
|
|
let targetMember = members.find(member => member.display_name == 'Elipzer');
|
|
let channels = await DB.getChannels(targetGuild.id);
|
|
let targetChannel = channels.find(channel => channel.name == 'memes');
|
|
for (let i = 0; i < 2000; ++i) {
|
|
await DB.insertMessage(targetGuild.id, targetChannel.id, targetMember.id, 'Test Message #' + i);
|
|
}
|
|
LOG.info('inserted testing messages');
|
|
} catch (e) {
|
|
LOG.error('error inserting messages', e);
|
|
}
|
|
await DB.end();
|
|
})(); |