mirror of
https://github.com/polyjitter/searchbot-discord.git
synced 2024-08-14 22:46:55 +00:00
Fix botlist
This commit is contained in:
parent
61c2f6aecd
commit
664e1361c5
4 changed files with 25 additions and 10 deletions
1
.python-version
Normal file
1
.python-version
Normal file
|
@ -0,0 +1 @@
|
|||
pypy3.6-7.3.0
|
|
@ -57,8 +57,7 @@ class BotList(commands.Cog, name='Bot List'):
|
|||
async with self.request.post(dbots_call,
|
||||
json=dbots_data,
|
||||
headers=dbots_headers) as resp:
|
||||
resp_json = await resp.json()
|
||||
responses['dbots'] = resp_json
|
||||
responses['dbots'] = resp.status
|
||||
|
||||
# bots.ondiscord.xyz
|
||||
if self.bod_token != '':
|
||||
|
|
|
@ -22,22 +22,26 @@ class Logging():
|
|||
|
||||
# Sets info hook first
|
||||
self.info_hook = self.online.get_webhook(
|
||||
bot.config['HOOKS']['INFO_HOOK'] if bot.config['HOOKS']['INFO_HOOK']
|
||||
bot.config['HOOKS']['INFO_HOOK']
|
||||
if bot.config['HOOKS']['INFO_HOOK']
|
||||
else None
|
||||
)
|
||||
|
||||
# Sets other hooks or defaults them
|
||||
if self.info_hook:
|
||||
self.warn_hook = self.online.get_webhook(
|
||||
bot.config['HOOKS']['WARN_HOOK'] if bot.config['HOOKS']['WARN_HOOK']
|
||||
bot.config['HOOKS']['WARN_HOOK']
|
||||
if bot.config['HOOKS']['WARN_HOOK']
|
||||
else self.info_hook
|
||||
)
|
||||
self.error_hook = self.online.get_webhook(
|
||||
bot.config['HOOKS']['ERROR_HOOK'] if bot.config['HOOKS']['ERROR_HOOK']
|
||||
bot.config['HOOKS']['ERROR_HOOK']
|
||||
if bot.config['HOOKS']['ERROR_HOOK']
|
||||
else self.info_hook
|
||||
)
|
||||
self.debug_hook = self.online.get_webhook(
|
||||
bot.config['HOOKS']['DEBUG_HOOK'] if bot.config['HOOKS']['DEBUG_HOOK']
|
||||
bot.config['HOOKS']['DEBUG_HOOK']
|
||||
if bot.config['HOOKS']['DEBUG_HOOK']
|
||||
else self.info_hook
|
||||
)
|
||||
|
||||
|
@ -102,7 +106,9 @@ class Logging():
|
|||
if self.info_hook:
|
||||
return await self.info_hook.send(
|
||||
content=content,
|
||||
username=f"{self.bot.user.name} - {name if name else 'unknown'}",
|
||||
username=(
|
||||
f"{self.bot.user.name} - {name if name else 'unknown'}"
|
||||
),
|
||||
avatar_url=str(self.bot.user.avatar_url),
|
||||
embed=embed
|
||||
)
|
||||
|
|
15
main.py
15
main.py
|
@ -218,7 +218,10 @@ class Bot(commands.Bot):
|
|||
return
|
||||
|
||||
# Maintenance mode
|
||||
elif self.maintenance and not message.author.id == bot.appinfo.owner.id:
|
||||
elif (
|
||||
self.maintenance
|
||||
and not message.author.id == bot.appinfo.owner.id
|
||||
):
|
||||
return
|
||||
|
||||
# Empty ping for assistance
|
||||
|
@ -245,14 +248,20 @@ async def on_command_error(ctx, error):
|
|||
|
||||
# Lets other cogs handle CommandNotFound.
|
||||
# Change this if you want command not found handling
|
||||
if isinstance(error, commands.CommandNotFound)or isinstance(error, commands.CheckFailure):
|
||||
if (
|
||||
isinstance(error, commands.CommandNotFound)
|
||||
or isinstance(error, commands.CheckFailure)
|
||||
):
|
||||
return
|
||||
|
||||
# Provides a very pretty embed if something's actually a dev's fault.
|
||||
elif isinstance(error, commands.CommandInvokeError):
|
||||
|
||||
# Prerequisites
|
||||
embed_fallback = f"**An error occured: {type(error).__name__}. Please contact {bot.appinfo.owner}.**"
|
||||
embed_fallback = (
|
||||
f"**An error occured: {type(error).__name__}. "
|
||||
f"Please contact {bot.appinfo.owner}.**"
|
||||
)
|
||||
error_embed = await bot.logging.error(
|
||||
error, ctx,
|
||||
ctx.command.cog.qualified_name if ctx.command.cog.qualified_name
|
||||
|
|
Loading…
Reference in a new issue