Skip to content

Commit

Permalink
fix: 🐛 fix bug with guild letters
Browse files Browse the repository at this point in the history
  • Loading branch information
vidhanio committed Jan 31, 2022
1 parent 39e596d commit b24eed5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (wb *WordleBot) handleWordle(s *discordgo.Session, i *discordgo.Interaction
}

func (wb *WordleBot) handleWordleStart(s *discordgo.Session, i *discordgo.InteractionCreate) {
_, ok := wb.getWordleGame(i)
_, ok := wb.wordleGame(i)
if ok {
warningRespond(s, i, "A wordle is already in progress. Use `/cancel` to cancel it.")

Expand Down Expand Up @@ -106,7 +106,7 @@ func (wb *WordleBot) handleWordleStart(s *discordgo.Session, i *discordgo.Intera
}

func (wb *WordleBot) handleWordleGuess(s *discordgo.Session, i *discordgo.InteractionCreate) {
wg, ok := wb.getWordleGame(i)
wg, ok := wb.wordleGame(i)
if !ok {
warningRespond(s, i, "No wordle in progress. Use `/start` to start a new game.")

Expand Down Expand Up @@ -142,7 +142,7 @@ func (wb *WordleBot) handleWordleGuess(s *discordgo.Session, i *discordgo.Intera
}

func (wb *WordleBot) handleWordleCancel(s *discordgo.Session, i *discordgo.InteractionCreate) {
wg, ok := wb.getWordleGame(i)
wg, ok := wb.wordleGame(i)
if !ok {
warningRespond(s, i, "No wordle in progress. Use `/start` to start a new game.")

Expand All @@ -166,7 +166,7 @@ func (wb *WordleBot) handleWordleCancel(s *discordgo.Session, i *discordgo.Inter
}

func (wb *WordleBot) handleWordleShow(s *discordgo.Session, i *discordgo.InteractionCreate) {
wg, ok := wb.getWordleGame(i)
wg, ok := wb.wordleGame(i)
if !ok {
warningRespond(s, i, "No wordle in progress. Use `/start` to start a new game.")

Expand Down Expand Up @@ -194,7 +194,7 @@ func (wb *WordleBot) handleWordleShow(s *discordgo.Session, i *discordgo.Interac
}

func (wb *WordleBot) handleWordleLetters(s *discordgo.Session, i *discordgo.InteractionCreate) {
wg, ok := wb.getWordleGame(i)
wg, ok := wb.wordleGame(i)
if !ok {
warningRespond(s, i, "No wordle in progress. Use `/start` to start a new game.")

Expand Down
12 changes: 6 additions & 6 deletions command_guild.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (wb *WordleBot) handleGuildWordle(s *discordgo.Session, i *discordgo.Intera
}

func (wb *WordleBot) handleGuildWordleStart(s *discordgo.Session, i *discordgo.InteractionCreate) {
_, ok := wb.getGuildWordleGame(i)
_, ok := wb.guildWordleGame(i)
if ok {
warningRespond(s, i, "A guild wordle is already in progress. Use `/guild cancel` to vote to cancel it.")

Expand Down Expand Up @@ -124,7 +124,7 @@ func (wb *WordleBot) handleGuildWordleStart(s *discordgo.Session, i *discordgo.I
}

func (wb *WordleBot) handleGuildWordleGuess(s *discordgo.Session, i *discordgo.InteractionCreate) {
wg, ok := wb.getGuildWordleGame(i)
wg, ok := wb.guildWordleGame(i)
if !ok {
warningRespond(s, i, "No guild wordle in progress. Use `/guild start` to start a new game.")

Expand Down Expand Up @@ -160,7 +160,7 @@ func (wb *WordleBot) handleGuildWordleGuess(s *discordgo.Session, i *discordgo.I
}

func (wb *WordleBot) handleGuildWordleCancel(s *discordgo.Session, i *discordgo.InteractionCreate) {
wg, ok := wb.getGuildWordleGame(i)
wg, ok := wb.guildWordleGame(i)
if !ok {
warningRespond(s, i, "No guild wordle in progress. Use `/guild start` to start a new game.")

Expand Down Expand Up @@ -191,7 +191,7 @@ func (wb *WordleBot) handleGuildWordleCancel(s *discordgo.Session, i *discordgo.
}

func (wb *WordleBot) handleGuildWordleShow(s *discordgo.Session, i *discordgo.InteractionCreate) {
wg, ok := wb.getGuildWordleGame(i)
wg, ok := wb.guildWordleGame(i)
if !ok {
warningRespond(s, i, "No wordle in progress. Use `/guild start` to start a new game.")

Expand Down Expand Up @@ -221,7 +221,7 @@ func (wb *WordleBot) handleGuildWordleShow(s *discordgo.Session, i *discordgo.In
}

func (wb *WordleBot) handleGuildWordleVotes(s *discordgo.Session, i *discordgo.InteractionCreate) {
wg, ok := wb.getGuildWordleGame(i)
wg, ok := wb.guildWordleGame(i)
if !ok {
warningRespond(s, i, "No guild wordle in progress. Use `/guild start` to start a new game.")

Expand All @@ -232,7 +232,7 @@ func (wb *WordleBot) handleGuildWordleVotes(s *discordgo.Session, i *discordgo.I
}

func (wb *WordleBot) handleGuildWordleLetters(s *discordgo.Session, i *discordgo.InteractionCreate) {
wg, ok := wb.getWordleGame(i)
wg, ok := wb.guildWordleGame(i)
if !ok {
warningRespond(s, i, "No wordle in progress. Use `/start` to start a new game.")

Expand Down
4 changes: 2 additions & 2 deletions game.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type wordleGame struct {
emptyEmoji *discordgo.Emoji
}

func (wb *WordleBot) getWordleGame(i *discordgo.InteractionCreate) (*wordleGame, bool) {
func (wb *WordleBot) wordleGame(i *discordgo.InteractionCreate) (*wordleGame, bool) {
g, ok := wb.wordles[i.GuildID]
if !ok {
g = make(map[string]*wordleGame)
Expand All @@ -31,7 +31,7 @@ func (wb *WordleBot) getWordleGame(i *discordgo.InteractionCreate) (*wordleGame,
}

func (wb *WordleBot) newWordleGame(i *discordgo.InteractionCreate, wordLength int) (*wordleGame, error) {
wg, ok := wb.getWordleGame(i)
wg, ok := wb.wordleGame(i)
if ok {
return wg, nil
}
Expand Down
4 changes: 2 additions & 2 deletions game_guild.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ type guildWordleGame struct {
cancelVotes map[string]bool
}

func (wb *WordleBot) getGuildWordleGame(i *discordgo.InteractionCreate) (*guildWordleGame, bool) {
func (wb *WordleBot) guildWordleGame(i *discordgo.InteractionCreate) (*guildWordleGame, bool) {
wg, ok := wb.guildWordles[i.GuildID]

return wg, ok
}

func (wb *WordleBot) newGuildWordleGame(i *discordgo.InteractionCreate, wordLength int) (*guildWordleGame, error) {
wg, ok := wb.getGuildWordleGame(i)
wg, ok := wb.guildWordleGame(i)
if ok {
return wg, nil
}
Expand Down

0 comments on commit b24eed5

Please sign in to comment.