dynamic pasta

This commit is contained in:
Kay Faraday 2023-02-05 01:59:56 +00:00
parent a310b7dd4e
commit e3b808324e
3 changed files with 16 additions and 2 deletions

View File

@ -4,6 +4,7 @@ from pleroma_bot import PleromaBot
from mastodon import Mastodon from mastodon import Mastodon
from pathlib import Path from pathlib import Path
import qtoml as toml import qtoml as toml
import urllib.parse
with open('config.toml') as f: with open('config.toml') as f:
config = toml.load(f) config = toml.load(f)
@ -18,13 +19,25 @@ def ping(notif, *_):
pastas = {p.stem: p.read_text() for p in Path('pasta').glob('*.txt')} pastas = {p.stem: p.read_text() for p in Path('pasta').glob('*.txt')}
home_instance = urllib.parse.urlparse(config['creds']['api_base_url']).netloc
def get_instance(fqn):
username, at, instance = fqn.partition('@')
if not at:
return home_instance
return instance
@bot.command @bot.command
def pasta(notif, pasta_name='', *_): def pasta(notif, pasta_name='', *_):
"""Pulls up a copypasta. Run with no arguments to get a list of available copypastas.""" """Pulls up a copypasta. Run with no arguments to get a list of available copypastas."""
if not pasta_name: if not pasta_name:
pleroma.status_reply(notif['status'], f'Available copypasta: {", ".join(pastas)}') pleroma.status_reply(notif['status'], f'Available copypasta: {", ".join(pastas)}')
else: else:
pleroma.status_reply(notif['status'], pastas[pasta_name]) acc = notif['status']['account']
formatted = pastas[pasta_name].format(
username=acc['username'],
instance=get_instance(acc['acct']),
)
pleroma.status_reply(notif['status'], formatted)
if __name__ == '__main__': if __name__ == '__main__':
bot.run() bot.run()

1
pasta/dni.txt Normal file
View File

@ -0,0 +1 @@
Idk what's so hard to understand about this, but {instance} users do not fucking interact. I don't want to see your bullshit. I have "{instance} users dni" in my bio for a reason, jesus fucking christ. Any {instance} user that follows me will be blocked immediately, so act wisely. Yall are once again showing that you have no concept of littleboy.love.

View File

@ -1 +1 @@
I fucking love porn and hentai, I spend everyday when I;m not at work masturbating, I want to see more porn and hentai and I want it to fill me entire day. I know freak.university is filled with some of the most depraved people on the internet and I want in on it, please! I fucking love porn and hentai, I spend everyday when I;m not at work masturbating, I want to see more porn and hentai and I want it to fill me entire day. I know {instance} is filled with some of the most depraved people on the internet and I want in on it, please!