Compare commits
2 commits
96e575edba
...
79038a0e00
Author | SHA1 | Date | |
---|---|---|---|
79038a0e00 | |||
e03e2ad4b5 |
2 changed files with 4 additions and 2 deletions
2
login.py
2
login.py
|
@ -2,7 +2,7 @@
|
||||||
import json
|
import json
|
||||||
from mastodon import Mastodon
|
from mastodon import Mastodon
|
||||||
|
|
||||||
scopes = ["read:statuses", "read:accounts", "read:follows", "write:statuses"]
|
scopes = ["read:statuses", "read:accounts", "read:follows", "write:statuses", "read:notifications"]
|
||||||
cfg = json.load(open('config.json', 'r'))
|
cfg = json.load(open('config.json', 'r'))
|
||||||
|
|
||||||
if "client" not in cfg:
|
if "client" not in cfg:
|
||||||
|
|
4
main.py
4
main.py
|
@ -61,11 +61,13 @@ class ReplyListener(mastodon.StreamListener):
|
||||||
result = j['results'][0]
|
result = j['results'][0]
|
||||||
toot = result['title'] + "\n" + result['url'] + "\n" + result['content'] + "\n" + "(Score: {})\nMore results: {}{}".format(result['score'], "https://searx.lynnesbian.space/?q=", q.replace(" ", "%20"))
|
toot = result['title'] + "\n" + result['url'] + "\n" + result['content'] + "\n" + "(Score: {})\nMore results: {}{}".format(result['score'], "https://searx.lynnesbian.space/?q=", q.replace(" ", "%20"))
|
||||||
|
|
||||||
|
toot = toot.replace("@", "@\u200B") # don't @ people
|
||||||
|
|
||||||
toot = acct + " " + toot
|
toot = acct + " " + toot
|
||||||
visibility = notification['status']['visibility']
|
visibility = notification['status']['visibility']
|
||||||
if visibility == "public":
|
if visibility == "public":
|
||||||
visibility = "unlisted"
|
visibility = "unlisted"
|
||||||
client.status_post(toot, post_id, visibility=visibility)
|
client.status_post(toot, post_id, visibility=visibility, spoiler_text = "Search result")
|
||||||
print("replied with " + toot)
|
print("replied with " + toot)
|
||||||
|
|
||||||
rl = ReplyListener()
|
rl = ReplyListener()
|
||||||
|
|
Loading…
Reference in a new issue