示例#1
0
文件: inf.py 项目: romkabursa/vkbot
    else:
        msg = female.sub('', msg)
        msg = male.sub('\\1', msg)
    return msg, gender

def test_friend(uid):
    try:
        fr = vk.api.users.get(user_ids=uid, fields=check_friend.fields)[0]
    except KeyError:
        return 0
    return check_friend.is_good(fr)
    

bot = Popen(['./chat.exe'], stdout=PIPE, stdin=PIPE)
config = list(map(str.strip, open('data.txt').read().strip().splitlines()))
vk = vk_bot(config[0], config[1], captcha_handler=captcha.solve) # login, pass
print('My id:', vk.self_id)
admin = config[2] if len(config) > 2 else ''
reset_command = config[3] if len(config) > 3 else ''

banign = open('banned.txt').read().split()
banned = set(i[1:] for i in banign if i.startswith('$'))
ignored = set(i for i in banign if not i.startswith('$'))
c = -1
got_reply_cmd = 0

# whether to reply to messages that are already read
reply_all = 0

print('Bot started')
示例#2
0
文件: inf.py 项目: team55/vkbot
    return 'Reloaded!'


def _onexit(*p):
    log.info('Received SIGTERM')
    loop_thread.join(60)
    vk.waitAllThreads()
    log.info('Bye')
    exit(0)


signal.signal(signal.SIGTERM, _onexit)

last_message_text = {}

vk = vk_bot(login, password)
vk.admin = config.get('inf.admin', 'i')
vk.bad_conf_title = lambda s: getBotReply(None, s, -2)
log.info('My id: ' + str(vk.self_id))
banign = ban_manager(accounts.getFile('banned.txt'), vk)
if args['whitelist']:
    vk.whitelist = vk.getUserId(args['whitelist'].split(','))
    log.info('Whitelist: ' + ', '.join(
        map(lambda x: vk.printableName(x, user_fmt='{name}'), vk.whitelist)))

addfriends_interval = config.get('inf.addfriends_interval', 'i')
includeread_interval = config.get('inf.includeread_interval', 'i')
setonline_interval = config.get('inf.setonline_interval', 'i')
unfollow_interval = config.get('inf.unfollow_interval', 'i')
filtercomments_interval = config.get('inf.filtercomments_interval', 'i')
stats_interval = config.get('inf.stats_interval', 'i')
示例#3
0
文件: inf.py 项目: team55/vkbot
    log.info('Reloaded!')
    return 'Reloaded!'

def _onexit(*p):
    log.info('Received SIGTERM')
    loop_thread.join(60)
    vk.waitAllThreads()
    log.info('Bye')
    exit(0)

signal.signal(signal.SIGTERM, _onexit)


last_message_text = {}

vk = vk_bot(login, password)
vk.admin = config.get('inf.admin', 'i')
vk.bad_conf_title = lambda s: getBotReply(None, s, -2)
log.info('My id: ' + str(vk.self_id))
banign = ban_manager(accounts.getFile('banned.txt'), vk)
if args['whitelist']:
    vk.whitelist = vk.getUserId(args['whitelist'].split(','))
    log.info('Whitelist: ' +', '.join(map(lambda x:vk.printableName(x, user_fmt='{name}'), vk.whitelist)))


addfriends_interval = config.get('inf.addfriends_interval', 'i')
includeread_interval = config.get('inf.includeread_interval', 'i')
setonline_interval = config.get('inf.setonline_interval', 'i')
unfollow_interval = config.get('inf.unfollow_interval', 'i')
filtercomments_interval = config.get('inf.filtercomments_interval', 'i')
stats_interval = config.get('inf.stats_interval', 'i')