https://github.com/kibook/discord_rest
Discord REST API utility for FiveM and RedM
https://github.com/kibook/discord_rest
citizenfx discord fivem redm
Last synced: 5 months ago
JSON representation
Discord REST API utility for FiveM and RedM
- Host: GitHub
- URL: https://github.com/kibook/discord_rest
- Owner: kibook
- Created: 2021-08-31T19:14:58.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-29T20:06:31.000Z (over 2 years ago)
- Last Synced: 2023-11-29T21:25:17.194Z (over 2 years ago)
- Topics: citizenfx, discord, fivem, redm
- Language: Lua
- Homepage: https://kibook.github.io/discord_rest
- Size: 189 KB
- Stars: 15
- Watchers: 3
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# discord_rest
Discord REST API utility for FiveM and RedM.
# Features
- Easy Discord interaction from any resource.
- Promise-based asynchronous export functions.
- Actions are handled in a queue to prevent rate limiting.
# Examples
## Execute a webhook
```lua
-- Print "Hello, world!" in a Discord channel via a webhook
exports.discord_rest:executeWebhookUrl("https://discord.com/api/webhook/.../...", {content = "Hello, world!"})
```
## Get messages from a channel
```lua
-- Get the last 10 messages from a channel and print them
exports.discord_rest:getChannelMessages(channelId, {limit = 10}, botToken):next(function(messages)
for _, message in ipairs(messages) do
print(message.author.username .. ": " .. message.content)
end
end)
```
## Get user info
```lua
-- Get a player's name on Discord
local playerName = GetPlayerName(player)
exports.discord_rest:getUserForPlayer(player):next(function(user)
print(playerName .. " is called " .. user.username .. " on Discord")
end, function(err)
print(playerName .. " does not have Discord connected")
end)
```