multiple changes
This commit is contained in:
16
test2.py
16
test2.py
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user