Skip to content

Commit

Permalink
/delbot command
Browse files Browse the repository at this point in the history
  • Loading branch information
Phash committed Sep 28, 2016
1 parent 3dffea5 commit e52a4a4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion webhook_master_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, token, server, baseurl, cert=None):
except Exception:
db.bots.delete(b.id)
continue
sleep(10)
sleep(1)
sub_bot.set_webhook(
url=baseurl + 'proxybot/' + sub_bot.token,
certificate=cert
Expand Down Expand Up @@ -63,6 +63,17 @@ def start(message):
Semd me api_token and I will spawn an proxy_bot for you.
More info at https://github.com/p-hash/proxybot''')

@bot.message_handler(commands=['delbot'])
def del_bot(message):
b = db.bots.get_by_master(message.from_user.id)
if b:
sub_bots.pop(b.token, None)
db.bots.delete(b.id)
bot.reply_to(message, "Your bot was deleted. If you still cant create new one -- contact @phash_bot")
else:
bot.reply_to(message, "You dont have your own ProxyBot yet.")


@bot.message_handler()
def check_token(message):
if message.chat.type != 'private':
Expand Down

0 comments on commit e52a4a4

Please sign in to comment.