Exemple #1
0
async def on_message_delete(message):

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

    await loader.execute(command=None,
                         cmdtype="Delete",
                         event=event,
                         client=client)
Exemple #2
0
async def on_reaction_remove(reaction, user):

    event = Map({})
    event.reaction = reaction
    event.user = user
    event.server = user.server

    await loader.execute(command=None,
                         cmdtype="ReactRemove",
                         event=event,
                         client=client)
Exemple #3
0
async def on_typing(channel, user, when):
    event = Map({})
    event.channel = channel
    event.user = user
    event.when = when
    event.arrow = arrow.get(str(when), "YYYY-MM-DD HH:mm:ss")
    event.timestamp = event.arrow.timestamp

    await loader.execute(command=None,
                         cmdtype="Typing",
                         event=event,
                         client=client)
Exemple #4
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)
Exemple #5
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)