mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Add model option
This commit is contained in:
parent
accbb89880
commit
210fc306c4
@ -555,20 +555,23 @@ class HelpersWebhooks:
|
||||
return model_to_dict(Webhooks.get(Webhooks.id == webhook_id))
|
||||
|
||||
@staticmethod
|
||||
def get_webhooks_by_server(server_id):
|
||||
data = {}
|
||||
for webhook in (
|
||||
Webhooks.select().where(Webhooks.server_id == server_id).execute()
|
||||
):
|
||||
data[str(webhook.id)] = {
|
||||
"webhook_type": webhook.webhook_type,
|
||||
"name": webhook.name,
|
||||
"url": webhook.url,
|
||||
"bot_name": webhook.bot_name,
|
||||
"trigger": webhook.trigger,
|
||||
"body": webhook.body,
|
||||
"enabled": webhook.enabled,
|
||||
}
|
||||
def get_webhooks_by_server(server_id, model):
|
||||
if not model:
|
||||
data = {}
|
||||
for webhook in (
|
||||
Webhooks.select().where(Webhooks.server_id == server_id).execute()
|
||||
):
|
||||
data[str(webhook.id)] = {
|
||||
"webhook_type": webhook.webhook_type,
|
||||
"name": webhook.name,
|
||||
"url": webhook.url,
|
||||
"bot_name": webhook.bot_name,
|
||||
"trigger": webhook.trigger,
|
||||
"body": webhook.body,
|
||||
"enabled": webhook.enabled,
|
||||
}
|
||||
else:
|
||||
data = Webhooks.select().where(Webhooks.server_id == server_id).execute()
|
||||
return data
|
||||
|
||||
@staticmethod
|
||||
|
Loading…
Reference in New Issue
Block a user