How to use the werobot.messages.entries.IntEntry function in WeRoBot

To help you get started, we’ve selected a few WeRoBot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github offu / WeRoBot / tests / test_entry.py View on Github external
# -*- coding: utf-8 -*-

import six
from werobot.messages.entries import StringEntry, FloatEntry, IntEntry
from werobot.utils import to_text


class NoNameMessage(object):
    test_int = IntEntry("TestInt")
    test_string_to_int = IntEntry("TestStringToInt")
    test_float_to_int = IntEntry("TestFloatToInt")
    test_int_none = IntEntry("MIAOMIAOMIAO")

    test_float = FloatEntry("TestFloat")
    test_string_to_float = FloatEntry("TestStringToFloat")
    test_float_none = FloatEntry("WANGWANG")

    test_string = StringEntry("TestString")
    test_int_to_string = StringEntry("TestIntToString")
    test_float_to_string = StringEntry("TestFloatToString")
    test_chinese = StringEntry("TestChinese")
    test_string_none = StringEntry("HAHAHA")

    def __init__(self):
        message = {
            "TestInt": 123,
            "TestFloat": 0.00001,
            "TestString": "hello",
github offu / WeRoBot / tests / test_entry.py View on Github external
# -*- coding: utf-8 -*-

import six
from werobot.messages.entries import StringEntry, FloatEntry, IntEntry
from werobot.utils import to_text


class NoNameMessage(object):
    test_int = IntEntry("TestInt")
    test_string_to_int = IntEntry("TestStringToInt")
    test_float_to_int = IntEntry("TestFloatToInt")
    test_int_none = IntEntry("MIAOMIAOMIAO")

    test_float = FloatEntry("TestFloat")
    test_string_to_float = FloatEntry("TestStringToFloat")
    test_float_none = FloatEntry("WANGWANG")

    test_string = StringEntry("TestString")
    test_int_to_string = StringEntry("TestIntToString")
    test_float_to_string = StringEntry("TestFloatToString")
    test_chinese = StringEntry("TestChinese")
    test_string_none = StringEntry("HAHAHA")

    def __init__(self):
        message = {
github offu / WeRoBot / werobot / messages / events.py View on Github external
__type__ = 'card_not_pass_check_event'


class BaseCardEvent(WeChatEvent):
    card_id = StringEntry('CardId')
    user_card_code = StringEntry('UserCardCode')


class UserGetCardEvent(BaseCardEvent):
    __type__ = 'user_get_card_event'
    is_give_by_friend = IntEntry('IsGiveByFriend')
    friend_user_name = StringEntry('FriendUserName')
    outer_id = IntEntry('OuterId')
    old_user_card_code = StringEntry('OldUserCardCode')
    outer_str = StringEntry('OuterStr')
    is_restore_member_card = IntEntry('IsRestoreMemberCard')
    is_recommend_by_friend = IntEntry('IsRecommendByFriend')


class UserGiftingCardEvent(BaseCardEvent):
    __type__ = 'user_gifting_card_event'
    is_return_back = IntEntry('IsReturnBack')
    friend_user_name = StringEntry('FriendUserName')
    is_chat_room = IntEntry('IsChatRoom')


class UserDelCardEvent(BaseCardEvent):
    __type__ = 'user_del_card_event'


class UserConsumeCardEvent(BaseCardEvent):
    __type__ = 'user_consume_card_event'
github offu / WeRoBot / werobot / messages / messages.py View on Github external
# -*- coding: utf-8 -*-

import six
from werobot.messages.entries import StringEntry, IntEntry, FloatEntry
from werobot.messages.base import WeRoBotMetaClass


class MessageMetaClass(WeRoBotMetaClass):
    pass


@six.add_metaclass(MessageMetaClass)
class WeChatMessage(object):
    message_id = IntEntry('MsgId', 0)
    target = StringEntry('ToUserName')
    source = StringEntry('FromUserName')
    time = IntEntry('CreateTime', 0)

    def __init__(self, message):
        self.__dict__.update(message)


class TextMessage(WeChatMessage):
    __type__ = 'text'
    content = StringEntry('Content')

    def __str__(self):
        return self.content
github offu / WeRoBot / werobot / messages / events.py View on Github external
import six
from werobot.messages.entries import StringEntry, IntEntry, FloatEntry
from werobot.messages.base import WeRoBotMetaClass


class EventMetaClass(WeRoBotMetaClass):
    pass


@six.add_metaclass(EventMetaClass)
class WeChatEvent(object):
    target = StringEntry('ToUserName')
    source = StringEntry('FromUserName')
    time = IntEntry('CreateTime')
    message_id = IntEntry('MsgID', 0)

    def __init__(self, message):
        self.__dict__.update(message)


class SimpleEvent(WeChatEvent):
    key = StringEntry('EventKey')


class TicketEvent(WeChatEvent):
    key = StringEntry('EventKey')
    ticket = StringEntry('Ticket')


class SubscribeEvent(TicketEvent):
    __type__ = 'subscribe_event'
github offu / WeRoBot / werobot / messages / events.py View on Github external
original_fee = StringEntry('OriginalFee')


class UserViewCardEvent(BaseCardEvent):
    __type__ = 'user_view_card_event'
    outer_str = StringEntry('OuterStr')


class UserEnterSessionFromCardEvent(BaseCardEvent):
    __type__ = 'user_enter_session_from_card_event'


class UpdateMemberCardEvent(BaseCardEvent):
    __type__ = 'update_member_card_event'
    modify_bonus = IntEntry('ModifyBonus')
    modify_balance = IntEntry('ModifyBalance')


class CardSkuRemindEvent(WeChatEvent):
    __type__ = 'card_sku_remind_event'
    card_id = StringEntry('CardId')
    detail = StringEntry('Detail')


class CardPayOrderEvent(WeChatEvent):
    __type__ = 'card_pay_order_event'
    order_id = StringEntry('OrderId')
    status = StringEntry('Status')
    create_order_time = IntEntry('CreateOrderTime')
    pay_finish_time = IntEntry('PayFinishTime')
    desc = StringEntry('Desc')
    free_coin_count = StringEntry('FreeCoinCount')
github offu / WeRoBot / werobot / messages / events.py View on Github external
class UserGetCardEvent(BaseCardEvent):
    __type__ = 'user_get_card_event'
    is_give_by_friend = IntEntry('IsGiveByFriend')
    friend_user_name = StringEntry('FriendUserName')
    outer_id = IntEntry('OuterId')
    old_user_card_code = StringEntry('OldUserCardCode')
    outer_str = StringEntry('OuterStr')
    is_restore_member_card = IntEntry('IsRestoreMemberCard')
    is_recommend_by_friend = IntEntry('IsRecommendByFriend')


class UserGiftingCardEvent(BaseCardEvent):
    __type__ = 'user_gifting_card_event'
    is_return_back = IntEntry('IsReturnBack')
    friend_user_name = StringEntry('FriendUserName')
    is_chat_room = IntEntry('IsChatRoom')


class UserDelCardEvent(BaseCardEvent):
    __type__ = 'user_del_card_event'


class UserConsumeCardEvent(BaseCardEvent):
    __type__ = 'user_consume_card_event'
    consume_source = StringEntry('ConsumeSource')
    location_name = StringEntry('LocationName')
    staff_open_id = StringEntry('StaffOpenId')
    verify_code = StringEntry('VerifyCode')
    remark_amount = StringEntry('RemarkAmount')
    outer_str = StringEntry('OuterStr')
github offu / WeRoBot / werobot / messages / events.py View on Github external
fee = StringEntry('Fee')
    original_fee = StringEntry('OriginalFee')


class UserViewCardEvent(BaseCardEvent):
    __type__ = 'user_view_card_event'
    outer_str = StringEntry('OuterStr')


class UserEnterSessionFromCardEvent(BaseCardEvent):
    __type__ = 'user_enter_session_from_card_event'


class UpdateMemberCardEvent(BaseCardEvent):
    __type__ = 'update_member_card_event'
    modify_bonus = IntEntry('ModifyBonus')
    modify_balance = IntEntry('ModifyBalance')


class CardSkuRemindEvent(WeChatEvent):
    __type__ = 'card_sku_remind_event'
    card_id = StringEntry('CardId')
    detail = StringEntry('Detail')


class CardPayOrderEvent(WeChatEvent):
    __type__ = 'card_pay_order_event'
    order_id = StringEntry('OrderId')
    status = StringEntry('Status')
    create_order_time = IntEntry('CreateOrderTime')
    pay_finish_time = IntEntry('PayFinishTime')
    desc = StringEntry('Desc')
github offu / WeRoBot / werobot / messages / events.py View on Github external
class UserGetCardEvent(BaseCardEvent):
    __type__ = 'user_get_card_event'
    is_give_by_friend = IntEntry('IsGiveByFriend')
    friend_user_name = StringEntry('FriendUserName')
    outer_id = IntEntry('OuterId')
    old_user_card_code = StringEntry('OldUserCardCode')
    outer_str = StringEntry('OuterStr')
    is_restore_member_card = IntEntry('IsRestoreMemberCard')
    is_recommend_by_friend = IntEntry('IsRecommendByFriend')


class UserGiftingCardEvent(BaseCardEvent):
    __type__ = 'user_gifting_card_event'
    is_return_back = IntEntry('IsReturnBack')
    friend_user_name = StringEntry('FriendUserName')
    is_chat_room = IntEntry('IsChatRoom')


class UserDelCardEvent(BaseCardEvent):
    __type__ = 'user_del_card_event'


class UserConsumeCardEvent(BaseCardEvent):
    __type__ = 'user_consume_card_event'
    consume_source = StringEntry('ConsumeSource')
    location_name = StringEntry('LocationName')
    staff_open_id = StringEntry('StaffOpenId')
    verify_code = StringEntry('VerifyCode')
    remark_amount = StringEntry('RemarkAmount')
    outer_str = StringEntry('OuterStr')
github offu / WeRoBot / werobot / messages / events.py View on Github external
class CardPassCheckEvent(BaseCardCheckEvent):
    __type__ = 'card_pass_check_event'


class CardNotPassCheckEvent(BaseCardCheckEvent):
    __type__ = 'card_not_pass_check_event'


class BaseCardEvent(WeChatEvent):
    card_id = StringEntry('CardId')
    user_card_code = StringEntry('UserCardCode')


class UserGetCardEvent(BaseCardEvent):
    __type__ = 'user_get_card_event'
    is_give_by_friend = IntEntry('IsGiveByFriend')
    friend_user_name = StringEntry('FriendUserName')
    outer_id = IntEntry('OuterId')
    old_user_card_code = StringEntry('OldUserCardCode')
    outer_str = StringEntry('OuterStr')
    is_restore_member_card = IntEntry('IsRestoreMemberCard')
    is_recommend_by_friend = IntEntry('IsRecommendByFriend')


class UserGiftingCardEvent(BaseCardEvent):
    __type__ = 'user_gifting_card_event'
    is_return_back = IntEntry('IsReturnBack')
    friend_user_name = StringEntry('FriendUserName')
    is_chat_room = IntEntry('IsChatRoom')


class UserDelCardEvent(BaseCardEvent):