simple stuff
This commit is contained in:
parent
3d2c56b37e
commit
04726d77c1
2 changed files with 6 additions and 8 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
data.json
|
data.json
|
||||||
|
session.txt
|
11
main.py
11
main.py
|
@ -32,7 +32,7 @@ async def faq(room, message):
|
||||||
|
|
||||||
|
|
||||||
@bot.listener.on_custom_event(nio.InviteMemberEvent)
|
@bot.listener.on_custom_event(nio.InviteMemberEvent)
|
||||||
async def autofaq(room, event):
|
async def example(room, event):
|
||||||
if event.membership == "join":
|
if event.membership == "join":
|
||||||
await bot.api.send_markdown_message(
|
await bot.api.send_markdown_message(
|
||||||
room.room_id,
|
room.room_id,
|
||||||
|
@ -50,17 +50,14 @@ async def faqresponse(room, message):
|
||||||
if match.is_not_from_this_bot():
|
if match.is_not_from_this_bot():
|
||||||
response = ""
|
response = ""
|
||||||
questions = get_questions()
|
questions = get_questions()
|
||||||
print("Message:",message)
|
|
||||||
for q in questions:
|
for q in questions:
|
||||||
if sum([ 1 for kp in q["key_phrases"] if kp in message.body]) == len(q["key_phrases"]):
|
if sum([ 1 for kp in q["key_phrases"] if kp in message.body]) == len(q["key_phrases"]):
|
||||||
response = response + q["question"] + "\n" + q["answer"]+"\n"
|
response += q["question"] + "\n" + q["answer"]+"\n"
|
||||||
if response != "":
|
if response != "":
|
||||||
await bot.api.send_markdown_message(
|
await bot.api.send_markdown_message(
|
||||||
room.room_id,
|
room.room_id,
|
||||||
response
|
response + dfaq["footer"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bot.run()
|
bot.run()
|
||||||
|
|
Loading…
Reference in a new issue