rename listener to event

This commit is contained in:
Seraphim Strub 2023-03-08 21:38:17 +01:00
parent 11db25516b
commit 8a4c903c08
2 changed files with 8 additions and 8 deletions

View file

@ -1,4 +1,4 @@
package listener package event
import ( import (
"fmt" "fmt"
@ -8,7 +8,7 @@ import (
"time" "time"
) )
func JoinListener(event *events.GuildMemberJoin) { func JoinEvent(event *events.GuildMemberJoin) {
// on join send message in welcome // on join send message in welcome
user := event.Member.User user := event.Member.User
if event.GuildID.String() != config.RegisterGuildID.String() { if event.GuildID.String() != config.RegisterGuildID.String() {
@ -43,7 +43,7 @@ func JoinListener(event *events.GuildMemberJoin) {
} }
} }
func LeaveListener(event *events.GuildMemberLeave) { func LeaveEvent(event *events.GuildMemberLeave) {
user := event.User user := event.User
if event.GuildID.String() != config.RegisterGuildID.String() { if event.GuildID.String() != config.RegisterGuildID.String() {
@ -68,7 +68,7 @@ func LeaveListener(event *events.GuildMemberLeave) {
} }
} }
func ReactionListener(event *events.ComponentInteractionCreate) { func ReactionEvent(event *events.ComponentInteractionCreate) {
if event.ChannelID() != config.ChannelWelcomeID { if event.ChannelID() != config.ChannelWelcomeID {
// reaction is not in welcome chat // reaction is not in welcome chat

View file

@ -8,7 +8,7 @@ import (
"github.com/disgoorg/disgo/gateway" "github.com/disgoorg/disgo/gateway"
"github.com/disgoorg/log" "github.com/disgoorg/log"
"grow.rievo.dev/discordBots/cmd/welcomebot/config" "grow.rievo.dev/discordBots/cmd/welcomebot/config"
"grow.rievo.dev/discordBots/cmd/welcomebot/listener" "grow.rievo.dev/discordBots/cmd/welcomebot/event"
"os" "os"
"os/signal" "os/signal"
"syscall" "syscall"
@ -30,9 +30,9 @@ func main() {
cache.FlagsNone, cache.FlagsNone,
), ),
), ),
bot.WithEventListenerFunc(listener.JoinListener), bot.WithEventListenerFunc(event.JoinEvent),
bot.WithEventListenerFunc(listener.LeaveListener), bot.WithEventListenerFunc(event.LeaveEvent),
bot.WithEventListenerFunc(listener.ReactionListener), bot.WithEventListenerFunc(event.ReactionEvent),
) )
if err != nil { if err != nil {
log.Fatal("error while building disgo instance: ", err) log.Fatal("error while building disgo instance: ", err)