コード例 #1
0
ファイル: MESSAGE.py プロジェクト: harry48225/BWBellairsBot
def on_pubmsg(irc, conn, event):
    nick = event.source.nick
    channel = event.target
    msg = event.arguments[0]
    irc.state["users"][nick]["lastmsg"]["time"] = time.time()
    irc.state["users"][nick]["lastmsg"]["channel"] = channel
    irc.state["users"][nick]["lastmsg"]["message"] = msg
    irc.state["users"][nick]["lastmsg"]["command"] = event.type
    if utils.is_command(irc, conn, event):
        utils.handle_command(irc, conn, event)
コード例 #2
0
ファイル: MESSAGE.py プロジェクト: devzero-xyz/Andromeda
def on_pubnotice(irc, conn, event):
    nick = event.source.nick
    channel = event.target
    msg = event.arguments[0]
    try:
        irc.state["users"][nick]["lastmsg"]["time"] = time.time()
        irc.state["users"][nick]["lastmsg"]["channel"] = channel
        irc.state["users"][nick]["lastmsg"]["message"] = msg
        irc.state["users"][nick]["lastmsg"]["command"] = event.type
    except KeyError:
        pass
    if utils.is_command(irc, conn, event):
        utils.handle_command(irc, conn, event)
コード例 #3
0
ファイル: MESSAGE.py プロジェクト: devzero-xyz/Andromeda
def on_privnotice(irc, conn, event):
    if event.source.nick == "NickServ" and not irc.identified:
        if irc.nickserv and not irc.sasl:
            if "You are now identified" in event.arguments[0]:
                irc.identified = True
                for channel in irc.channels:
                    if irc.channels[channel].get("autojoin", irc.autojoin):
                        if irc.channels[channel].get("key"):
                            irc.join(channel, irc.channels[channel]["key"])
                        else:
                            irc.join(channel)
    elif event.source.nick == "ChanServ" and utils.denied:
        channel = None
        if "not authorized" in event.arguments[0]:
            channel = event.arguments[0].split("\x02")[3]
        elif "is not registered" in event.arguments[0]:
            channel = event.arguments[0].split("\x02")[1]
        elif "is not on" in event.arguments[0]:
            channel = event.arguments[0].split("\x02")[3]
        if channel:
            utils.denied.put_nowait(channel)
    elif utils.is_command(irc, conn, event):
        utils.handle_command(irc, conn, event)
コード例 #4
0
ファイル: mm-randbot.py プロジェクト: arvego/mm-randbot
    if getattr(message, 'reply_to_message') is None:
        return
    my_bot.reply_to(message, '`{}`'.format(str(message.reply_to_message.from_user.id)), parse_mode="Markdown")


@my_bot.message_handler(func=commands_handler(['/getlog', '/log']))
@bot_admin_command
def get_log(message):
    user_action_log(message, "requested bot logs")
    with open(config.file_location['bot_logs'], 'r', encoding='utf-8') as file:
        lines = file.readlines()[-100:]
        for text in cut_long_text(''.join(lines), max_len=3500):
            my_bot.reply_to(message, "{}".format(text))


@my_bot.message_handler(func=is_command())
@bot_admin_command
def admin_toys(message):
    parts = message.text.split()
    if len(parts) < 1:
        return
    command = parts[0].lower()
    if command == "/prize":
        admin_tools.admin_prize(message)
        return

    if len(parts) < 2 or parts[1] != my_bot_name:
        return
    if command == "/update":
        admin_tools.update_bot(message)
    elif command == "/kill":
コード例 #5
0
    user_action_log(message, "disabled kek")


@my_bot.message_handler(func=commands_handler(['/post']))
@chat_admin_command
def kek_enable(message):
    admin_tools.admin_post(message)


@my_bot.message_handler(func=commands_handler(['/clean']))
@chat_admin_command
def kek_enable(message):
    admin_tools.admin_clean(message)


@my_bot.message_handler(func=is_command())
@bot_admin_command
def admin_toys(message):
    parts = message.text.split()
    if len(parts) < 1:
        return
    command = parts[0].lower()
    if command == "/prize":
        admin_tools.admin_prize(message)
        return
    if len(parts) < 2 or parts[1] != my_bot_name:
        return
    if command == "/update":
        admin_tools.update_bot(message)
    elif command == "/kill":
        admin_tools.kill_bot(message)
コード例 #6
0
ファイル: MESSAGE.py プロジェクト: devzero-xyz/Andromeda
def on_privmsg(irc, conn, event):
    if utils.is_command(irc, conn, event):
        utils.handle_command(irc, conn, event)