Giter Club home page Giter Club logo

discordgsm's Introduction

screenshot

DiscordGSM

Open Source Love svg1 GitHub license GitHub release Discord Shield

๐Ÿ“บ Monitor your game servers on Discord and tracks the live data of your game servers. Support one-click deployment to Heroku.

Install

  1. Invite DiscordGSM
  2. Deploy to Heroku
  3. Self Hosting
  4. Docker

Supported Query Type

  1. SourceQuery
  2. UT3Query
  3. GamedigQuery

Examples

Join our discord server to view the examples! https://discord.gg/Cg4Au9T

Wiki

https://github.com/DiscordGSM/DiscordGSM/wiki

Discord Presence Support

Discord Presence

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Stargazers over time

Stargazers over time

discordgsm's People

Contributors

battlefieldduck avatar brandonfl avatar patrix87 avatar tandelk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

discordgsm's Issues

Bot not updating query every 15 seconds

I was testing DiscordGSM with the gamedigQuery
For some reason, the discord bot does not update the query every 15 seconds. It occasionally updates every few minutes, otherwise it is super delayed.

DiscordGSM doesnt seem to support Terraria

GamedigQuery does support it, but it requires the Servermod "tshock" which also requires to be fed a specific token, the REST API Token, and the Bot doesnt seem to be able to read that token as there is no support for that.

[Minecraft][Docker][x86] UT3Query not working

Hiya, trying to set up multiple UT3Queries for some Minecraft servers however I am running into some issues.
The embeds are not being posted into the corresponding channel, sometimes they get posted but the server status remains "unknown." My SourceQuery Servers get posted fine, so the error of "Missing permissions" makes no sense.

Using Minecraft Web query for the minecraft servers works fine.

Log Output:

discordgsm-docker | Server Config found!
discordgsm-docker | Settings Config found!
discordgsm-docker | 2022-08-19 12:09:10: Starting DiscordGSM v.1.9.2
discordgsm-docker | 2022-08-19 12:09:10: 3 servers queried.
discordgsm-docker |
discordgsm-docker | ----------------
discordgsm-docker | Logged in as: Shibabox Servers
discordgsm-docker | Client ID: censored
discordgsm-docker | Owner ID: censored (VibeShibe)
discordgsm-docker | Invite Link: https://discord.com/api/oauth2/authorize?client_id= censored permissions=93184&scope=bot
discordgsm-docker | ----------------
discordgsm-docker | Querying 3 servers and updating 3 messages every 10 minutes.
discordgsm-docker | ----------------
discordgsm-docker |
discordgsm-docker | 2022-08-19 12:09:13: 3 servers queried.
discordgsm-docker | 2022-08-19 12:09:13: ERROR: Failed to fetch message for server: Running Overwatch.
discordgsm-docker | 'message_id'
discordgsm-docker | 2022-08-19 12:09:13: Discord presence updated | 3 game servers
discordgsm-docker | 2022-08-19 12:09:15:
discordgsm-docker | 1 error(s) in update_messages().
discordgsm-docker | 2022-08-19 12:09:17: ERROR: update_messages error threshold(0) reached. Reposting messages.
discordgsm-docker | 2022-08-19 12:09:24: ERROR: Failed to send message for server: censored :25566. Missing permissions ?
discordgsm-docker | unsupported operand type(s) for /: 'str' and 'int'
discordgsm-docker | 2022-08-19 12:09:26: 2 messages reposted.
discordgsm-docker | 2022-08-19 12:09:26: 0 messages updated.

Inside the Container in dgsm-docker/cache/:25566.json it seems to successfully retrieve server data and query, but doesn't post to Discord.

Example of Servers.json:

[
{
"comment": "Minecraft Lobby",
"type": "UT3Query",
"game": "Minecraft",
"address": "censored",
"port": 25566,
"channel": censored,
"image_url": "censored",
"custom": "Running Minecraft",
"country": "DE",
"color": "#0096FF",
"title": "Minecraft Lobby",
"public_address": "censored:25565",
"locked": false
}
]

Trying out just the bare minimum with type, address, port and channel defined also doesn't work, so it was made sure that there was no mistakes made along the way.

I'd really appreciate any help.

Best regards

Bot crashed after add/replace server.json

I am using Heroku after bot online and working commands. after that, I replace it with my own server.json then suddenly it crashed and will not back online. Even I try to replace back to normal Github and your "server.json". It never recovers. I did test both Dev and Stable.

Direct Join: use public address

The direct join feature is very nice, but it is kinda useless in its current form. It uses the fields address & port, which are only valid for the gamedig query. You can't usually join on this port.
Instead, use the field public_address for this feature.

Thanks! You guys are doing great work!

[BUG] [selfhosted python] Bot breaks if queried server map is empty

Steps to reproduce:

  1. Query server with empty map
  2. Turn mad becaue you can't figure out why the embed isn't working.

Bug Description

Query is successfull and can be seen in the cache folder.
Discord presence is created and shows correct status.

Discord embed does not get created.
If the "broken" server is first in servers.json the following servers never get queried, the bot hangs on the first one.

Happens when severname-port.json in the /cache folder contains an empty map like so:

{
    "game": "arma3",
    "addr": "darkstarclan.com",
    "port": 2402,
    "name": "DarkStar-Escape",
    "map": "",
    "maxplayers": 10,
    "players": 0,
    "bots": 0,
    "password": true
}

changing it to this manually (and commenting out this to stop overwriting of cache)

{
    "game": "arma3",
    "addr": "darkstarclan.com",
    "port": 2402,
    "name": "DarkStar-Escape",
    "map": "literally anything but empty",
    "maxplayers": 10,
    "players": 0,
    "bots": 0,
    "password": true
}

fixes the issue and the embed gets created successfully.

Steps to reproduce:

  1. Query server with empty map
  2. Turn mad becaue you can't figure out why the embed isn't working.

Bot cannot run, "intents" error

Trying to run the bot on both Windows Server and Ubuntu 20.04 and after fulfilling all requirements, the same error shows up regardless of the OS.

Linux
image

discordgsm@WIN-32TD5U1EI7P:~/DiscordGSM$ python3 bot.py
Traceback (most recent call last):
  File "bot.py", line 363, in <module>
    client = commands.Bot(command_prefix=PREFIX)
TypeError: __init__() missing 1 required keyword-only argument: 'intents'

Windows
image

PS F:\DGSM> python bot.py
Traceback (most recent call last):
  File "F:\DGSM\bot.py", line 363, in <module>
    client = commands.Bot(command_prefix=PREFIX)
TypeError: __init__() missing 1 required keyword-only argument: 'intents'

unable to start self-hosted

I installed the DiscordGSM docker container on my unraid server using the comunity apps.

I have the config setup, but when I start the container, it quickly goes into "stopped" state again with the following in the logs:
usermod: no changes
usermod: no changes
Server Config found!
Settings Config found!

Any ideas on why it won't start? Let me know what additional info may be needed for this.

does not send message.

2022-04-21 10:50:19: 1 servers queried.
2022-04-21 10:50:19: ERROR: Failed to fetch message for server: 7 Days to Die | In the Server channel.
'message_id'
2022-04-21 10:50:19: Discord presence updated | 1 game servers
2022-04-21 10:50:21:
 1 error(s) in update_messages().
2022-04-21 10:50:23: 0 messages updated.

I get this error when I start up the bot. I don't have a message_id because there isn't one posted yet.

I don't know why it is posting 'message_id'

It seems to be connecting, but having a problem sending a message

Config

"fieldname": {
"status": "Status",
"address": "Address",
"port": "Port",
"game": "Game",
"currentmap": "Current Map",
"players": "Players",
"country": "Location"
}
}
Hey how do I fill this and is it required?

And why is Servers.json is empty? Are we supposed to add servers by ourselves?

Discord Slash Commands

This bot will need to implement slash commands due to Discords implementation of a requirement.
Bot still works for now, but I anticipate there will be a hard cut-off that Discord will drop.

setserversjson

How does the command !setserversjson work ? the picture for it is here

NameError: name 'SourceQuery' is not defined for a server

Hello. I've a problem with your bot :

future: <Future finished exception=NameError("name 'SourceQuery' is not defined")>
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/container/servers.py", line 82, in query_save_cache
    query = SourceQuery(str(server['addr']), int(server['port']))
NameError: name 'SourceQuery' is not defined
Future exception was never retrieved
future: <Future finished exception=NameError("name 'SourceQuery' is not defined")>
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/container/servers.py", line 82, in query_save_cache
    query = SourceQuery(str(server['addr']), int(server['port']))
NameError: name 'SourceQuery' is not defined

How to fix this problem? And excellent job for your bot.

OS : Debian 10 on VPS.
Version of Python installed : 3.7.3.
DiscordGSM 1.8.1

Not posting messages.

Querying 1 servers and updating 1 messages every 5 minutes.

2022-05-14 22:53:11: 1 servers queried.
2022-05-14 22:53:11: ERROR: Failed to fetch message for server: 24 7 Total Chaos VIP FHR US.
'message_id'
2022-05-14 22:53:11: Discord presence updated | 1 game servers
2022-05-14 22:53:13:
1 error(s) in update_messages().
2022-05-14 22:53:15: 0 messages updated.

Cant find the channel id, I copied it from my discord server's channel list. Permissions are correct.

Source query returning incorrect playercount

Sometimes A2S_INFO returns the incorrect number or players online. I don't know the exact cause, but I believe it is related to mass-disconnects. This then results in DiscordGSM displaying the wrong playercount. We've had a server that crashed and never filled back up for days. It has displayed 35 players online the entire time during that period, despite never having more than 10 players online.

I've recorded this behavior on Squad and Beyond The Wire servers (which use the same codebase) as well as Hell Let Loose. But seeing that this happens on several games that have nothing in common I think it's safe to assume that this happens on more games, if not all.

Now, there is a solution for this. If we query A2S_PLAYER instead we get a list of all connected players. And the response can be quite interesting. Below is an example I recorded when the bot showed that there were 18 players online:

[
    {'index': 0, 'name': '', 'kills': 0, 'time': 525896.6875},
    {'index': 0, 'name': '', 'kills': 0, 'time': 421503.875},
    {'index': 0, 'name': '', 'kills': 0, 'time': 412463.6875},
    {'index': 0, 'name': '', 'kills': 0, 'time': 315875.46875},
    {'index': 0, 'name': '', 'kills': 0, 'time': 314683.0625},
    {'index': 0, 'name': '', 'kills': 0, 'time': 306514.5},
    {'index': 0, 'name': '', 'kills': 0, 'time': 304662.25},
    {'index': 0, 'name': '', 'kills': 0, 'time': 304572.625},
    {'index': 0, 'name': '', 'kills': 0, 'time': 299519.15625},
    {'index': 0, 'name': '', 'kills': 0, 'time': 259991.65625},
    {'index': 0, 'name': '', 'kills': 0, 'time': 238099.953125},
    {'index': 0, 'name': '', 'kills': 0, 'time': 71261.09375},
    {'index': 0, 'name': '', 'kills': 0, 'time': 59203.9453125},
    {'index': 0, 'name': '', 'kills': 0, 'time': 56263.80078125},
    {'index': 0, 'name': '', 'kills': 0, 'time': 50282.68359375},
    {'index': 0, 'name': '[BWCC] B@NG', 'kills': 0, 'time': 13713.1494140625},
    {'index': 0, 'name': '[BWCC] โ™†๏ธŽ hydro', 'kills': 0, 'time': 6419.0048828125},
    {'index': 0, 'name': 'PAHE The Happy One', 'kills': 0, 'time': 2346.917236328125}
]

As you can see, there are 18 entries in this list. However, only 3 of them are actual players.

To solve the issue, all you'd have to do is query A2S_PLAYER instead of A2S_INFO. Then, count all the entries which don't have an empty name, and return that value instead.

Request: Changing/overriding the Game "name" in discord message

for the gamedig query, some games that are not supported by gamedig require type "protocol-valve" to work. Would it be possible to change the name or specify a name/string for the game in the discord alert? I.e. Night of the Dead. Everything works but the game "name" is "protocol-valve".

One of query's in a discord server

Hello @BattlefieldDuck

I have a specific use case for DiscordGSM over at LinuxGSM but not sure the best way to go about it.

I have recently been getting a lot of people wanting to know if their server is actually online and working as it doesn't always show on the server list right away (I'm looking at you Rust & Valheim). I have been doing some manual queries in gamedig to confirm for them. It allows them to know if they have their firewall configured correctly.

DiscordGSM bot might provide a solution for them to query servers on there own in discord.

I want discord users to be able to do one-off game server queries using Discord so they can diagnose and test their servers rather than creating a permanent list like DiscordGSM currently does.

let me know if you think this is possible. Thank you :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.