dragon-bot/app/cogs/game_apis.py
2022-05-02 20:15:23 -07:00

37 lines
1.1 KiB
Python

from discord.ext import commands
import core_utils
import discord
class Games(commands.Cog):
def __init__(self, bot):
self.bot: commands.Bot = bot
@commands.command(name="bf5")
async def bf5(self, ctx: commands.Context):
import bf5
try:
await ctx.send(embed=bf5.get_player(ctx.message.content.split()[1]))
except Exception:
await ctx.send(
"I encountered an error while searching for that player.\nPlease check that your player name is spelled correctly"
)
@commands.command(name="ffxiv")
async def ffxiv(self, ctx: commands.Context, first_name, last_name, server):
import ffxiv
async with ctx.message.channel.typing():
try:
name = "%s %s" % (first_name, last_name)
await ctx.send(embed=ffxiv.make_request(name=name, server=server))
except Exception:
await ctx.send(
"I encountered an error while searching for that player.\nPlease check that your player name and server are spelled correctly"
)
def setup(bot):
bot.add_cog(Games(bot))