Ejemplo n.º 1
0
    def test_05(self):
        Chatroom.chatrooms2upsert([ChatroomKakaotalk.chatroom()])
        ServerDoc.codenames2delete([Server.Codename.MARIS])

        sender_name = "iris"
        channel_user_codename = ChannelUserKakaotalk.sender_name2codename(
            sender_name)
        ChannelUser.channel_users2upsert(
            [ChannelUserKakaotalk.sender_name2channel_user(sender_name)])

        # now_utc = datetime.now(pytz.utc)
        packet = {
            KhalaPacket.Field.TEXT: "?남만 +2분",
            KhalaPacket.Field.CHATROOM: KakaotalkUWOChatroom.codename(),
            KhalaPacket.Field.CHANNEL_USER: channel_user_codename,
            KhalaPacket.Field.SENDER_NAME: sender_name,
        }

        with self.assertRaises(HenriqueCommandError) as context:
            NanbanSkill.packet2response(packet)

        self.assertEquals(
            """[남만시각] 이전에 설정된 남만 시각이 없어서 +/-로 남만 시각을 조정할 수 없어요.""",
            str(context.exception))

        if HenriqueEnv.env() == HenriqueEnv.Value.LOCAL:
            return  # cannot test here because LOCAL has different settings

        hyp = HenriquePacket.packet2response(packet)
        ref = "[남만시각] 이전에 설정된 남만 시각이 없어서 +/-로 남만 시각을 조정할 수 없어요."

        # pprint(hyp)
        self.assertEqual(hyp, ref)
Ejemplo n.º 2
0
def start_discord():
    from henrique.main.singleton.env.henrique_env import HenriqueEnv
    from henrique.main.singleton.logger.henrique_logger import KhalaLogger
    logger = KhalaLogger.func_level2logger(start_discord, logging.DEBUG)
    logger.debug({"HenriqueEnv.env()": HenriqueEnv.env()})

    HenriqueWarmer.warmup_all()

    # maybe update?
    # https://stackoverflow.com/a/50981577
    client = DiscordClient.client()
    discord_token = HenriqueEnv.key2value("DISCORD_TOKEN")
    logger.debug({"discord_token": discord_token})

    assert_true(discord_token)
    client.run(discord_token)
Ejemplo n.º 3
0
def main():
    env = HenriqueEnv.env()
    print(HenriqueServer.env2ip(env))