def games(self, ctx):
"""Manages games for the roster."""
# Handle Database
try:
with db.cursor() as cursor:
sql = "SELECT `abv`, `name` FROM games ORDER BY `name`"
cursor.execute(sql)
result = cursor.fetchall()
cursor.close()
except Exception as e:
await self.bot.send_message(ctx.message.channel, "{0.mention}, there was an error getting the list of games"
" for you. I'm sorry! ".format(ctx.message.author) + str(
e))
return
# Create Variables for Embed Table
abvs = ''
names = ''
for row in result:
abvs += (row['abv'] + '\n')
names += (row['name'] + '\n')
# Create Embed Table
embed = discord.Embed(title="Games List", colour=discord.Colour(0x55ff),
description="*The list of available games for the roster commands, as well as their "
"abbreviations for use in those commands.*")
embed.set_author(name="Zealot Gaming", url="https://www.zealotgaming.com",
icon_url="http://www.zealotgaming.com/discord/logos/zg.png")
embed.set_thumbnail(url="http://www.zealotgaming.com/discord/logos/zg.png")
embed.add_field(name="Abbreviation", value=abvs, inline=True)
embed.add_field(name="Game Name", value=names, inline=True)
# Send Table to User Privately
await self.bot.send_message(ctx.message.channel, embed=embed)
# COMMAND: !games add
评论列表
文章目录