|
@ -3,6 +3,7 @@ |
|
|
|
|
|
|
|
|
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters |
|
|
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters |
|
|
from telegram import ParseMode |
|
|
from telegram import ParseMode |
|
|
|
|
|
from db import Db |
|
|
import logging |
|
|
import logging |
|
|
import os |
|
|
import os |
|
|
import random |
|
|
import random |
|
@ -128,22 +129,43 @@ def sendDog(bot, update): |
|
|
|
|
|
|
|
|
def kill(bot, update, sudocall = False): |
|
|
def kill(bot, update, sudocall = False): |
|
|
"""kill me pls""" |
|
|
"""kill me pls""" |
|
|
|
|
|
db = Db() |
|
|
|
|
|
user = update.message.from_user.first_name |
|
|
|
|
|
if db.is_dead(user): |
|
|
|
|
|
if sudocall: |
|
|
|
|
|
update.message.reply_text("%s killed again" % user) |
|
|
|
|
|
return |
|
|
|
|
|
update.message.reply_text("%s is already dead" % user) |
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
message = update.message.from_user.first_name + " died" |
|
|
message = update.message.from_user.first_name + " died" |
|
|
if sudocall: |
|
|
if sudocall: |
|
|
message += " for real" |
|
|
message += " for real" |
|
|
|
|
|
db.kill(user) |
|
|
update.message.reply_text(message) |
|
|
update.message.reply_text(message) |
|
|
|
|
|
|
|
|
def revive(bot, update, sudocall = False): |
|
|
def revive(bot, update, sudocall = False): |
|
|
"""unkill me pls""" |
|
|
"""unkill me pls""" |
|
|
message = update.message.from_user.first_name + " is living again" |
|
|
|
|
|
|
|
|
db = Db() |
|
|
|
|
|
user = update.message.from_user.first_name |
|
|
|
|
|
if not db.is_dead(user): |
|
|
|
|
|
update.message.reply_text("Maybe %s should have a litte 'accident' before" % user) |
|
|
|
|
|
return |
|
|
if sudocall: |
|
|
if sudocall: |
|
|
message += " for real" |
|
|
|
|
|
update.message.reply_text(message) |
|
|
|
|
|
|
|
|
update.message.reply_text("%s is living again, for real" % user) |
|
|
|
|
|
db.revive(user) |
|
|
|
|
|
return |
|
|
|
|
|
update.message.reply_text("You fool! You cannot revive a dead person!") |
|
|
|
|
|
|
|
|
SUDOCMDS = { |
|
|
SUDOCMDS = { |
|
|
"kill" : kill, |
|
|
"kill" : kill, |
|
|
"revive" : revive |
|
|
"revive" : revive |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
def graveyard(bot, update): |
|
|
|
|
|
"""List the dead""" |
|
|
|
|
|
db = Db() |
|
|
|
|
|
update.message.reply_text("Here are the dead people:\n%s" % db.get_dead_bodies()) |
|
|
|
|
|
|
|
|
def sudo(bot, update, args): |
|
|
def sudo(bot, update, args): |
|
|
"""for real""" |
|
|
"""for real""" |
|
@ -267,6 +289,7 @@ def main(): |
|
|
dp.add_handler(CommandHandler("kill", kill)) |
|
|
dp.add_handler(CommandHandler("kill", kill)) |
|
|
dp.add_handler(CommandHandler("revive", revive)) |
|
|
dp.add_handler(CommandHandler("revive", revive)) |
|
|
dp.add_handler(CommandHandler("simon", simon)) |
|
|
dp.add_handler(CommandHandler("simon", simon)) |
|
|
|
|
|
dp.add_handler(CommandHandler("graveyard", graveyard)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# log all errors |
|
|
# log all errors |
|
@ -283,4 +306,3 @@ def main(): |
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
if __name__ == '__main__': |
|
|
main() |
|
|
main() |
|
|
|
|
|
|