-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- debug improvements for MoveToMap (#4860)
- fix for Telegram to accept "@username" as "master", too, along with numeric IDs
- Loading branch information
Showing
4 changed files
with
56 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
from pokemongo_bot.event_manager import EventHandler | ||
import thread | ||
import re | ||
|
||
DEBUG_ON = False | ||
|
||
|
@@ -9,15 +10,23 @@ def __init__(self, tbot,master,pokemons): | |
self.tbot = tbot | ||
self.master=master | ||
self.pokemons=pokemons | ||
self.whoami="TelegramHandler" | ||
|
||
def handle_event(self, event, sender, level, formatted_msg, data): | ||
if self.master: | ||
if not re.match(r'^[0-9]+$', str(self.master)): | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
askovpen
Contributor
|
||
return | ||
master = self.master | ||
|
||
if event == 'level_up': | ||
self.tbot.sendMessage(chat_id=self.master, parse_mode='Markdown', text="level up ({})".format(data["current_level"])) | ||
msg = "level up ({})".format(data["current_level"]) | ||
elif event == 'pokemon_caught': | ||
if data["pokemon"] in self.pokemons or self.pokemons[0]=="all": | ||
self.tbot.sendMessage(chat_id=self.master, parse_mode='Markdown', | ||
text="Caught {} CP: {}, IV: {}".format(data["pokemon"],data["cp"],data["iv"]) | ||
) | ||
msg = "Caught {} CP: {}, IV: {}".format(data["pokemon"],data["cp"],data["iv"]) | ||
else: | ||
return | ||
else: | ||
return | ||
self.tbot.sendMessage(chat_id=master, parse_mode='Markdown', text=msg) | ||
|
||
|
God damnit, stop messing with this logic. This is the third time someone breaks it.