mirror of
https://github.com/ioistired/pleroma-ebooks.git
synced 2024-11-20 02:14:52 +01:00
add an option to avoid creating fake mentions
This commit is contained in:
parent
99d1d13fbf
commit
02343668b8
12
README.md
12
README.md
@ -11,6 +11,18 @@ This version makes quite a few changes from [the original](https://github.com/Je
|
||||
## Install/usage guide
|
||||
An installation and usage guide is available [here](https://cloud.lynnesbian.space/s/jozbRi69t4TpD95). It's primarily targeted at Linux, but it should be possible on BSD, macOS, etc. I've also put some effort into providing steps for Windows, but I can't make any guarantees as to its effectiveness.
|
||||
|
||||
## Configuration
|
||||
Configuring mstdn-ebooks is accomplished by editing `config.json`.
|
||||
|
||||
| Setting | Default | Meaning |
|
||||
|--------------------|------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| site | https://botsin.space | The instance your bot will log in to and post from. |
|
||||
| cw | null | The content warning (aka subject) mstdn-ebooks will apply to non-error posts. |
|
||||
| instance_blacklist | ["bofa.lol", "witches.town"] | If your bot is following someone from a blacklisted instance, it will skip over them and not download their posts. This is useful for ensuring that mstdn-ebooks doesn't download posts from dead instances, without you having to unfollow the user(s) from them. |
|
||||
| learn_from_cw | false | If true, mstdn-ebooks will learn from CW'd posts. |
|
||||
| mention_handling | 1 | 0: Never use mentions. 1: Only generate fake mentions in the middle of posts, never at the start. 2: Use mentions as normal (old behaviour). |
|
||||
|
||||
|
||||
## Original README
|
||||
hey look it's an ebooks bot
|
||||
|
||||
|
@ -2,5 +2,6 @@
|
||||
"lang": "en",
|
||||
"site": "https://botsin.space",
|
||||
"cw": null,
|
||||
"learn_from_cw": false
|
||||
"learn_from_cw": false,
|
||||
"mention_handling": 1
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ def make_sentence(output):
|
||||
else:
|
||||
toots = c.execute("SELECT content FROM `toots` WHERE cw = 0 ORDER BY RANDOM() LIMIT 10000").fetchall()
|
||||
toots_str = ""
|
||||
for toot in toots:
|
||||
for toot in toots: # TODO: find a more efficient way to do this
|
||||
toots_str += "\n{}".format(toot[0])
|
||||
model = nlt_fixed(toots_str)
|
||||
toots_str = None
|
||||
@ -36,7 +36,11 @@ def make_sentence(output):
|
||||
sentence = model.make_short_sentence(500, tries=10000)
|
||||
tries = tries + 1
|
||||
|
||||
sentence = re.sub("^(?:@\u202B[^ ]* )*", "", sentence) #remove leading pings (don't say "@bob blah blah" but still say "blah @bob blah")
|
||||
# optionally remove mentions
|
||||
if cfg['mention_handling'] == 1:
|
||||
sentence = re.sub(r"^\S*@\u200B\S*\s?", "")
|
||||
elif cfg['mention_handling'] == 0:
|
||||
sentence = re.sub(r"\S*@\u200B\S*\s?", "")
|
||||
|
||||
output.send(sentence)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user