本文整理汇总了Python中bot.Bot.get_instance方法的典型用法代码示例。如果您正苦于以下问题:Python Bot.get_instance方法的具体用法?Python Bot.get_instance怎么用?Python Bot.get_instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bot.Bot
的用法示例。
在下文中一共展示了Bot.get_instance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: file_chunk_request
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import get_instance [as 别名]
def file_chunk_request(tox, friend_number, file_number, position, size, user_data):
"""
Outgoing chunk
"""
Bot.get_instance().outgoing_chunk(
friend_number,
file_number,
position,
size)
示例2: file_recv_chunk
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import get_instance [as 别名]
def file_recv_chunk(tox, friend_number, file_number, position, chunk, length, user_data):
"""
Incoming chunk
"""
Bot.get_instance().incoming_chunk(
friend_number,
file_number,
position,
chunk[:length] if length else None)
示例3: wrapped
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import get_instance [as 别名]
def wrapped(tox, friend_number, file_number, file_type, size, file_name, file_name_size, user_data):
profile = Bot.get_instance()
if file_type == TOX_FILE_KIND['DATA']:
print 'dosya gonderme istegi geldi',friend_number,"dan"
file_name = unicode(file_name[:file_name_size].decode('utf-8'))
profile.incoming_file_transfer(friend_number, file_number, size, file_name)
else: # AVATAR
tox_link.file_control(friend_number, file_number, TOX_FILE_CONTROL['CANCEL'])
示例4: friend_request
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import get_instance [as 别名]
def friend_request(tox, public_key, message, message_size, user_data):
"""
Called when user get new friend request
"""
profile = Bot.get_instance()
key = ''.join(chr(x) for x in public_key[:TOX_PUBLIC_KEY_SIZE])
tox_id = bin_to_string(key, TOX_PUBLIC_KEY_SIZE)
profile.process_friend_request(tox_id, message.decode('utf-8'))
示例5: file_recv_control
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import get_instance [as 别名]
def file_recv_control(tox, friend_number, file_number, file_control, user_data):
"""
Friend cancelled, paused or resumed file transfer
"""
if file_control == TOX_FILE_CONTROL['CANCEL']:
Bot.get_instance().cancel_transfer(friend_number, file_number, True)