mirror of
https://git.kiwifarms.net/mint/ebooks.git
synced 2024-10-23 01:29:05 +00:00
Or not
This commit is contained in:
parent
67a7a48a41
commit
448729bac3
1 changed files with 3 additions and 3 deletions
6
reply.py
6
reply.py
|
@ -31,7 +31,7 @@ class ReplyBot:
|
||||||
if self.check_thread_length(context):
|
if self.check_thread_length(context):
|
||||||
return
|
return
|
||||||
|
|
||||||
content = self.extract_toot(notification['status']['content'])
|
content = self.extract_toot(notification['status']['content'], self.cfg)
|
||||||
if content in {'pin', 'unpin'}:
|
if content in {'pin', 'unpin'}:
|
||||||
await self.process_command(context, notification, content)
|
await self.process_command(context, notification, content)
|
||||||
else:
|
else:
|
||||||
|
@ -73,10 +73,10 @@ class ReplyBot:
|
||||||
await self.pleroma.reply(notification['status'], toot, cw=self.cfg['cw'])
|
await self.pleroma.reply(notification['status'], toot, cw=self.cfg['cw'])
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def extract_toot(toot):
|
def extract_toot(toot, cfg):
|
||||||
text = utils.extract_post_content(toot)
|
text = utils.extract_post_content(toot)
|
||||||
text = re.sub(r"^@\S+\s", r"", text) # remove the initial mention
|
text = re.sub(r"^@\S+\s", r"", text) # remove the initial mention
|
||||||
text = utils.remove_mentions(self.cfg, text)
|
text = utils.remove_mentions(cfg, text)
|
||||||
text = text.lower() # treat text as lowercase for easier keyword matching (if this bot uses it)
|
text = text.lower() # treat text as lowercase for easier keyword matching (if this bot uses it)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue