2020-10-22 15:50:47 +00:00
|
|
|
import { Client } from '../models/client.ts'
|
|
|
|
import { GatewayIntents } from '../types/gatewayTypes.ts'
|
2020-10-22 15:55:42 +00:00
|
|
|
import { TOKEN } from './config.ts'
|
2020-10-25 17:03:53 +00:00
|
|
|
import { Channel } from '../structures/channel.ts'
|
|
|
|
import { GuildTextChannel } from '../structures/guildTextChannel.ts'
|
2020-10-30 14:51:40 +00:00
|
|
|
import { TextChannel } from '../structures/textChannel.ts'
|
|
|
|
import { Guild } from '../structures/guild.ts'
|
|
|
|
import { User } from '../structures/user.ts'
|
2020-10-22 15:50:47 +00:00
|
|
|
|
|
|
|
const bot = new Client()
|
|
|
|
|
2020-10-25 17:03:53 +00:00
|
|
|
bot.on('ready', () => {
|
|
|
|
console.log('READY!')
|
|
|
|
})
|
2020-10-23 16:11:00 +00:00
|
|
|
|
2020-10-30 14:51:40 +00:00
|
|
|
bot.on('channelDelete', (channel: Channel) => {
|
|
|
|
console.log('channelDelete', channel.id)
|
|
|
|
})
|
|
|
|
|
2020-10-25 17:03:53 +00:00
|
|
|
bot.on('channelUpdate', (before: Channel, after: Channel) => {
|
|
|
|
if (before instanceof GuildTextChannel && after instanceof GuildTextChannel) {
|
2020-10-30 14:51:40 +00:00
|
|
|
console.log('channelUpdate', before.name)
|
|
|
|
console.log('channelUpdate', after.name)
|
2020-10-29 14:43:27 +00:00
|
|
|
} else {
|
2020-10-30 14:51:40 +00:00
|
|
|
console.log('channelUpdate', before.id)
|
|
|
|
console.log('channelUpdate', after.id)
|
2020-10-25 17:03:53 +00:00
|
|
|
}
|
2020-10-25 06:50:32 +00:00
|
|
|
})
|
|
|
|
|
2020-10-30 14:51:40 +00:00
|
|
|
bot.on('channelCreate', (channel: Channel) => {
|
|
|
|
console.log('channelCreate', channel.id)
|
|
|
|
})
|
|
|
|
|
|
|
|
bot.on('channelPinsUpdate', (before: TextChannel, after: TextChannel) => {
|
|
|
|
console.log(
|
|
|
|
'channelPinsUpdate',
|
|
|
|
before.lastPinTimestamp,
|
|
|
|
after.lastPinTimestamp
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
bot.on('guildBanAdd', (guild: Guild, user: User) => {
|
|
|
|
console.log('guildBanAdd', guild.id, user.id)
|
|
|
|
})
|
|
|
|
|
|
|
|
bot.on('guildBanRemove', (guild: Guild, user: User) => {
|
|
|
|
console.log('guildBanRemove', guild.id, user.id)
|
|
|
|
})
|
|
|
|
|
|
|
|
bot.on('guildCreate', (guild: Guild) => {
|
|
|
|
console.log('guildCreate', guild.id)
|
|
|
|
})
|
|
|
|
|
|
|
|
bot.on('guildDelete', (guild: Guild) => {
|
|
|
|
console.log('guildDelete', guild.id)
|
|
|
|
})
|
|
|
|
|
|
|
|
bot.on('guildUpdate', (before: Guild, after: Guild) => {
|
|
|
|
console.log('guildUpdate', before.name, after.name)
|
|
|
|
})
|
|
|
|
|
2020-10-25 17:03:53 +00:00
|
|
|
bot.connect(TOKEN, [
|
|
|
|
GatewayIntents.GUILD_MEMBERS,
|
|
|
|
GatewayIntents.GUILD_PRESENCES,
|
2020-10-30 14:51:40 +00:00
|
|
|
GatewayIntents.GUILD_MESSAGES,
|
|
|
|
GatewayIntents.DIRECT_MESSAGES,
|
|
|
|
GatewayIntents.DIRECT_MESSAGE_REACTIONS,
|
|
|
|
GatewayIntents.DIRECT_MESSAGE_TYPING,
|
|
|
|
GatewayIntents.GUILDS,
|
|
|
|
GatewayIntents.GUILD_BANS,
|
|
|
|
GatewayIntents.GUILD_EMOJIS,
|
|
|
|
GatewayIntents.GUILD_INTEGRATIONS,
|
|
|
|
GatewayIntents.GUILD_INVITES,
|
|
|
|
GatewayIntents.GUILD_MESSAGE_REACTIONS,
|
|
|
|
GatewayIntents.GUILD_MESSAGE_TYPING,
|
|
|
|
GatewayIntents.GUILD_VOICE_STATES,
|
|
|
|
GatewayIntents.GUILD_WEBHOOKS
|
2020-10-25 17:03:53 +00:00
|
|
|
])
|