dynamic pasta
This commit is contained in:
parent
a310b7dd4e
commit
e3b808324e
15
kaybot.py
15
kaybot.py
|
@ -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()
|
||||||
|
|
|
@ -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.
|
|
@ -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!
|
||||||
|
|
Loading…
Reference in New Issue