Example #1
0
def on_chat(usr_i, str_i):
    global loadedMods
    global loadedModules

    loadedMods.send_chat(usr_i, str_i)

    if str_i.startswith('!봇'):
        params = str_i.split(" ")
        params = list(filter(lambda x: x != "", params))
        if params[0] == "!봇":
            paramnum = len(params)

            if paramnum == 1:
                return [("chat", "https://bot.ster.email")]
            else:
                if params[1][0] == "_":
                    if params[1] == "_reload":
                        try:
                            loadedModules = extnModules()
                            loadedMods = extnMods()
                            return [("chat", "모듈 갱신완료")]
                        except:
                            return [("chat", "모듈 갱신실패")]
                else:
                    res = loadedModules.commandSel(params, usr_i)

                    if res == loadedModules.wrong_command:
                        return [("chat", "잘못된 명령어입니다.")]
                    else:
                        return res

    return []
Example #2
0
def parser(params, usr_i):
    global loadedMods
    global loadedModules
    global enabled

    params = list(filter(lambda x: x != "", params))
    paramnum = len(params)

    if paramnum == 1:
        return [("chat", "http://bot.ster.email")]
    else:
        if params[1][0] == "_":
            if params[1] == "_reload":
                try:
                    loadedModules = extnModules()
                    loadedMods = extnMods()
                    return [("chat", "모듈 갱신완료")]
                except:
                    return [("chat", "모듈 갱신실패")]
            elif params[1] == "_moveto":
                rcode = params[2]
                return [("chat", f"https://band.us/band/55800178/chat/{rcode}")
                        ]
        else:
            res = loadedModules.commandSel(params, usr_i)

            if res == loadedModules.wrong_command:
                return [("chat", "잘못된 명령입니다.")]
            else:
                return res
Example #3
0
def on_chat(chatobj):
    global loadedMods
    global loadedModules

    usr_i = chatobj.user
    str_i = chatobj.text

    loadedMods.send_chat(usr_i, str_i)

    if str_i.startswith('!봇'):
        params = str_i.split(" ")
        params = list(filter(lambda x: x != "", params))
        if params[0] == "!봇":
            paramnum = len(params)

            if paramnum == 1:
                chatobj.get_reply()
                return [("chat", "https://bot.ster.email")]
            else:
                if params[1][0] == "_":
                    if params[1] == "_reload":
                        chatobj.get_reply()
                        try:
                            loadedModules = extnModules()
                            loadedMods = extnMods()
                            return [("chat", "모듈 갱신완료")]
                        except:
                            return [("chat", "모듈 갱신실패")]
                else:
                    res = loadedModules.commandSel(params, usr_i)

                    if res == loadedModules.wrong_command:
                        chatobj.send_emotion('angry')
                        return []
                    else:
                        # TODO: 예외처리 좀더 상세히.
                        can_reply = True
                        for r in res:
                            if r[0] == 'image':
                                can_reply = False
                        if can_reply: chatobj.get_reply()
                        return res
    return []
Example #4
0
def on_chat(usr_i, str_i):
    global loadedMods
    global loadedModules

    loadedMods.send_chat(usr_i, str_i)

    if str_i.startswith('!봇'):
        params = str_i.split(" ")
        params = list(filter(lambda x: x != "", params))
        if params[0] == "!봇":
            prefixChat = "[" + param.NAME + "] " + usr_i + "\n"

            paramnum = len(params)

            if paramnum == 1:
                return [
                    ("chat",
                     prefixChat + param.GUIDE + loadedModules.strfModules())
                ]
            else:
                if params[1][0] == "_":
                    if params[1] == "_reload":
                        try:
                            loadedModules = extnModules()
                            loadedMods = extnMods()
                            return [("chat", "모듈 갱신완료")]
                        except:
                            return [("chat", "모듈 갱신실패")]
                else:
                    res = loadedModules.commandSel(params, usr_i)

                    if res == loadedModules.wrong_command:
                        return [("chat", "잘못된 명령어입니다.")]
                    else:
                        return res

    return []
Example #5
0
import param
import time
from extensions import extnMods, extnModules

loadedModules = extnModules()
loadedMods = extnMods()

username = input("username? ")


def on_chat(usr_i, str_i):
    global loadedMods
    global loadedModules

    loadedMods.send_chat(usr_i, str_i)

    if str_i.startswith('!봇'):
        params = str_i.split(" ")
        params = list(filter(lambda x: x != "", params))
        if params[0] == "!봇":
            prefixChat = "[" + param.NAME + "] " + usr_i + "\n"

            paramnum = len(params)

            if paramnum == 1:
                return [
                    ("chat",
                     prefixChat + param.GUIDE + loadedModules.strfModules())
                ]
            else:
                if params[1][0] == "_":