Esempio n. 1
0
async def on_message_edit(pre, post):

    event = Map({})
    event.old = pre
    event.new = post
    event.message = post
    event.user = pre.author
    event.server = pre.server

    await loader.execute(command=None,
                         cmdtype="Edit",
                         event=event,
                         client=client)

    if not post.content.startswith(settings.PREFIX):
        return

    event.args = post.content[len(settings.PREFIX):].split(" ")
    command = post.content.split(" ")[0][len(settings.PREFIX):]
    # Execute any specific commands
    await loader.execute(command=command,
                         cmdtype="Command",
                         event=event,
                         client=client)
Esempio n. 2
0
async def on_message(message):

    event = Map({})
    event.message = message
    event.server = message.server
    event.user = message.author

    # Execute all of the on_message commands first
    await loader.execute(command=None,
                         cmdtype="Message",
                         event=event,
                         client=client)

    # Checks if it actually is a command
    if not message.content.startswith(settings.PREFIX):
        return

    event.args = message.content[len(settings.PREFIX):].split(" ")
    command = message.content.split(" ")[0][len(settings.PREFIX):]
    # Execute any specific commands
    await loader.execute(command=command,
                         cmdtype="Command",
                         event=event,
                         client=client)