Giter Site home page Giter Site logo

discord-gamestatus / discord-gamestatus Goto Github PK

View Code? Open in Web Editor NEW
33.0 4.0 3.0 1.31 MB

View the status of your game server in discord using embeds

Home Page: https://gamestatus.douile.com/

License: GNU General Public License v3.0

JavaScript 10.79% Shell 0.49% TypeScript 78.06% Rust 10.66%
discord discord-bot discord-gamestatus embeds monitoring game-server game-server-monitoring discord-js

discord-gamestatus's Introduction

discord-gamestatus

A open-source discord bot that actively monitors your game server and updates a discord message with the current status.

Changelog

See CHANGELOG

Contributing

If you would like to request a new feature, report a bug, or even fix or improve our code we welcome your contribution. Open an issue to make a request, or a PR to submit your code for review.

Before contributing please read CONTRIBUTING

LICENSE

Licensed under GPL-3.0

discord-gamestatus's People

Contributors

dependabot[bot] avatar douile 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

Watchers

 avatar  avatar  avatar  avatar

discord-gamestatus's Issues

Error when using discord protocol

The query function errors when trying to fetch an image for discord servers.

Error running command status
TypeError: this.guilds.get is not a function
   at Client.discord (/home/discord-bots/discord-gamestatus/src/query.js:35:29)
   at Client.query (/home/discord-bots/discord-gamestatus/src/query.js:99:37)
   at async Update.send (/home/discord-bots/discord-gamestatus/src/structs/Update/UpdateSend.js:32:17)
   at async Object.call (/home/discord-bots/discord-gamestatus/src/commands/status.js:43:15)
   at async Client.<anonymous> (/home/discord-bots/discord-gamestatus/src/index.js:118:9)

Find replacement for discord.js-light

discord.js-light is no longer being maintained (timotejroiko/discord.js-light#95) and will not be updated to discord.js v14.

While a lot of the caching functionality is now included in discord.js itself I do not believe that the forge methods are, it might be possible to port just the forge methods into the bot itself or their own library, or it might be better to just maintain discord.js-light ourselves.

More research needed.

Statusrefresh bug

TypeError: Cannot read properties of undefined (reading 'split')
statusrefresh.js:26:36

Gamelist doesn't work well with interactions

The gamelist command can only show one embed when used with slash commands, also specifying a short query like 2 will cause the command to fail because the resulting embed is too large.

Unit testing

Add some unit tests to validate code quality and prevent regression

Docs: Add build instructions to README

What would you like to be added?

Add instructions for building and running the bot to the README.

Any extra information

No response

Self-host

Self-Hosted

Add contribution guidelines

Make it easy for people to contribute by adding contribution guidelines, and an overview of the code structure.

Statusremove command error

Statusremove throws an error and doesn't function correctly when being called via the slash command.

Error running interaction statusremove
 TypeError [COMMAND_INTERACTION_OPTION_TYPE]: Option "channel" is of type: CHANNEL; expected STRING.
    at CommandInteractionOptionResolver._getTypedOption (/home/node/node_modules/discord.js/src/structures/CommandInteractionOptionResolver.js:98:13)
    at CommandInteractionOptionResolver.getString (/home/node/node_modules/discord.js/src/structures/CommandInteractionOptionResolver.js:159:25)
    at Object.call (/home/node/dist/commands/statusremove.js:68:53)
    at Client.onInteraction (/home/node/dist/index.js:213:27)
    at Client.<anonymous> (/home/node/node_modules/@douile/bot-utilities/lib/index.js:38:28)
    at Client.emit (node:events:527:28)
    at InteractionCreateAction.InteractionCreate [as handle] (/home/node/node_modules/discord.js-light/actions.js:412:5)
    at Object.INTERACTION_CREATE (/home/node/node_modules/discord.js-light/handlers.js:262:36)
    at WebSocketManager.Client.ws.handlePacket (/home/node/node_modules/discord.js-light/client.js:47:29)
    at WebSocketShard.onPacket (/home/node/node_modules/discord.js/src/client/websocket/WebSocketShard.js:482:22) {
  [Symbol(code)]: 'COMMAND_INTERACTION_OPTION_TYPE'

offlineImage not working

The offlineImage property is not respected and the default image is still shown while the server is online.

Rust rewrite

Rewrite entire bot in rust using the serenity library for much improved resource efficiency.

This will involve some re-architecture.

  • The bot client will no longer connect to the scheduler: status updates now exclusively use HTTP API endpoints meaning they do not need an active gateway connection.
    • A seperate updater program will run that connects to scheduler and just sends updates
    • This program will be built with sharding in mind, hence need to add way to easily distribute bot configuration between them (rewrite scheduler protocol)
    • Possibly swap out JSON for more efficient machine parsable format
    • Possibly add TLS support for scheduler
    • This depends on https://github.com/gamedig/rust-gamedig to be ready (it mostly is)
  • Bot client will be reduced to most basic functionality: recieve slash command, update database, generate message.
    • Database updates will be optimised by creating specific queries for each specific use case instead of updating each status as its own unit.
    • Hopefully take advantage of new discord features like buttons and modals
  • Database changes
    • db is central point of reference for all components therefore it might be the best place to store the bot configuration
    • statuses table could be optimised, better indexes, remove data for functionality thats not really used
      • player change list (stores entire response json)
      • last server title (stores entire response json)
    • if changing database schema should add unit tests to confirm that migration will work

Other tasks

  • create a component diagram of this architecture
  • get docs up to scratch, especially for slash commands as regular commands are being removed
  • support internationalization out the gate
  • performance metrics so benefit of rewrite can be measured

Reduce memory footprint

The bot currently uses ~500mb per shard, this can probably be greatly reduced by not caching stuff we don't need, using partials etc.

Prune servers offline for a certain period

What would you like to be added?

Store the last online time for servers and automatically remove those that have not been online for a set amount of time.

Any extra information

No response

Self-host

Public

Move tick management to database

By managing the ticks (which statuses are updated when) in the database we can save memory footprint as not all the statuses will need to be loaded in memory. It will also make it possible to shard and spread the updates across shards.

Requirements:

  • New database table that stores (tick_id, status_id)
  • Some kind of manager in db that assigns statuses to ticks
  • Rework update code to fetch from database

How does one actually start the bot?

Instructions in doing so on Windows are not entirely clear. I have my bot running through the developer portal but do not know how to activate this script. Thanks.

how to use this bot

Hi I have followed the instructions but still showing error :) pls help
`/root/discord-gamestatus/src/limits.js:19
onError ||= debugLog;
^^^

SyntaxError: Unexpected token '||='
at wrapSafe (internal/modules/cjs/loader.js:988:16)
at Module._compile (internal/modules/cjs/loader.js:1036:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object. (/root/discord-gamestatus/src/structs/UpdateCache.js:26:23)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)`

Maintenance mode

Allow admins to turn on/off "maintenance mode" where a temporary (customizable) warning is added to the status message.

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.