Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fun messages on race conclusion (Issue #118) #208

Merged
merged 3 commits into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 60 additions & 4 deletions uqcsbot/utils/snailrace_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import discord, random, datetime, asyncio
import discord
import random
import datetime
import asyncio

# Racer Icon
SNAILRACE_SNAIL_EMOJI = "🐌"
Expand Down Expand Up @@ -35,6 +38,45 @@
SNAILRACE_WINNER = "The race has finished! %s has won!"
SNAILRACE_WINNER_TIE = "The race has finished! It's a tie between %s!"

SNAILRACE_WIN_MESSAGES = [
"🎉🎉",
"🎉🎉🎉",
"🍾🥂",
"🥳🥳",
"🥳🥳🥳",
"🥳🎉",
"🥳🎉🎉",
"Congrats! 🥳",
"Congratulations!",
"ggs!",
"For every winner, there is a loser.",
]
SNAILRACE_TIE_MESSAGES = [
"MILLION TO ONE!",
"Everyone's a winner!",
"Nobody wins!",
"Friendship wins!",
"Time for a rematch?",
"That was just a warm-up!",
]
SNAILRACE_NO_CONTEST_MESSAGES = [
"But it was against themselves, that was a little sad.",
"Suspicious there were no other snails though.",
"But wait, it was a false start.",
"At losing!",
"And also lost!",
"Wait was that it?",
"But wait, they used illegal snail doping.",
"But wait, the ref says they're disqualified.",
"You call that a race?",
"I think we could all see that happening.",
"Who could've guessed.",
"Uhh congrats?",
"Well done, I guess...",
"Wait no they didn't.",
"But wait, that was just a warm-up.",
]

SnailRaceJoinType = 0 | 1 | 2
SnailRaceJoinAdded = 0
SnailRaceJoinAlreadyJoined = 1
Expand Down Expand Up @@ -162,9 +204,23 @@ async def _start_racing(self, interaction: discord.Interaction):
)

# Conclude the race and send the winner
if len(winners) == 1:
await interaction.channel.send(SNAILRACE_WINNER % winners[0])
if len(self.racers) == 1:
await interaction.channel.send(
SNAILRACE_WINNER % winners[0]
+ " "
+ random.choice(SNAILRACE_NO_CONTEST_MESSAGES)
)
elif len(winners) == 1:
await interaction.channel.send(
SNAILRACE_WINNER % winners[0]
+ " "
+ random.choice(SNAILRACE_WIN_MESSAGES)
)
else:
await interaction.channel.send(SNAILRACE_WINNER_TIE % ", ".join(winners))
await interaction.channel.send(
SNAILRACE_WINNER_TIE % ", ".join(winners)
+ " "
+ random.choice(SNAILRACE_TIE_MESSAGES)
)

self.close_race()