diff --git a/LICENSE b/LICENSE.md similarity index 98% rename from LICENSE rename to LICENSE.md index 8fd1bb8..6c8625b 100644 --- a/LICENSE +++ b/LICENSE.md @@ -1,4 +1,4 @@ -MIT License +# MIT License Copyright (c) 2022-present RGBCube diff --git a/src/rest/client.v b/src/rest/client.v new file mode 100644 index 0000000..e7b967e --- /dev/null +++ b/src/rest/client.v @@ -0,0 +1,30 @@ +module rest + +import net.http + +const ratelimit_timeout = 30 + +[heap] +struct RestClient { + token string +} + +[params] +struct RequestParams { + method string + url string + data string +} + +fn (r RestClient) request(p RequestParams) !http.Response { + return http.fetch(http.FetchConfig{ + url: 'https://discord.com/api/v10' + p.url + method: p.method + header: http.new_header_from_map({ + http.CommonHeader.authorization: 'Bot ${r.token}' + http.CommonHeader.content_type: 'application/json' + http.CommonHeader.user_agent: 'DiscordBot (https://github.com/RGBCube/bonfire.v, 0.0.1) V/${@VHASH}' + }) + data: p.data + })! +} diff --git a/v.mod b/v.mod index 64d8b67..a28fecd 100644 --- a/v.mod +++ b/v.mod @@ -3,5 +3,6 @@ Module { description: 'A Discord API wrapper for the V programming language.' version: '0.0.1' license: 'MIT' + repo_url: 'https://github.com/RGBCube/bonfire.v' dependencies: [] }