Fix botlist
This commit is contained in:
parent
61c2f6aecd
commit
664e1361c5
|
@ -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,
|
async with self.request.post(dbots_call,
|
||||||
json=dbots_data,
|
json=dbots_data,
|
||||||
headers=dbots_headers) as resp:
|
headers=dbots_headers) as resp:
|
||||||
resp_json = await resp.json()
|
responses['dbots'] = resp.status
|
||||||
responses['dbots'] = resp_json
|
|
||||||
|
|
||||||
# bots.ondiscord.xyz
|
# bots.ondiscord.xyz
|
||||||
if self.bod_token != '':
|
if self.bod_token != '':
|
||||||
|
|
|
@ -22,22 +22,26 @@ class Logging():
|
||||||
|
|
||||||
# Sets info hook first
|
# Sets info hook first
|
||||||
self.info_hook = self.online.get_webhook(
|
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
|
else None
|
||||||
)
|
)
|
||||||
|
|
||||||
# Sets other hooks or defaults them
|
# Sets other hooks or defaults them
|
||||||
if self.info_hook:
|
if self.info_hook:
|
||||||
self.warn_hook = self.online.get_webhook(
|
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
|
else self.info_hook
|
||||||
)
|
)
|
||||||
self.error_hook = self.online.get_webhook(
|
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
|
else self.info_hook
|
||||||
)
|
)
|
||||||
self.debug_hook = self.online.get_webhook(
|
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
|
else self.info_hook
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -102,7 +106,9 @@ class Logging():
|
||||||
if self.info_hook:
|
if self.info_hook:
|
||||||
return await self.info_hook.send(
|
return await self.info_hook.send(
|
||||||
content=content,
|
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),
|
avatar_url=str(self.bot.user.avatar_url),
|
||||||
embed=embed
|
embed=embed
|
||||||
)
|
)
|
||||||
|
|
15
main.py
15
main.py
|
@ -218,7 +218,10 @@ class Bot(commands.Bot):
|
||||||
return
|
return
|
||||||
|
|
||||||
# Maintenance mode
|
# 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
|
return
|
||||||
|
|
||||||
# Empty ping for assistance
|
# Empty ping for assistance
|
||||||
|
@ -245,14 +248,20 @@ async def on_command_error(ctx, error):
|
||||||
|
|
||||||
# Lets other cogs handle CommandNotFound.
|
# Lets other cogs handle CommandNotFound.
|
||||||
# Change this if you want command not found handling
|
# 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
|
return
|
||||||
|
|
||||||
# Provides a very pretty embed if something's actually a dev's fault.
|
# Provides a very pretty embed if something's actually a dev's fault.
|
||||||
elif isinstance(error, commands.CommandInvokeError):
|
elif isinstance(error, commands.CommandInvokeError):
|
||||||
|
|
||||||
# Prerequisites
|
# 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_embed = await bot.logging.error(
|
||||||
error, ctx,
|
error, ctx,
|
||||||
ctx.command.cog.qualified_name if ctx.command.cog.qualified_name
|
ctx.command.cog.qualified_name if ctx.command.cog.qualified_name
|
||||||
|
|
Loading…
Reference in New Issue