I want a create a bot that add or leave "points". For do this i use for every user a single txt file nominated with they id.
For add points i wanna do a replyed message with /addkarma (number of points)
and i want add karma (the points) at the user who i replyed the message (karma=points).
How i do it? Everytime i do print(message.reply_to_message.json.from.id)
for check what bot take from this, python give me a error like this
print(message.reply_to_message.json.from.id)
^^^^
SyntaxError: invalid syntax
please help
import telebot
import os
bot = telebot.TeleBot(TOKEN)
def newuser(points,id):
with open(f"{id}.txt","w") as f:
f.write(points)
@bot.message_handler(commands=['addkarma'])
def user(username,points,message):
file = os.path.exists(f'/users/{id}.txt')
if not file:
newuser(points,id)
id = message.reply_to_message.json.from.id
file_name = os.path.basename(f'/users/{id}.txt')
thats all my code and what i try to do
ps.Is my first post here, not really good to write english and wanna help, please forgive me for eng errors. Also pretty new to telegram bots :)