Clean up and remove extra ordinal guff
This commit is contained in:
parent
9f5cc9bb49
commit
b98fa7469a
2 changed files with 6 additions and 22 deletions
|
@ -4,7 +4,6 @@ import logging
|
|||
import importlib
|
||||
from discord import app_commands
|
||||
from discord.ext import commands
|
||||
import util
|
||||
# Config contains
|
||||
# TOKEN : str - Discord bot token
|
||||
# SERVERS : list[int] - ids of the servers to have commands active
|
||||
|
@ -92,9 +91,9 @@ async def match(interaction: discord.Interaction, per_group: int = None, post: b
|
|||
groups = [matchees[i::num_groups] for i in range(num_groups)]
|
||||
group_msgs = []
|
||||
for idx, group in enumerate(groups):
|
||||
mentions = [m.mention for m in group]
|
||||
mentions = ", ".join([m.mention for m in group])
|
||||
logger.info(f"Sending group: {list(m.name for m in group)}")
|
||||
group_msgs.append(f"{util.get_ordinal(idx+1)} group: " + ", ".join(mentions))
|
||||
group_msgs.append(f"Matched up {mentions}!")
|
||||
|
||||
# Send the messages
|
||||
if post:
|
||||
|
|
15
util.py
15
util.py
|
@ -1,15 +0,0 @@
|
|||
# Get the ordinal for an int
|
||||
def get_ordinal(num : int):
|
||||
if num > 9:
|
||||
secondToLastDigit = str(num)[-2]
|
||||
if secondToLastDigit == '1':
|
||||
return str(num)+'th'
|
||||
lastDigit = num % 10
|
||||
if (lastDigit == 1):
|
||||
return str(num)+'st'
|
||||
elif (lastDigit == 2):
|
||||
return str(num)+'nd'
|
||||
elif (lastDigit == 3):
|
||||
return str(num)+'rd'
|
||||
else:
|
||||
return str(num)+'th'
|
Loading…
Add table
Add a link
Reference in a new issue