buddy

node MVC discord bot
Log | Files | Refs | README

index.ts (760B)


      1 /// <reference path="index.d.ts" />
      2 
      3 import { Client } from 'discord.js';
      4 
      5 const client: Client = new Client();
      6 
      7 client.on('ready', () => {
      8   console.log(`Client is logged in as ${client.user!.tag} and ready!`);
      9 });
     10 
     11 client.on('guildCreate', g => {
     12   const channel = g.channels.cache.random();
     13   if (!channel) return;
     14 
     15   channel.setName('foo').then(updatedChannel => {
     16     console.log(`New channel name: ${updatedChannel.name}`);
     17   });
     18 });
     19 
     20 client.on('messageReactionRemoveAll', async message => {
     21   console.log(`messageReactionRemoveAll - id: ${message.id} (${message.id.length})`);
     22 
     23   if (message.partial) message = await message.fetch();
     24 
     25   console.log(`messageReactionRemoveAll - content: ${message.content}`);
     26 });
     27 
     28 client.login('absolutely-valid-token');