Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrgriefs/discord.js-fivem
Integrates FiveM server & player data with Discord.js
https://github.com/mrgriefs/discord.js-fivem
discord discord-js discordjs fivem fivem-server
Last synced: 16 days ago
JSON representation
Integrates FiveM server & player data with Discord.js
- Host: GitHub
- URL: https://github.com/mrgriefs/discord.js-fivem
- Owner: MrGriefs
- License: mit
- Created: 2021-09-05T11:33:19.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-05T23:33:24.000Z (over 3 years ago)
- Last Synced: 2024-12-16T23:20:32.500Z (about 2 months ago)
- Topics: discord, discord-js, discordjs, fivem, fivem-server
- Language: JavaScript
- Homepage:
- Size: 383 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Discord.js FiveM
## Table of Contents
- [About](#about)
- [Installation](#installation)
- [Example](#example)
- [Documentation](#documentation)## About
discord.js-fivem allows you to intergrate your FiveM server's data with Discord.js, allowing you to monitor your server's players, availability and ping.
## Installation
With npm:
```bash
$ npm install discord.js-fivem
```With yarn:
```bash
$ yarn add discord.js-fivem
```## Example
In the file containing client.login:
```javascript
const { Client } = require('discord.js-fivem');
const { Intents } = require('discord.js');const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
]
})client.on('ready', async () => {
// fetch your server. the server data will automatically refetch after 2 minutes
const server = await client.servers.fetch('734okr', {
cache: true, // whether to cache this server
force: false, // whether to fetch from fivem even if it's in cache
update: 120000, // the amount of time (in ms) before updating this server
})// do something with this information
const guild = client.guilds.resolve('1234')
const channel = guild.channels.resolve('5678')
channel.send(`There are currently ${server.players.cache.size} players in the server!`)
})client.login('your-token-here')
```## Documentation
You can view the [documentation here](https://mrgriefs.github.io/discord.js-fivem).