owengombas / discord.ts

🤖 Create your discord bot by using TypeScript and decorators!

Home Page:https://owencalvin.github.io/discord.ts/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

guildMemberAdd and guildMemberRemove events seem to not work somehow

j-mizera opened this issue · comments

On message event works properly but i tested both add and remove events and they seem to not trigger.

import {ArgsOf, Discord, On, Command, CommandMessage, Client} from '@typeit/discord';
import * as Events from './events';
import {prefix, welcomeChannelID, guestRoleID} from './data';

@Discord(prefix)
export abstract class DiscordBot{
    @Command("ping")
    ping(command: CommandMessage): void {
        command.reply("pong!");
    }
    @On('guildMemberAdd')
    private async onGulidMemberAdd([member]: ArgsOf<"guildMemberAdd">){
        member.roles.add(member.guild.roles.cache.get(guestRoleID));
        const welcomeChannel = member.guild.channels.cache.get(welcomeChannelID);
        if(welcomeChannel.isText()) welcomeChannel.send(`Witaj na  serwerze discord Partii Technokratycznej ${member.user.username}!`);
    }
    @On("message")
    onMessage(
    [message]: ArgsOf<"message">,
    client: Client
  ) {
    console.log(message.content);
  }
}

Nevermind, this issue solve can be done by enabling Privileged Gateway Intents in your bot on Discord Developer Portal. Discord changed it like month or 2 ago.