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 (
"fmt"
@ -8,7 +8,7 @@ import (
"time"
)
func JoinListener(event *events.GuildMemberJoin) {
func JoinEvent(event *events.GuildMemberJoin) {
// on join send message in welcome
user := event.Member.User
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
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 {
// reaction is not in welcome chat

View file

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