named some damn properties wrong
This commit is contained in:
parent
67b4d949fd
commit
8918b5205d
5 changed files with 18 additions and 7 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -186,4 +186,4 @@ gacha_game*.db
|
||||||
gacha_game*.db.*
|
gacha_game*.db.*
|
||||||
config*.ini
|
config*.ini
|
||||||
|
|
||||||
.idea
|
.idea
|
||||||
|
|
|
@ -11,7 +11,7 @@ def stream_notifications():
|
||||||
|
|
||||||
# Get the last seen notification ID from the database
|
# Get the last seen notification ID from the database
|
||||||
last_seen_id = get_config("last_seen_notif_id")
|
last_seen_id = get_config("last_seen_notif_id")
|
||||||
whitelisted_instances = getattr(config, 'WHITELISTED_INSTANCES', [])
|
whitelisted_instances = getattr(config, 'TRUSTED_INSTANCES', [])
|
||||||
|
|
||||||
print('Listening for notifications...')
|
print('Listening for notifications...')
|
||||||
while True:
|
while True:
|
||||||
|
|
|
@ -54,6 +54,10 @@ INSTANCE_TYPE = instance_type
|
||||||
# Web server port
|
# Web server port
|
||||||
WEB_PORT = config['application'].getint('WebPort', 5000)
|
WEB_PORT = config['application'].getint('WebPort', 5000)
|
||||||
|
|
||||||
|
# Trusted instances
|
||||||
|
trusted_instances_str = config['application'].get('TrustedInstances', '')
|
||||||
|
TRUSTED_INSTANCES = [instance.strip() for instance in trusted_instances_str.split(',') if instance.strip()]
|
||||||
|
|
||||||
# Extra stuff for control of the bot
|
# Extra stuff for control of the bot
|
||||||
|
|
||||||
# TODO: move this to db
|
# TODO: move this to db
|
||||||
|
|
|
@ -99,9 +99,12 @@ class MisskeyService(FediverseService):
|
||||||
|
|
||||||
def get_notifications(self, since_id: Optional[str] = None) -> List[FediverseNotification]:
|
def get_notifications(self, since_id: Optional[str] = None) -> List[FediverseNotification]:
|
||||||
"""Get notifications from Misskey instance"""
|
"""Get notifications from Misskey instance"""
|
||||||
params = {}
|
params = {
|
||||||
|
'include_types': ['mention', 'reply'],
|
||||||
|
'limit': 50
|
||||||
|
}
|
||||||
if since_id:
|
if since_id:
|
||||||
params["sinceId"] = since_id
|
params["since_id"] = since_id
|
||||||
|
|
||||||
notifications = self.client.i_notifications(**params)
|
notifications = self.client.i_notifications(**params)
|
||||||
return [self._convert_misskey_notification(notif) for notif in notifications]
|
return [self._convert_misskey_notification(notif) for notif in notifications]
|
||||||
|
@ -121,13 +124,13 @@ class MisskeyService(FediverseService):
|
||||||
}
|
}
|
||||||
|
|
||||||
if reply_to_id:
|
if reply_to_id:
|
||||||
params["replyId"] = reply_to_id
|
params["reply_id"] = reply_to_id
|
||||||
|
|
||||||
if file_ids:
|
if file_ids:
|
||||||
params["fileIds"] = file_ids
|
params["file_ids"] = file_ids
|
||||||
|
|
||||||
if visible_user_ids and visibility == Visibility.SPECIFIED:
|
if visible_user_ids and visibility == Visibility.SPECIFIED:
|
||||||
params["visibleUserIds"] = visible_user_ids
|
params["visible_user_ids"] = visible_user_ids
|
||||||
|
|
||||||
response = self.client.notes_create(**params)
|
response = self.client.notes_create(**params)
|
||||||
return response.get("createdNote", {}).get("id", "")
|
return response.get("createdNote", {}).get("id", "")
|
||||||
|
|
|
@ -38,3 +38,7 @@ InstanceType = misskey
|
||||||
|
|
||||||
; Web server port (default: 5000)
|
; Web server port (default: 5000)
|
||||||
WebPort = 5000
|
WebPort = 5000
|
||||||
|
|
||||||
|
; Comma-separated list of trusted fediverse instances (leave empty to allow only local users)
|
||||||
|
; Example: TrustedInstances = mastodon.social,misskey.io,pleroma.example.com
|
||||||
|
TrustedInstances =
|
||||||
|
|
Loading…
Add table
Reference in a new issue