multiple changes

This commit is contained in:
www
2021-01-11 18:45:03 +00:00
parent 14ca632137
commit 3d3474a2e1
24 changed files with 3517 additions and 83 deletions

View File

@@ -21,29 +21,27 @@ import internfiles
#logging.basicConfig(level=logging.INFO)
URL_HOSTNAME='bot.2020.fet.at'
os.environ['URL_HOSTNAME']='bot.2020.fet.at'
app=Flask(__name__)
chat_id='108021014'
os.environ['URL_HOSTNAME'] = 'bot.2020.fet.at'
app = Flask(__name__)
chat_id = '108021014'
bot = Teleflask(API_KEY)
bot.init_app(app)
chats=ChatManager(bot.bot)
solr=SolrFet2020()
#app.config['SERVER_NAME'] = 'bot.2020.fet.at'
@app.route('/')
def home():
query=request.args.get("query")
if query:
links,hits=solr.search(query)
links,_=solr.search(query)
else:
links=None
return render_template("search.html", query=query, results=links)
@app.route('/send/<text>')
def send(text=None):
bot.bot.send_message(chat_id, text)
return "Text: %s <br> %s" % (text,request.headers)
@app.route('/send/<chat_id>/<text>')
def send_to(chat_id,text=None):
@@ -83,7 +81,7 @@ def download_file(url):
def bot_update(update):
from pytgbot.api_types.receivable.updates import Update
assert isinstance(update, Update)
if not isinstance(update, Update): raise TypeError("Update needs to be of Type update")
print(yaml.dump(update.to_array()))
chats.process_update(update)