def set_hooks(request): data = _get_data(request) hook_config = DiscordHookConfig(for_type=data["name"]) hook_config.set_hooks(data["hooks"]) return api_response( result=DiscordHookConfig.get_all_hook_types(), command="get_hooks", failed=False, )
def get_prepared_discord_hooks(type) -> List[DiscordWebhook]: config = DiscordHookConfig(type) hooks = config.get_hooks() return [ DiscordWebhook( url=hook.hook, allowed_mentions=make_allowed_mentions(hook.roles), content=" ".join(hook.roles), ) for hook in hooks.hooks ]
def get_hooks(request): return api_response( result=DiscordHookConfig.get_all_hook_types(as_dict=True), command="get_hooks", failed=False, )