fixing recursion issues
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import requests
|
||||
import datetime
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
class WeatherFetch():
|
||||
def __init__(self, key):
|
||||
self.last_fetch = datetime.datetime.fromtimestamp(0)
|
||||
self.last_weather = ""
|
||||
self.calls = 0
|
||||
|
||||
self.url = "https://api.openweathermap.org/data/2.5/onecall?"
|
||||
self.key = key
|
||||
@@ -15,6 +18,8 @@ class WeatherFetch():
|
||||
|
||||
|
||||
data = {"lat" : location[0], "lon" : location[1], "exclude" : "minutely,hourly", "appid" : self.key, "units" : "metric"}
|
||||
self.calls += 1
|
||||
logger.info("Just fetched weather. ({}th time)".format(self.calls))
|
||||
# today = datetime.datetime.today().weekday()
|
||||
# days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
|
||||
|
||||
|
@@ -26,7 +26,6 @@ class Alias(BotFunc):
|
||||
|
||||
def entry_point(self, update: Update, context: CallbackContext) -> None:
|
||||
test = self.dispatcher
|
||||
print(self.dispatcher.handlers[0])
|
||||
keyboard = [
|
||||
[InlineKeyboardButton("All aliases", callback_data="all")],
|
||||
[InlineKeyboardButton("Create new alias", callback_data="new")],
|
||||
|
@@ -163,7 +163,6 @@ class Lists(BotFunc):
|
||||
item = update.message.text
|
||||
it = self.db.lists.get(self.db.lists.name == self.current_name)
|
||||
sl = it.content
|
||||
print("SLSLLLL: {} -- {}".format(sl, type(sl)))
|
||||
sl += item + "<-->"
|
||||
self.db.lists.update(content=sl).where(self.db.lists.name == self.current_name).execute()
|
||||
|
||||
|
@@ -83,7 +83,7 @@ class Status(BotFunc):
|
||||
query = update.callback_query
|
||||
wanted = query.data.replace("status-","")
|
||||
query.answer()
|
||||
with open("persistence/complete.log") as l:
|
||||
with open("persistence/server.log") as l:
|
||||
query.message.reply_document(l)
|
||||
|
||||
super().log_activity(read = False, execute = False, send = True)
|
||||
|
Reference in New Issue
Block a user