1
0
Fork 0
mirror of https://github.com/Lynnesbian/FediBooks/ synced 2024-12-27 23:08:58 +00:00

message generation for bot chat

This commit is contained in:
Lynne Megido 2020-01-20 13:01:56 +10:00
parent 170a666496
commit 60728c0b35
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90
2 changed files with 15 additions and 7 deletions

View file

@ -63,12 +63,6 @@ def generate_output(handle):
""", (handle,))
bot = dc.fetchone()
client = Mastodon(
client_id = bot['client_id'],
client_secret = bot['client_secret'],
access_token = bot['secret'],
api_base_url = "https://{}".format(handle.split("@")[2])
)
# by default, only select posts that don't have CWs.
# if learn_from_cw, then also select posts with CWs
@ -133,6 +127,13 @@ def make_post(args):
acct = args[3]
handle = args[0]
client = Mastodon(
client_id = bot['client_id'],
client_secret = bot['client_secret'],
access_token = bot['secret'],
api_base_url = "https://{}".format(handle.split("@")[2])
)
bot, post = generate_output(handle)
# print(post)

View file

@ -160,7 +160,14 @@ def bot_toggle(id):
@app.route("/bot/chat/<id>")
def bot_chat(id):
# return render_template("coming_soon.html")
return render_template("/bot/chat.html", bot = id)
if bot_check(id):
return render_template("/bot/chat.html", bot = id)
@app.route("/bot/chat/<id>/message")
def bot_chat_message(id):
if bot_check(id):
_, message = functions.generate_output(id)
return message
@app.route("/bot/blacklist/<id>")
def bot_blacklist(id):