ebal
This commit is contained in:
parent
765727f112
commit
426a523a47
9
main.py
9
main.py
@ -62,6 +62,15 @@ def show_rating(message: Message):
|
||||
bot.send_message(message.chat.id, text)
|
||||
|
||||
|
||||
@bot.message_handler(commands=['point'])
|
||||
def show_rating(message: Message):
|
||||
if not message.reply_to_message:
|
||||
bot.reply_to(message, 'Чтобы начислить Ебаллы, нужно прописать команду ответом на чье-то сообщение')
|
||||
username = message.reply_to_message.from_user.username
|
||||
mongo.inc_points(username, message.chat.id)
|
||||
bot.reply_to(message.reply_to_message, 'Тебе начислили Ебалл!')
|
||||
|
||||
|
||||
@bot.message_handler()
|
||||
def do_action(message: Message):
|
||||
if message.reply_to_message:
|
||||
|
6
mongo.py
6
mongo.py
@ -35,5 +35,11 @@ class Mongo:
|
||||
else:
|
||||
self.counter_collection.insert_one({"chat_id": chat_id, "username": username, "count": 1})
|
||||
|
||||
def inc_points(self, username, chat_id):
|
||||
if self.counter_collection.find_one({"chat_id": chat_id, "username": username}):
|
||||
self.counter_collection.update_one({"chat_id": chat_id, "username": username}, {"$inc": {"points": 1}})
|
||||
else:
|
||||
self.counter_collection.insert_one({"chat_id": chat_id, "username": username, "points": 1})
|
||||
|
||||
|
||||
mongo = Mongo()
|
||||
|
Loading…
Reference in New Issue
Block a user