Embed base images into binary
Include resource directory Ran `deno fmt` with 4 space indent, that changed every file (!!!!!) various changes
This commit is contained in:
@@ -5,34 +5,41 @@ import Logging from "@proxnet/undead-logging";
|
||||
const log = new Logging("Discord");
|
||||
|
||||
const config = Config.getConfig();
|
||||
if (typeof config == 'undefined') {
|
||||
if (typeof config == "undefined") {
|
||||
log.e(`Cannot start: Discord configuration is unavailable`);
|
||||
Deno.exit(1);
|
||||
}
|
||||
|
||||
export const client = new discord.Client({ intents: [discord.GatewayIntentBits.Guilds, discord.GatewayIntentBits.GuildPresences] });
|
||||
export const client = new discord.Client({
|
||||
intents: [
|
||||
discord.GatewayIntentBits.Guilds,
|
||||
discord.GatewayIntentBits.GuildPresences,
|
||||
],
|
||||
});
|
||||
|
||||
client.once(discord.Events.ClientReady, client => {
|
||||
client.once(discord.Events.ClientReady, (client) => {
|
||||
log.i(`Logged in to Discord as "${client.user.tag}"`);
|
||||
client.user?.setActivity(config.public.motd, { type: discord.ActivityType.Custom });
|
||||
client.user?.setActivity(config.public.motd, {
|
||||
type: discord.ActivityType.Custom,
|
||||
});
|
||||
});
|
||||
|
||||
let shuttingDown = false;
|
||||
Deno.addSignalListener('SIGINT', () => {
|
||||
Deno.addSignalListener("SIGINT", () => {
|
||||
if (client.readyTimestamp == null) return;
|
||||
if (shuttingDown) return;
|
||||
shuttingDown = true;
|
||||
log.n('Disconnecting from Discord');
|
||||
log.n("Disconnecting from Discord");
|
||||
client.destroy();
|
||||
});
|
||||
|
||||
export function login() {
|
||||
if (config.discord?.token == Config.defaultConfig.discord?.token) {
|
||||
log.i('Discord not configured, ignoring');
|
||||
log.i("Discord not configured, ignoring");
|
||||
return;
|
||||
}
|
||||
log.i(`Creating Discord connection..`);
|
||||
client.login(config.discord?.token);
|
||||
}
|
||||
|
||||
export * as Discord from "./discord.ts";
|
||||
export * as Discord from "./discord.ts";
|
||||
|
||||
Reference in New Issue
Block a user