Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
pwm
b1b3f62d37 begin restructuring bot's fediverse client code 2025-06-07 17:39:59 -04:00

View file

@ -1,6 +1,45 @@
from abc import abstractmethod
from typing import Iterable, override
import misskey
import config
class FediverseNote:
"""Abstraction for notes Use this to talk to per-software implementations"""
def __init__(self, note):
pass
def client_connection() -> misskey.Misskey:
return misskey.Misskey(address=config.INSTANCE, i=config.KEY)
class FediverseClient:
def __init__(self, instance, software):
self.instance = instance
self.software = software
@abstractmethod
def get_notifications(self) -> Iterable[FediverseNote]:
"""Page through notifications from the instance"""
pass
@abstractmethod
def create_note(self, text, visibility, addressee, attachment):
"""Create a new note"""
pass
class MisskeyClient(FediverseClient):
def __init__(self, instance, software):
super().__init__(instance, software)
def get_notifications(self) -> Iterable[FediverseNote]:
pass
def create_note(self, text, visibility, addressee, attachment):
pass
class PleromaClient(FediverseClient):
def __init__(self, instance, software):
super().__init__(instance, software)
def get_notifications(self) -> Iterable[FediverseNote]:
pass
def create_note(self, text, visibility, addressee, attachment):
pass