Implement known dbrand commands, closes #15

This commit is contained in:
Zeva Rose 2021-06-30 20:34:51 -06:00
parent c1ecc83953
commit dcf020860e

View file

@ -7,6 +7,7 @@ from jarvis.utils.field import Field
from jarvis.data.dbrand import shipping_lookup from jarvis.data.dbrand import shipping_lookup
from discord.ext import commands from discord.ext import commands
from discord_slash import cog_ext from discord_slash import cog_ext
from discord_slash.utils.manage_commands import create_option
class DbrandCog(commands.Cog): class DbrandCog(commands.Cog):
@ -24,44 +25,62 @@ class DbrandCog(commands.Cog):
self.api_url = get_config().urls["dbrand_shipping"] self.api_url = get_config().urls["dbrand_shipping"]
self.cache = {} self.cache = {}
# @cog_ext.cog_slash(name="db", aliases=["dbrand"], pass_context=True)
# async def _db(self, ctx):
# if ctx.invoked_subcommand is None:
# await ctx.send(
# "Available subcommands: `grip`, `support`, "
# + "`skin`, `prism`, `shipping`, `camo`"
# )
@cog_ext.cog_subcommand( @cog_ext.cog_subcommand(
base="db", name="skin", guild_ids=[578757004059738142] base="db", name="skin", guild_ids=[578757004059738142]
) )
async def _skin(self, ctx): async def _skin(self, ctx):
await ctx.send(self.base_url + "shop/skins") await ctx.send(self.base_url + "shop/skins")
# @_db.command(name="robotcamo", aliases=["rc", "robot", "camo"])
@cog_ext.cog_subcommand( @cog_ext.cog_subcommand(
base="db", name="robotcamo", guild_ids=[578757004059738142] base="db", name="robotcamo", guild_ids=[578757004059738142]
) )
async def _camo(self, ctx): async def _camo(self, ctx):
await ctx.send(self.base_url + "shop/special-edition/robot-camo") await ctx.send(self.base_url + "shop/special-edition/robot-camo")
# @_db.command(name="grip", aliases=["g", "case"])
@cog_ext.cog_subcommand( @cog_ext.cog_subcommand(
base="db", name="grip", guild_ids=[578757004059738142] base="db", name="grip", guild_ids=[578757004059738142]
) )
async def _grip(self, ctx): async def _grip(self, ctx):
await ctx.send(self.base_url + "shop/grip/#grip-devices") await ctx.send(self.base_url + "shop/grip/#grip-devices")
# @_db.command(name="support", aliases=["help", "contact"])
@cog_ext.cog_subcommand( @cog_ext.cog_subcommand(
base="db", name="contact", guild_ids=[578757004059738142] base="db", name="contact", guild_ids=[578757004059738142]
) )
async def _contact(self, ctx):
await ctx.send(self.base_url + "contact")
@cog_ext.cog_subcommand(
base="db", name="support", guild_ids=[578757004059738142]
)
async def _support(self, ctx): async def _support(self, ctx):
await ctx.send(self.base_url + "contact") await ctx.send(self.base_url + "contact")
# @_db.command(name="shipping", aliases=["ship", "s"])
@cog_ext.cog_subcommand( @cog_ext.cog_subcommand(
base="db", name="ship", guild_ids=[578757004059738142] base="db", name="orderstat", guild_ids=[578757004059738142]
)
async def _orderstat(self, ctx):
await ctx.send(self.base_url + "order-status")
@cog_ext.cog_subcommand(
base="db", name="orders", guild_ids=[578757004059738142]
)
async def _orders(self, ctx):
await ctx.send(self.base_url + "order-status")
@cog_ext.cog_subcommand(
base="db",
name="ship",
guild_ids=[578757004059738142],
options=[
(
create_option(
name="search",
description="Country search query (2 character code, country name, emoji)",
option_type=3,
required=True,
)
)
],
) )
async def _shipping(self, ctx, *, search: str): async def _shipping(self, ctx, *, search: str):
await ctx.defer() await ctx.defer()