cronokirby/alchemy

How can I use Events?

Closed this issue · 2 comments

I'm trying to use the Events module, so I can send messages to users when they join my guild.... server, and also I wan't to send messages when they receive a specific role.

I saw the docs about on_member_update and on_guild_update but I'm really confused how it works. In summary, I tried to inspect the args those fun receive, but when I changed my data on the server nothing poped in my console (I built the basics for my bot and put it in a discord server to test). The Cogs command is working fine.

The examples in the docs for Alchemy.Events should show all the information you need:

https://hexdocs.pm/discord_alchemy/Alchemy.Events.html#content

The idea is to create a module with the event handlers you want.

Those event handlers will be functions.

Then you use Events.on_...(:function_name) to register a callback

Then you need to do use MyModule after starting the client to register the callbacks

I got the problem. I was trying to use Cogs and Events in the same module, but this overrides Events.