commit
This commit is contained in:
parent
4cb2217898
commit
8a23e86b12
5 changed files with 89 additions and 1 deletions
18
src/events/guildCreate.ts
Normal file
18
src/events/guildCreate.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { Events, Guild } from "discord.js";
|
||||
import { connectToDb, getguild, addGuild } from "../libs/mysql.js";
|
||||
|
||||
export default {
|
||||
name: Events.GuildCreate,
|
||||
async execute(guild: Guild) {
|
||||
const connection = await connectToDb();
|
||||
const guild_obj: any[] = await getguild(connection, guild.id);
|
||||
|
||||
connection.end()
|
||||
|
||||
if (guild_obj[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
addGuild(connection, guild.id);
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue