Пример #1
0
def _action_battle_report(cid, user, content, update, context):
    """
    Update user info from battle report
    """
    if settings.VERBOSE:
        print("            Battle report")
    try:
        user.cw_name = content.split(settings.GUILD_NAME)[1].split(
            b' \\u2694:')[0].decode("unicode_escape")
        user.cw_level = int(
            content.split(b' Lvl: ')[1].split(b'\\n')[0].decode(
                "unicode_escape"))
        if user.cw_name and user.cw_level:
            if model.user_by_id(update.effective_user.id):
                status = model.update_user(user)
            else:
                status = model.subscribe(user)
            if settings.VERBOSE:
                print("            {0} Lvl: {1} Status: {2}".format(
                    user.cw_name, user.cw_level, status))
    except Exception as e:
        utils._admin_error(context,
                           "_action_battle_report: battle report",
                           user=user,
                           error=str(e))
Пример #2
0
	def POST(self):
		i = web.input()
		s=model.subscribe(i.username,i.uploader)
		if s['subscribestatus']=="Subscribed":
			t=model.get_subscribestatus_count(i.uploader)
			sbs=t['Subscribers']
			model.update_subscribestatus(i.uploader,sbs)			
			raise web.seeother('/play/'+i.videoid)
Пример #3
0
 def POST(self):
         data=web.data()
         un=json.loads(data)['username']
         upl=json.loads(data)['uploader']
         s=model.subscribe(un,upl)
         return s
Пример #4
0
# -*- coding: utf-8 -*-