description for only servers

This commit is contained in:
officereso 2021-01-24 17:47:19 -06:00
parent 7f2b0668a6
commit 58c05ae6a1

View File

@ -68,7 +68,7 @@ def get_choices() -> dict:
con = get_con()
choices = {}
with con.cursor() as cursor:
cursor.execute("SELECT serverIP, serverName, lastActivated, reaction, getEmoji "
cursor.execute("SELECT serverIP, serverName, lastActivated, reaction, getEmoji, onlyServer "
"FROM mc.server_list WHERE lastActivated is not null")
row = cursor.fetchone()
while row is not None:
@ -149,14 +149,16 @@ class McRoll(commands.Cog):
async def poll(self, choices: dict, channel: int) -> discord.Message:
channel = await self.client.fetch_channel(channel)
embed = discord.Embed(title="Poll", description=self.embedInfo, timestamp=(datetime.utcnow() + timedelta(days=1)))
embed = discord.Embed(title="Poll", description=self.embedInfo,
timestamp=(datetime.utcnow() + timedelta(days=1)))
for choice in choices.values():
embed.add_field(
name=choice['serverName'] + ' ' + str(self.client.get_emoji(int(choice['reaction'])))
if choice['getEmoji']
else bytes(choice['reaction'], "utf-8").decode("unicode_escape"),
value="Multiplier : " + str(round(2 * math.log10(choice['lastActivated'] + 1) + 1, 2)) + '\n' +
"Last Rolled : " + str(choice['lastActivated'] * 2) + " weeks ago.")
value=("Multiplier : " + str(round(2 * math.log10(choice['lastActivated'] + 1) + 1, 2)) + '\n' +
"Last Rolled : " + str(choice['lastActivated'] * 2) + " weeks ago.") +
"\nThis is an only server, meaning if it wins it will be the only winner" if choice['onlyServer'] else "")
pollMessage = await channel.send(embed=embed)
await channel.send('@everyone')
@ -176,7 +178,8 @@ class McRoll(commands.Cog):
value="Multiplier : " + str(round(2 * math.log10(winner['lastActivated'] + 1) + 1, 2)) + '\n' +
"Last Rolled : " + str(winner['lastActivated'] * 2) + " weeks ago." + '\n' +
"Votes : " + str(winner['votes']) + '\n' +
"Calculated Votes: " + str(winner['votes'] * round(2 * math.log10(winner['lastActivated'] + 1) + 1, 2))
"Calculated Votes: " + str(
winner['votes'] * round(2 * math.log10(winner['lastActivated'] + 1) + 1, 2))
)
channel = await self.client.fetch_channel(channelId)
await channel.send(embed=embed)