Add model option

This commit is contained in:
amcmanu3 2023-06-03 18:11:20 -04:00
parent accbb89880
commit 210fc306c4

View File

@ -555,20 +555,23 @@ class HelpersWebhooks:
return model_to_dict(Webhooks.get(Webhooks.id == webhook_id)) return model_to_dict(Webhooks.get(Webhooks.id == webhook_id))
@staticmethod @staticmethod
def get_webhooks_by_server(server_id): def get_webhooks_by_server(server_id, model):
data = {} if not model:
for webhook in ( data = {}
Webhooks.select().where(Webhooks.server_id == server_id).execute() for webhook in (
): Webhooks.select().where(Webhooks.server_id == server_id).execute()
data[str(webhook.id)] = { ):
"webhook_type": webhook.webhook_type, data[str(webhook.id)] = {
"name": webhook.name, "webhook_type": webhook.webhook_type,
"url": webhook.url, "name": webhook.name,
"bot_name": webhook.bot_name, "url": webhook.url,
"trigger": webhook.trigger, "bot_name": webhook.bot_name,
"body": webhook.body, "trigger": webhook.trigger,
"enabled": webhook.enabled, "body": webhook.body,
} "enabled": webhook.enabled,
}
else:
data = Webhooks.select().where(Webhooks.server_id == server_id).execute()
return data return data
@staticmethod @staticmethod