This commit is contained in:
Mint 2022-09-10 19:35:43 +03:00
parent d140e34055
commit 5d61b6a5e6

View file

@ -11,8 +11,6 @@ def parse_args():
return utils.arg_parser_factory(description='Reply service. Leave running in the background.').parse_args()
class ReplyBot:
PAIRED_PUNCTUATION = re.compile(r"[{}]".format(re.escape('[](){}"‘’“”«»„')))
def __init__(self, cfg):
self.cfg = cfg
self.pleroma = pleroma.Pleroma(access_token=cfg['access_token'], api_base_url=cfg['site'])
@ -71,6 +69,7 @@ class ReplyBot:
await self.pleroma.react(post_id, '')
async def reply(self, notification):
PAIRED_PUNCTUATION = re.compile(r"[{}]".format(re.escape('[](){}"‘’“”«»„')))
toot = await utils.make_post(self.cfg) # generate a toot
if self.cfg['strip_paired_punctuation']:
toot = PAIRED_PUNCTUATION.sub("", toot)