Added jisho api interface
This commit is contained in:
parent
3567edfc17
commit
7c0e643ecc
2 changed files with 23 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
import discord
|
||||
from discord.ext import commands
|
||||
from utils import jisho
|
||||
|
||||
class Search(commands.Cog):
|
||||
def __init__(self, bot: commands.Bot):
|
||||
|
@ -11,7 +12,14 @@ class Search(commands.Cog):
|
|||
if query == None:
|
||||
return
|
||||
|
||||
await ctx.send(query)
|
||||
response = jisho.query(query)
|
||||
await ctx.send(response["data"][0]["slug"])
|
||||
|
||||
@search.error
|
||||
async def search_error(self, ctx, error):
|
||||
if isinstance(error, commands.CommandOnCooldown):
|
||||
pass # Suppress that annoying exception everytime someone is on cooldown
|
||||
|
||||
|
||||
|
||||
def setup(bot: commands.Bot):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue