Mercurial Hosting > disearch
view src/private/tools/config_save.txt.luan @ 16:552d6f944acb
add bump
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 01 Nov 2023 17:34:15 -0600 |
parents | 43814e9f5802 |
children |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local stringify = Luan.stringify or error() local Parsers = require "luan:Parsers.luan" local json_string = Parsers.json_string or error() local Io = require "luan:Io.luan" local uri = Io.uri or error() local Http = require "luan:http/Http.luan" local Config = require "site:/lib/Config.luan" local Logging = require "luan:logging/Logging.luan" local logger = Logging.logger "config_save.txt" local function set_cmd() local config = Config.get() local url = "https://discord.com/api/applications/"..config.discord.client_id.."/commands" local options = { method = "POST" headers = { ["User-Agent"] = "Disearch" -- for retarded Cloudflare Authorization = "Bot "..config.discord.bot_token ["Content-Type"] = "application/json" } content = json_string{ type = 1 name = "dbump" description = "Bump this server in Disearch." } } local result = uri(url,options).read_text() logger.info(result) end return function() local config = Http.request.parameters.config or error() Config.set(config) -- set_cmd() don't do this Io.stdout = Http.response.text_writer() %>saved<% end