Gamification methods
Gamification methods in Instagram and Facebook
For configuring function operations, we recommend using the gamification template for Instagram chats as a reference.
To use the functions listed below, you need to declare common variables in the Project settings:
comment_score
how many points to award for comments
10
comment_max_actions
maximum number of comments per day
5
min_comment_len
minimum comment length
25
stories_score
how many points to award for reactions in stories
15
stories_max_actions
maximum number of actions per day
1
stories_mention_score
how many points to award for mentions in stories
5
stories_mention_max_actions
maximum number of actions per day
2
post_mention_score
how many points to award for mentions in post
10
post_mention_max_actions
maximum number of actions per day
3
end_game_date
game end date
30.12.2021
game_add_comment(text=None) - adds points for a comment on Instagram or FB; you can also pass any text.
game_add_stories() - adds points for reactions in stories
game_add_message() - add points for Direct messages
game_add_stories_mention() - add points for mentions in stories
game_get_user_score() - return's user points
game_get_user_place() - displays user’s position in the ranking
game_get_leader_score() - returns leader’s points in the ranking
game_get_top(count=99999999, shift=0, humanize=False, delimiter=None, platform=None) - calling the function without arguments returns a sorted ranking as an array of users. It accepts the following 5 parameters: count - how many users to return; shift - the starting rank position for the selection (0 means the list starts from the leader and goes downward by points; for example, 3 means the selection starts from the 4th place and below); humanize 0 - returns an array of user dictionaries, 1 returns a formatted list for display to the user; delimiter - the separator between the username and their score (used if humanize=1); platform 1 - outputs the Instagram login (e.g., @nik) instead of the username.
Example 1: game_get_top(10, 0, 1, ' - ') will return: John - 40 Anna - 30 George - 10 Example 2: game_get_top(3, 0, 1, ' - ', 1) will return: @john - 40 @anna - 30 @privet - 10
game_add_score(count=1, client_id=None) - adds points to user
game_set_score(score, client_id=None) - sets user's total points
game_ban_player() - blocks user
game_unban_player() - unblocks user
game_user_banned() - returns user’s ban status; True if banned, False if not
# allows working with arbitrary values in leaderboard.
game_add_value(val_name, count=1, client_id=None) -
game_set_value(val_name, value, client_id=None)
game_minus_user_score(count =10) - subtracts points from user (count - how many points to subtract)
game_get_today_user_comment_action() - number of comments made by user today
game_get_today_user_message_actions() - number of messages sent by user today
game_get_today_user_stories_actions() - number of stories posted by user today
game_get_today_user_mention_actions() - number of user activities (mentions) today
game_get_today_user_post_mention_actions() - number of posts with mentions by user today
game_get_total_comment_action() - total number of comments during the entire game
game_get_total_message_actions() - total number of messages during the entire game
game_get_total_stories_actions() - total number of stories during the entire game
game_get_total_stories_mention_actions() - total number of mentions in stories during the entire game
game_get_total_post_mention_actions() - total number of mentions in posts during the entire game
Getting ranking in Telegram
For configuring function operations, we recommend using the gamification template for Telegram chats as a reference.
In the global variables, you should create a dictionary named tg_thanks_score_data to store client information in the following format:
{"total_thanks":20,"326659632":{"name":"John","user_name":"john","score":5},"403051597":{"name":"Timm","user_name":"dbeing","score":15,"banned":false}}
tg_get_top(count=99999999, shift=0, humanize=False, delimiter=None)
Parameters:
count - how many users to return shift - the starting rank position for selection (0 means the list starts from the leader and goes downward by points; for example, 3 means selection starts from the 4th place and below) humanize - 0 returns an array of user dictionaries, 1 returns a formatted list for displaying to the user delimiter - the separator between the username and his score (used if humanize=1)
tg_get_user_info()
{'score': user_score, 'place': place, 'name': name}
Last updated