Prevent fatal crashes from DM commands

This commit is contained in:
2024-01-29 03:17:39 -06:00
parent f3c79b3576
commit a3c0d43fc5
2 changed files with 9 additions and 1 deletions

View File

@@ -338,3 +338,11 @@ func NewCalendar() *ics.Calendar {
c.SetProductId("-//xevion//Banner Discord Bot//EN")
return c
}
func GetUsername(interaction *discordgo.InteractionCreate) string {
if interaction.Member != nil {
return interaction.Member.User.Username
}
return interaction.User.Username
}