GithubHelp home page GithubHelp logo

moobot's People

Contributors

alexjlp avatar greighuth avatar joefozmans avatar sleepyfoxen avatar zysim avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

moobot's Issues

use better sqlite

for the sake of documentation...

cls_.c.execute('''update harambe
                                set last=?, number=number+1, chain=chain+1
                                where server=?''', [d[0], server_id[0]])

instead of having d[0], and so on, we should not have the line d = (whatever,) as a tuple, but instead pass the second argument to sqlite3.execute as a tuple and (possibly) set up those arguments before...

400 Bad Request Error from fortune cog

not really sure what causes this...
traceback:

Ignoring exception in command fortune
Traceback (most recent call last):
File "/home/joe/moobot/.venv/lib/python3.5/site-packages/discord/ext/commands/
core.py", line 50, in wrapped
ret = yield from coro(*args, **kwargs)
File "/home/joe/moobot/cogs/plugins/fortune.py", line 68, in fortune
await self.bot.say(cowsay)
File "/home/joe/moobot/.venv/lib/python3.5/site-packages/discord/ext/commands/bot.py", line 309, in _augmented_msg
msg = yield from coro
File "/home/joe/moobot/.venv/lib/python3.5/site-packages/discord/client.py", line 1152, in send_message
data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
File "/home/joe/moobot/.venv/lib/python3.5/site-packages/discord/http.py", line 211, in request
raise HTTPException(r, data)
discord.errors.HTTPException: BAD REQUEST (status code: 400)


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/joe/moobot/.venv/lib/python3.5/site-packages/discord/ext/commands/bot.py", line 848, in process_commands
    yield from command.invoke(ctx)
  File "/home/joe/moobot/.venv/lib/python3.5/site-packages/discord/ext/commands/core.py", line 369, in invoke
    yield from injected(*ctx.args, **ctx.kwargs)
  File "/home/joe/moobot/.venv/lib/python3.5/site-packages/discord/ext/commands/core.py", line 54, in wrapped
    raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: BAD REQUEST (status code: 400)
INFO:discord.gateway:Unhandled event CHANNEL_PINS_UPDATE
Ignoring exception in command fortune
Traceback (most recent call last):
  File "/home/joe/moobot/.venv/lib/python3.5/site-packages/discord/ext/commands/core.py", line 50, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "/home/joe/moobot/cogs/plugins/fortune.py", line 68, in fortune
    await self.bot.say(cowsay)
  File "/home/joe/moobot/.venv/lib/python3.5/site-packages/discord/ext/commands/
bot.py", line 309, in _augmented_msg
    msg = yield from coro
  File "/home/joe/moobot/.venv/lib/python3.5/site-packages/discord/client.py", line 1152, in send_message
    data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
  File "/home/joe/moobot/.venv/lib/python3.5/site-packages/discord/http.py", line 211, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: BAD REQUEST (status code: 400)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/joe/moobot/.venv/lib/python3.5/site-packages/discord/ext/commands/bot.py", line 848, in process_commands
    yield from command.invoke(ctx)
  File "/home/joe/moobot/.venv/lib/python3.5/site-packages/discord/ext/commands/core.py", line 369, in invoke
    yield from injected(*ctx.args, **ctx.kwargs)
  File "/home/joe/moobot/.venv/lib/python3.5/site-packages/discord/ext/commands/core.py", line 54, in wrapped
    raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: BAD REQUEST (status code: 400)

move message logic out of moobot.py

it'll massively reduce the shittyness.

the basic idea is to use a dictionary (with the keys being the message to match) and the values being functions which we can import. Or, we can import the whole dictionary. I'm ambivalent.

def f(message):
    '''handle respect incrementation'''
    pass

def respect(message):
    '''handle telling people their respect'''
    pass

def harambe(message)
    '''handle harambe'''
    pass

def skip(message):
    '''no action'''
    return

commands = {
            'f': f,
            'x': f,
            'respect': respect,
            'harambe': harambe,
           }

### in moobot.py
# ...
def on_message(message):
    commands.get(message.content, skip)(message)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.