当前位置: 首页>>代码示例>>Python>>正文


Python Filters.status_update方法代码示例

本文整理汇总了Python中telegram.ext.Filters.status_update方法的典型用法代码示例。如果您正苦于以下问题:Python Filters.status_update方法的具体用法?Python Filters.status_update怎么用?Python Filters.status_update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在telegram.ext.Filters的用法示例。


在下文中一共展示了Filters.status_update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_filters_status_update

# 需要导入模块: from telegram.ext import Filters [as 别名]
# 或者: from telegram.ext.Filters import status_update [as 别名]
    def test_filters_status_update(self, message):
        assert not Filters.status_update(message)

        message.new_chat_members = ['test']
        assert Filters.status_update(message)
        assert Filters.status_update.new_chat_members(message)
        message.new_chat_members = None

        message.left_chat_member = 'test'
        assert Filters.status_update(message)
        assert Filters.status_update.left_chat_member(message)
        message.left_chat_member = None

        message.new_chat_title = 'test'
        assert Filters.status_update(message)
        assert Filters.status_update.new_chat_title(message)
        message.new_chat_title = ''

        message.new_chat_photo = 'test'
        assert Filters.status_update(message)
        assert Filters.status_update.new_chat_photo(message)
        message.new_chat_photo = None

        message.delete_chat_photo = True
        assert Filters.status_update(message)
        assert Filters.status_update.delete_chat_photo(message)
        message.delete_chat_photo = False

        message.group_chat_created = True
        assert Filters.status_update(message)
        assert Filters.status_update.chat_created(message)
        message.group_chat_created = False

        message.supergroup_chat_created = True
        assert Filters.status_update(message)
        assert Filters.status_update.chat_created(message)
        message.supergroup_chat_created = False

        message.channel_chat_created = True
        assert Filters.status_update(message)
        assert Filters.status_update.chat_created(message)
        message.channel_chat_created = False

        message.migrate_to_chat_id = 100
        assert Filters.status_update(message)
        assert Filters.status_update.migrate(message)
        message.migrate_to_chat_id = 0

        message.migrate_from_chat_id = 100
        assert Filters.status_update(message)
        assert Filters.status_update.migrate(message)
        message.migrate_from_chat_id = 0

        message.pinned_message = 'test'
        assert Filters.status_update(message)
        assert Filters.status_update.pinned_message(message)
        message.pinned_message = None
开发者ID:ferisystem,项目名称:python-telegram-bot,代码行数:59,代码来源:test_filters.py

示例2: test_filters_status_update

# 需要导入模块: from telegram.ext import Filters [as 别名]
# 或者: from telegram.ext.Filters import status_update [as 别名]
    def test_filters_status_update(self):
        self.assertFalse(Filters.status_update(self.message))

        self.message.new_chat_member = 'test'
        self.assertTrue(Filters.status_update(self.message))
        self.message.new_chat_member = None

        self.message.left_chat_member = 'test'
        self.assertTrue(Filters.status_update(self.message))
        self.message.left_chat_member = None

        self.message.new_chat_title = 'test'
        self.assertTrue(Filters.status_update(self.message))
        self.message.new_chat_title = ''

        self.message.new_chat_photo = 'test'
        self.assertTrue(Filters.status_update(self.message))
        self.message.new_chat_photo = None

        self.message.delete_chat_photo = True
        self.assertTrue(Filters.status_update(self.message))
        self.message.delete_chat_photo = False

        self.message.group_chat_created = True
        self.assertTrue(Filters.status_update(self.message))
        self.message.group_chat_created = False

        self.message.supergroup_chat_created = True
        self.assertTrue(Filters.status_update(self.message))
        self.message.supergroup_chat_created = False

        self.message.migrate_to_chat_id = 100
        self.assertTrue(Filters.status_update(self.message))
        self.message.migrate_to_chat_id = 0

        self.message.migrate_from_chat_id = 100
        self.assertTrue(Filters.status_update(self.message))
        self.message.migrate_from_chat_id = 0

        self.message.channel_chat_created = True
        self.assertTrue(Filters.status_update(self.message))
        self.message.channel_chat_created = False

        self.message.pinned_message = 'test'
        self.assertTrue(Filters.status_update(self.message))
        self.message.pinned_message = None
开发者ID:9kopb,项目名称:python-telegram-bot,代码行数:48,代码来源:test_filters.py


注:本文中的telegram.ext.Filters.status_update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。