mirror of
https://github.com/Lynnesbian/FediBooks/
synced 2024-11-25 08:38:59 +00:00
message generation for bot chat
This commit is contained in:
parent
170a666496
commit
60728c0b35
2 changed files with 15 additions and 7 deletions
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue