57 lines
1.7 KiB
Python
Executable File
57 lines
1.7 KiB
Python
Executable File
from discord import option
|
|
from discord.ext import commands
|
|
import core_utils
|
|
import discord
|
|
|
|
|
|
class Games(commands.Cog):
|
|
def __init__(self, bot):
|
|
self.bot: commands.Bot = bot
|
|
|
|
# @commands.slash_command(
|
|
# guild_ids=None,
|
|
# name="bf5",
|
|
# description="Query the game's API for data about a player",
|
|
# )
|
|
# async def bf5(self, ctx: commands.Context, player):
|
|
# import bf5
|
|
|
|
# try:
|
|
# await ctx.defer()
|
|
# embed = bf5.get_player(player)
|
|
# await ctx.send_followup(embed=embed)
|
|
# except Exception as e:
|
|
# await ctx.send(
|
|
# "I encountered an error while searching for that player.\nPlease check that your player name is spelled correctly"
|
|
# )
|
|
|
|
@commands.slash_command(
|
|
guild_ids=None,
|
|
name="ffxiv",
|
|
description="Query the game's API for data about a player",
|
|
)
|
|
@option(
|
|
"player_name", description="Your player's first and last name", required=True
|
|
)
|
|
@option(
|
|
"server",
|
|
description="Your player's data center",
|
|
required=True,
|
|
input_type="str",
|
|
)
|
|
async def ffxiv(self, ctx: commands.Context, player_name: str, server: str):
|
|
import ffxiv
|
|
|
|
try:
|
|
embed = ffxiv.make_request(name=player_name.lower(), server=server.lower())
|
|
await ctx.defer()
|
|
await ctx.send_followup(embed=embed)
|
|
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))
|