2020-12-31 16:10:56 +00:00
|
|
|
import Event from "../core/event";
|
|
|
|
import $ from "../core/lib";
|
|
|
|
import {updateGlobalEmoteRegistry} from "../core/lib";
|
2021-04-03 04:11:18 +00:00
|
|
|
import {client} from "../index";
|
|
|
|
import {Config} from "../core/structures";
|
|
|
|
import {TextChannel} from "discord.js";
|
2020-12-31 16:10:56 +00:00
|
|
|
|
|
|
|
export default new Event<"guildCreate">({
|
2021-04-01 13:41:49 +00:00
|
|
|
on(guild) {
|
|
|
|
$.log(
|
|
|
|
`[GUILD JOIN] ${guild.name} (${guild.id}) added the bot. Owner: ${guild.owner!.user.tag} (${
|
|
|
|
guild.owner!.user.id
|
|
|
|
}). Updated emote registry.`
|
|
|
|
);
|
2021-04-03 04:11:18 +00:00
|
|
|
|
|
|
|
if (Config.systemLogsChannel) {
|
|
|
|
const channel = client.channels.cache.get(Config.systemLogsChannel);
|
|
|
|
|
|
|
|
if (channel && channel.type === "text") {
|
|
|
|
(channel as TextChannel).send(
|
|
|
|
`TravBot joined: \`${guild.name}\`. The owner of this guild is: \`${guild.owner!.user.tag}\` (\`${
|
|
|
|
guild.owner!.user.id
|
|
|
|
}\`)`
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
console.warn(`${Config.systemLogsChannel} is not a valid text channel for system logs!`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-31 16:10:56 +00:00
|
|
|
updateGlobalEmoteRegistry();
|
|
|
|
}
|
|
|
|
});
|