How to use the werobot.messages.entries.StringEntry 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
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",
            "TestStringToInt": "123",
            "TestFloatToInt": 123.000,
            "TestStringToFloat": "0.00001",
            "TestIntToString": 123,
            "TestFloatToString": 0.00001,
            "TestChinese": "喵",
        }
        self.__dict__.update(message)
github offu / WeRoBot / werobot / messages / events.py View on Github external
class ViewEvent(SimpleEvent):
    __type__ = 'view_event'


class LocationEvent(WeChatEvent):
    __type__ = 'location_event'
    latitude = FloatEntry('Latitude')
    longitude = FloatEntry('Longitude')
    precision = FloatEntry('Precision')


class TemplateSendJobFinishEvent(WeChatEvent):
    __type__ = 'templatesendjobfinish_event'
    status = StringEntry('Status')


class BaseProductEvent(WeChatEvent):
    key_standard = StringEntry('KeyStandard')
    key_str = StringEntry('KeyStr')
    ext_info = StringEntry('ExtInfo')


class UserScanProductEvent(BaseProductEvent):
    __type__ = 'user_scan_product_event'
    country = StringEntry('Country')
    province = StringEntry('Province')
    city = StringEntry('City')
    sex = IntEntry('Sex')
    scene = IntEntry('Scene')
github offu / WeRoBot / werobot / messages / messages.py View on Github external
    @property
    def location(self):
        return self.location_x, self.location_y


class LinkMessage(WeChatMessage):
    __type__ = 'link'
    title = StringEntry('Title')
    description = StringEntry('Description')
    url = StringEntry('Url')


class VoiceMessage(WeChatMessage):
    __type__ = 'voice'
    media_id = StringEntry('MediaId')
    format = StringEntry('Format')
    recognition = StringEntry('Recognition')


class VideoMessage(WeChatMessage):
    __type__ = ['video', 'shortvideo']
    media_id = StringEntry('MediaId')
    thumb_media_id = StringEntry('ThumbMediaId')


class UnknownMessage(WeChatMessage):
    __type__ = 'unknown'
github offu / WeRoBot / werobot / messages / messages.py View on Github external
@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')


class ImageMessage(WeChatMessage):
    __type__ = 'image'
    img = StringEntry('PicUrl')


class LocationMessage(WeChatMessage):
    __type__ = 'location'
    location_x = FloatEntry('Location_X')
    location_y = FloatEntry('Location_Y')
    label = StringEntry('Label')
    scale = IntEntry('Scale')

    @property
    def location(self):
github offu / WeRoBot / werobot / messages / events.py View on Github external
class LocationEvent(WeChatEvent):
    __type__ = 'location_event'
    latitude = FloatEntry('Latitude')
    longitude = FloatEntry('Longitude')
    precision = FloatEntry('Precision')


class TemplateSendJobFinishEvent(WeChatEvent):
    __type__ = 'templatesendjobfinish_event'
    status = StringEntry('Status')


class BaseProductEvent(WeChatEvent):
    key_standard = StringEntry('KeyStandard')
    key_str = StringEntry('KeyStr')
    ext_info = StringEntry('ExtInfo')


class UserScanProductEvent(BaseProductEvent):
    __type__ = 'user_scan_product_event'
    country = StringEntry('Country')
    province = StringEntry('Province')
    city = StringEntry('City')
    sex = IntEntry('Sex')
    scene = IntEntry('Scene')


class UserScanProductEnterSessionEvent(BaseProductEvent):
    __type__ = 'user_scan_product_enter_session_event'
github offu / WeRoBot / werobot / messages / events.py View on Github external
__type__ = 'pic_sysphoto_event'


class PicPhotoOrAlbumEvent(BasePicEvent):
    __type__ = 'pic_photo_or_album_event'


class PicWeixinEvent(BasePicEvent):
    __type__ = 'pic_weixin_event'


class LocationSelectEvent(SimpleEvent):
    __type__ = 'location_select_event'
    location_x = StringEntry('SendLocationInfo.Location_X')
    location_y = StringEntry('SendLocationInfo.Location_Y')
    scale = StringEntry('SendLocationInfo.Scale')
    label = StringEntry('SendLocationInfo.Label')
    poi_name = StringEntry('SendLocationInfo.Poiname')


class ClickEvent(SimpleEvent):
    __type__ = 'click_event'


class ViewEvent(SimpleEvent):
    __type__ = 'view_event'


class LocationEvent(WeChatEvent):
    __type__ = 'location_event'
    latitude = FloatEntry('Latitude')
    longitude = FloatEntry('Longitude')
github offu / WeRoBot / werobot / messages / events.py View on Github external
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')


class UserPayFromPayCellEvent(BaseCardEvent):
    __type__ = 'user_pay_from_pay_cell_event'
    trans_id = StringEntry('TransId')
    location_id = IntEntry('LocationId')
    fee = StringEntry('Fee')
    original_fee = StringEntry('OriginalFee')


class UserViewCardEvent(BaseCardEvent):
    __type__ = 'user_view_card_event'
github offu / WeRoBot / werobot / messages / events.py View on Github external
class PicSysphotoEvent(BasePicEvent):
    __type__ = 'pic_sysphoto_event'


class PicPhotoOrAlbumEvent(BasePicEvent):
    __type__ = 'pic_photo_or_album_event'


class PicWeixinEvent(BasePicEvent):
    __type__ = 'pic_weixin_event'


class LocationSelectEvent(SimpleEvent):
    __type__ = 'location_select_event'
    location_x = StringEntry('SendLocationInfo.Location_X')
    location_y = StringEntry('SendLocationInfo.Location_Y')
    scale = StringEntry('SendLocationInfo.Scale')
    label = StringEntry('SendLocationInfo.Label')
    poi_name = StringEntry('SendLocationInfo.Poiname')


class ClickEvent(SimpleEvent):
    __type__ = 'click_event'


class ViewEvent(SimpleEvent):
    __type__ = 'view_event'


class LocationEvent(WeChatEvent):
    __type__ = 'location_event'
github offu / WeRoBot / werobot / messages / events.py View on Github external
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')
    pay_coin_count = StringEntry('PayCoinCount')
    refund_free_coin_count = StringEntry('RefundFreeCoinCount')
    refund_pay_coin_count = StringEntry('RefundPayCoinCount')
    order_type = StringEntry('OrderType')
    memo = StringEntry('Memo')
    receipt_info = StringEntry('ReceiptInfo')


class SubmitMembercardUserInfoEvent(BaseCardEvent):
    __type__ = 'submit_membercard_user_info_event'


class UnknownEvent(WeChatEvent):
    __type__ = 'unknown_event'
github offu / WeRoBot / werobot / messages / messages.py View on Github external
title = StringEntry('Title')
    description = StringEntry('Description')
    url = StringEntry('Url')


class VoiceMessage(WeChatMessage):
    __type__ = 'voice'
    media_id = StringEntry('MediaId')
    format = StringEntry('Format')
    recognition = StringEntry('Recognition')


class VideoMessage(WeChatMessage):
    __type__ = ['video', 'shortvideo']
    media_id = StringEntry('MediaId')
    thumb_media_id = StringEntry('ThumbMediaId')


class UnknownMessage(WeChatMessage):
    __type__ = 'unknown'