2022-12-20 16:36:48 -08:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
from pleroma_bot import PleromaBot
|
|
|
|
from mastodon import Mastodon
|
2022-12-20 16:59:28 -08:00
|
|
|
from pathlib import Path
|
2022-12-20 16:36:48 -08:00
|
|
|
import qtoml as toml
|
|
|
|
|
|
|
|
with open('config.toml') as f:
|
|
|
|
config = toml.load(f)
|
|
|
|
|
|
|
|
pleroma = Mastodon(**config['creds'])
|
|
|
|
bot = PleromaBot(pleroma, about='I am a basic bot created by https://freak.university/@KayFaraday. I only run when summoned.')
|
|
|
|
|
|
|
|
@bot.command
|
|
|
|
def ping(notif, *_):
|
|
|
|
"""Replies with “pong”"""
|
|
|
|
pleroma.status_reply(notif['status'], 'Pong!')
|
|
|
|
|
2022-12-20 16:59:28 -08:00
|
|
|
pastas = {p.stem: p.read_text() for p in Path('pasta').glob('*.txt')}
|
|
|
|
|
|
|
|
@bot.command
|
|
|
|
def pasta(notif, pasta_name=''):
|
|
|
|
"""Pulls up a copypasta. Run with no arguments to get a list of available copypastas."""
|
|
|
|
if not pasta_name:
|
|
|
|
pleroma.status_reply(notif['status'], f'Available copypasta: {", ".join(pastas)}')
|
|
|
|
else:
|
|
|
|
pleroma.status_reply(notif['status'], pastas[pasta_name])
|
|
|
|
|
2022-12-20 16:36:48 -08:00
|
|
|
if __name__ == '__main__':
|
|
|
|
bot.run()
|