| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- var { Client, Attachment, MessageMentions } = require('discord.js');
- var bot = new Client()
- /*
- bot.on('ready', function() {
- // console.log('ready', arguments)
- console.log('Logged in as %s - %s\n', bot.username, bot.id);
- });
- */
- const EVERYONE_PATTERN = /@(everyone|here)/g
- const USERS_PATTERN = /<@!?([0-9]+)>/g
- const ROLES_PATTERN = /<@&([0-9]+)>/g
- const CHANNELS_PATTERN = /<#([0-9]+)>/g
- const stringify = message => `${new Date().toISOString()} #${message.channel.name} @${message.author.username}: ${message.toString()}`
- .replace(CHANNELS_PATTERN, ((m,id) => `#${message.mentions.channels.find(x => x.id == id).name}`))
- .replace(ROLES_PATTERN, ((m,id) => `[${message.mentions.roles.find(x => x.id == id).name}]`))
- .replace(USERS_PATTERN, ((m,id) => `@${message.mentions.users.find(x => x.id == id).username}`))
- bot.on('message', function(message) {
- console.log(stringify(message))
- });
- bot.on('messageDelete', function(message) {
- console.log(`[MessageDelete] ${stringify(message)}`)
- });
- bot.on('messageUpdate', function(oldMessage, newMessage) {
- console.log(`[MessageUpdate]\nold: ${stringify(oldMessage)}\nnew: ${stringify(newMessage)}`)
- })
- /*
- bot.on('channelCreate', function() { console.log('channelCreate', Array.from(arguments)) })
- bot.on('channelDelete', function() { console.log('channelDelete', Array.from(arguments)) })
- bot.on('channelPinsUpdate', function() { console.log('channelPinsUpdate', Array.from(arguments)) })
- bot.on('channelUpdate', function() { console.log('channelUpdate', Array.from(arguments)) })
- bot.on('clientUserGuildSettingsUpdate', function() { console.log('clientUserGuildSettingsUpdate', Array.from(arguments)) })
- bot.on('clientUserSettingsUpdate', function() { console.log('clientUserSettingsUpdate', Array.from(arguments)) })
- bot.on('debug', function() { console.log('debug', Array.from(arguments)) })
- bot.on('disconnect', function() { console.log('disconnect', Array.from(arguments)) })
- bot.on('emojiCreate', function() { console.log('emojiCreate', Array.from(arguments)) })
- bot.on('emojiDelete', function() { console.log('emojiDelete', Array.from(arguments)) })
- bot.on('emojiUpdate', function() { console.log('emojiUpdate', Array.from(arguments)) })
- bot.on('error', function() { console.log('error', Array.from(arguments)) })
- bot.on('guildBanAdd', function() { console.log('guildBanAdd', Array.from(arguments)) })
- bot.on('guildBanRemove', function() { console.log('guildBanRemove', Array.from(arguments)) })
- bot.on('guildCreate', function() { console.log('guildCreate', Array.from(arguments)) })
- bot.on('guildDelete', function() { console.log('guildDelete', Array.from(arguments)) })
- bot.on('guildMemberAdd', function() { console.log('guildMemberAdd', Array.from(arguments)) })
- bot.on('guildMemberAvailable', function() { console.log('guildMemberAvailable', Array.from(arguments)) })
- bot.on('guildMemberRemove', function() { console.log('guildMemberRemove', Array.from(arguments)) })
- bot.on('guildMembersChunk', function() { console.log('guildMembersChunk', Array.from(arguments)) })
- bot.on('guildMemberSpeaking', function() { console.log('guildMemberSpeaking', Array.from(arguments)) })
- bot.on('guildMemberUpdate', function() { console.log('guildMemberUpdate', Array.from(arguments)) })
- bot.on('guildUnavailable', function() { console.log('guildUnavailable', Array.from(arguments)) })
- bot.on('guildUpdate', function() { console.log('guildUpdate', Array.from(arguments)) })
- bot.on('message', function() { console.log('message', Array.from(arguments)) })
- bot.on('messageDelete', function() { console.log('messageDelete', Array.from(arguments)) })
- bot.on('messageDeleteBulk', function() { console.log('messageDeleteBulk', Array.from(arguments)) })
- bot.on('messageReactionAdd', function() { console.log('messageReactionAdd', Array.from(arguments)) })
- bot.on('messageReactionRemove', function() { console.log('messageReactionRemove', Array.from(arguments)) })
- bot.on('messageReactionRemoveAll', function() { console.log('messageReactionRemoveAll', Array.from(arguments)) })
- bot.on('messageUpdate', function() { console.log('messageUpdate', Array.from(arguments)) })
- bot.on('presenceUpdate', function() { console.log('presenceUpdate', Array.from(arguments)) })
- bot.on('rateLimit', function() { console.log('rateLimit', Array.from(arguments)) })
- bot.on('ready', function() { console.log('ready', Array.from(arguments)) })
- bot.on('reconnecting', function() { console.log('reconnecting', Array.from(arguments)) })
- bot.on('resume', function() { console.log('resume', Array.from(arguments)) })
- bot.on('roleCreate', function() { console.log('roleCreate', Array.from(arguments)) })
- bot.on('roleDelete', function() { console.log('roleDelete', Array.from(arguments)) })
- bot.on('roleUpdate', function() { console.log('roleUpdate', Array.from(arguments)) })
- bot.on('typingStart', function() { console.log('typingStart', Array.from(arguments)) })
- bot.on('typingStop', function() { console.log('typingStop', Array.from(arguments)) })
- bot.on('userNoteUpdate', function() { console.log('userNoteUpdate', Array.from(arguments)) })
- bot.on('userUpdate', function() { console.log('userUpdate', Array.from(arguments)) })
- bot.on('voiceStateUpdate', function() { console.log('voiceStateUpdate', Array.from(arguments)) })
- bot.on('warn', function() { console.log('warn', Array.from(arguments)) })
- */
- bot.login('NTA5NzMzOTczNjQ0Mjc5ODE4.DsSLOw.AeKUx4C-ceWxHYjf1tbephaRDxw')
- module.exports = bot
|