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))
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user