mirror of
https://github.com/RGBCube/bonfire.v
synced 2025-07-28 22:47:45 +00:00
Add repo_url to v.mod & Use markdown for license
This commit is contained in:
parent
2ff93821b7
commit
abbdece86f
3 changed files with 32 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
||||||
MIT License
|
# MIT License
|
||||||
|
|
||||||
Copyright (c) 2022-present RGBCube
|
Copyright (c) 2022-present RGBCube
|
||||||
|
|
30
src/rest/client.v
Normal file
30
src/rest/client.v
Normal file
|
@ -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
|
||||||
|
})!
|
||||||
|
}
|
1
v.mod
1
v.mod
|
@ -3,5 +3,6 @@ Module {
|
||||||
description: 'A Discord API wrapper for the V programming language.'
|
description: 'A Discord API wrapper for the V programming language.'
|
||||||
version: '0.0.1'
|
version: '0.0.1'
|
||||||
license: 'MIT'
|
license: 'MIT'
|
||||||
|
repo_url: 'https://github.com/RGBCube/bonfire.v'
|
||||||
dependencies: []
|
dependencies: []
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue