Explorar el Código

Just some small changes. Fucking error checks are annoying for NSFW. Since you can't error handle commands. So someone inputting shitty commands raises and error you can't catch. Ffs

tags/v1.0.0
roxie hace 6 años
padre
commit
c0e87f2d18
Se han modificado 3 ficheros con 10 adiciones y 5 borrados
  1. +1
    -0
      cogs/nsfw.py
  2. +2
    -1
      config/meta.py
  3. +7
    -4
      main.py

+ 1
- 0
cogs/nsfw.py Ver fichero

@@ -1,4 +1,5 @@
import random
from json import JSONDecodeError
import checks
import requests
from discord.ext.commands import bot

+ 2
- 1
config/meta.py Ver fichero

@@ -1,6 +1,7 @@
__description__ = """RoxBot, A Discord Bot made by a filthy Mercy Main. Built with love (and discord.py) by Roxxers#7443.

[Github link](https://github.com/RainbowDinoaur/roxbot)"""
[Github link](https://github.com/RainbowDinoaur/roxbot)
[Changelog](https://github.com/RainbowDinoaur/roxbot#v100)"""
__author__ = "Roxanne Gibson"
__version__= "1.0"
embedcolour = 0xDEADBF

+ 7
- 4
main.py Ver fichero

@@ -4,6 +4,7 @@ import logging
import os.path
import datetime
import traceback
import json

import discord
from discord.ext import commands
@@ -23,7 +24,7 @@ logger.addHandler(handler)

server_config = ServerConfig()
bot = commands.Bot(command_prefix=load_config.command_prefix, description=load_config.description)
bot.dev = True # For debugging
bot.dev = False # For debugging
bot.owner = load_config.owner

def blacklisted(user):
@@ -102,6 +103,8 @@ async def on_command_error(error, ctx):
await bot.send_message(ctx.message.channel, content="This command is disabled.")
elif isinstance(error, commands.CheckFailure):
await bot.send_message(ctx.message.channel, content="You do not have permission to do this. Back off, thot!")
elif isinstance(error, json.JSONDecodeError): # For the NSFW cogs requests because error exception doesn't work in commands because of this here.
await bot.send_message(ctx.message.channel, content="That didn't return anything")
elif isinstance(error, commands.CommandInvokeError):
if bot.dev:
raise error
@@ -117,9 +120,9 @@ async def on_command_error(error, ctx):
await bot.send_message(load_config.owner, embed=embed)
except:
raise error
else:
if bot.dev:
raise error
#else:
# if bot.dev:
# raise error

@bot.command(pass_context=True)
async def about(ctx):

Cargando…
Cancelar
Guardar