Giter VIP home page Giter VIP logo

gamerbot2.0's Introduction

GamerBot2.0

What is Gamerbot2.0?

Gamerbot2.0 is a discord-bot developed by-and-for the STAMSITE discord community. The intended purpose is to facilitate levelup-bonuses and fun interactions for the discord community, and to potentially be expanded to include a few small minigames in the future :D

STAMSITE is not involved in the development of this bot, do NOT ask him about issues with it. Contact @Sake100#1952 or @Little_Fox#2194 on discord with issues or leave an issue here on GitHub if you have discovered a bug.

Running your own GamerBot2.0!

Installation

GamerBot2.0 requires node.js 16.x, and MongoDB to run.

Additional requirements for linux are:

libpixman-1-dev libcairo2-dev libpango1.0-dev libjpeg8-dev libgif-dev build-essential
  1. Clone this repository (using https) into the directory you want to run the bot in.
  2. Run npm install in order to install all the required node.js packages.
  3. Create a new bot under Discord developers portal
  4. Set up a MongoDB database (the free tier will do fine).
  5. in the .env file in the GamerBot2.0 directory add the following:
token = YOUR_DISCORD_BOT_TOKEN
mongodb_srv = ADDRESS_TO_MONGODB_SERVICE
config_id = normally 1 but can be changed for debugging purposes or running several bots on the same database.
  1. If you want automatic updates run ./CRONSET.sh in your terminal, to set your bot to automatically update when new changes are made in the repo.
  2. To run the bot type ./STARTME.sh and if you have invited the bot to your server you should see it coming online!

Commands

. is the standard prefix, this can be changed with .confset

Member commands:

All members of the server can see and use these commands.

.help - help displays the available commands; help $COMMAND explains the command

.me - shows relevant information about whoever executes the command

.memberinfo $user - shows relevant information about who is tagged

.ping - displays ping-time between the bot and discord

.serverinfo - currently shows the number of members on the server

.suggest - only meant for the official instance of GamerBot2.0, adds a feature suggestion in the database.

.uptime - displays uptime of the bot.

Admin commands:

The owner of the server and all users with the role Administrator can use these commands.

.confget - displays the current configuration of the bot.

.confset $KEY $VALUE - allows the Administrator to set the configuration the keys are the following:

	debug	- auto-reloads commands, handy while testing
	xp {  	- settings regarding xp (list of settings in {})
	   timeoutsEnabled 	   - Administrators are allowed to timeout the gain of xp for user, or not
	}
	prefix	- sets the global command-prefix for the bot
	activity  - displays the activity message under the bot name in the members list
	activityType  - for example "playing" or "listening to"

.emujoin - emulates someone joining the guild, handy for development and bot testing.

.setxp {<mentionedUser>|<userID>} -x <xpAmount> - using user Tag or ID you can set the amout of XP for the user in the database, can be used for punishments or otherwise

.setxp {<mentionedUser>|<userID>} -t <xpTimeout> - using user Tag or ID you can put a user in XP timeout, standard is miliseconds. Use suffix h for hours, m for minutes, and s for seconds. Example: 60s 8h or 15m.

Examples:

.me

.memberinfo @McPerson#1337

.setxp @McPerson#1337 -x 0

.confset activity "Minecraft"

.confset debug true

.confset xp {"timeoutsEnabled": true}

Contribution

If you want to contribute to the development of the bot you can do so in the following ways:

  • Create a new issue: This is used to notify others that you've found a bug that needs to be fixed or that you want a new feature.
  • Make a Pull Request: Make Pull Requests with small changes. Try to only face one issue at a time.

Network graph

Click here to view the network graph of this project.

gamerbot2.0's People

Contributors

chris9740 avatar dependabot[bot] avatar isakthehacker avatar littlefoxcode avatar loveapoex avatar lukasabbe avatar n3wsw3 avatar vl07 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gamerbot2.0's Issues

Way of showing more than top 25 for .xptoplist

Short description of my feature request:

I would like to be able to see more than the top 25 when using the .xptoplist command, if someone isn't in the top 25 and want to see how their position this would be appreciated, especially in the future when there are even more users in the list.

Two solutions:

I have two ways I think would be the best way to do this.

Option 1 | Pages:
Make the system page based instead of showing one long first page showing 25 places, you could divide it up to pages by for example 10 places/page.
Instead of how it is now, you enter the number of places to be shown (max. 25), you enter what page you want to show.
Page one will for example show the places 1 to 10, page two 11 to 20 etc, the amount of places/page is just an example.

Option 2 | Intervals:
This will instead for the one above have two subcommand values, one for where the list should start and the second more or less the exact way it is right now. (or reverse the two values, having the start position after the way it's now)
So this should use almost the same way it works of now (at least by how I imagine the code is written, haven't looked into the code) and that the list starts at the number the user has written instead of always starting at the first one.

Additional context:

As said above, I think that this would be appreciated by many users and especially in the future when there are even more people on the top list.

await and async needs to be gone over.

We have had severe stability issues regarding crashes due to unkept promises. This is detremental to stability and we need to go over the entire codebase to check wether all used functions are asynchronous or not.

Introduce the usage of nodemon for deployment and recovery

Is your feature request related to a problem? Please describe.
Currently if the bot crashes human intervention is required. This is not ideal since staff can not always be on call to catch it.
Also, when developing the bot the test bot needs to be ran on the developers own system which makes handling keys, ID:s etc. messy.

Describe the solution you'd like.
The ideal solution would be to have the production enviroment automatically pull changes from a "release" or "production" branch in the repository to then restart with the new functions enabled.

A similar solution might be interesting for development and testing.

The crash-logs will ideally be available as soon as the bot is up again, where they should be sent is up to debate.

Have you come up with a good solution of how to implement this feature?
Nodemon will help with restarts and restarting when files are updated, automatic deployment could likely be solved with Githooks.

As for making the crash-logs available I currently have no direct solution.

Please discuss! I think this will improve workflow and development greatly!

Take xp into account when placing users on the leaderboard

Is your feature request related to a problem? Please describe.
Users are frustrated that the leaderboard only take levels into account when showing users in the leaderboard.

Describe the solution you'd like.
The location of users on the leaderboard should take both levels and xp into account when placing users at a location on the leaderboard.

Have you come up with a good solution of how to implement this feature?
Not yet...

Additional context:
None

Ability to turn off web server (config option).

Currently the bot is starting a web service to be able to run on replit.io. But when the bot is running on local hardware this is creating an unnecessary overhead and potential security vulnerability.

XP/level progress bar

Short description

I would like some way of viewing my progress in levelling, it doesn't need to be precise at all, just a hint for how far into the level I am.
The main reason for this would be in the future when people are in really high levels and don't have any way of knowing if your half there, almost next level or anything.

Detailed description

My idea is that the progress bar should consist of steps of some kind, not many at all, thus making it to be less likely to result in people spamming for levelling up.
For example, having 3 "steps" per level. When you are more than 33% into reaching the next level, the first step is marked, over 66% the next step is marked etc. This makes you have at least a clue of how far you are to the next level and at the same time, hopefully not making people spamming to get more levels.

Another feature that could be added to this one, is that you get more of these "steps" by leveling, for example, one step more for every 10 levels or so. I think this would be more fun for the people that are at really high levels.

I don't really know where or how this may be done, but maybe in the .me command or something. The example of values or amounts of steps etc. are just examples, I haven't thought them through that much.

Additional context:

I would like to think about how this could be done, but I sadly don't really have time for that so I will just write my thoughts when I get them and let you decide and think about how it may be implemented.

Bot crashing when user tries to send messages through DMs

The bot crashes when a user sends a message through the bot through a DM channel since it has no guild ID the stacktrace is the following:

GamerBot2.0/models/profileSchema.js:31
        return fetchProfile(message.author.id, message.guild.id, message.createdTimestamp, message.createdTimestamp);
                                                             ^

TypeError: Cannot read property 'id' of null
    at Object.fetchProfileFromMessage (/home/ubuntu/dev/GamerBot2.0/models/profileSchema.js:31:55)
    at module.exports (/home/ubuntu/dev/GamerBot2.0/events/guild/message.js:35:39)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)

Setcolor allows transparent colors

If you set your color to e.g. #ffffff00 your frame background is transparent. I don't know if this is intentional but I thought it's better to let you know rather than not.

Mention User who created a new ticket in the "New ticket" message

Is your feature request related to a problem? Please describe.
Currenty the user creates a new ticket in a separate chat, this creates mild confusion as to where the actual conversation is supposed to be hield and where to go.

Describe the solution you'd like.
Currently moderators are tagging the user on their own, but it would be nice if this could be done automatically.

Deprecate custom length for .xptoplist

Since this commands function no longer is required and causes some interesting bugs, I think the bot would do fine without it.

The bug causes the ranking placements to be jumbled after "turning the page" this is a formatting error of some kind.. To recreate:

Enter:
.xptoplist 1
Turn to next page:
If this is not just a repeating fluke you should se the output adding zeroes and ones to ranking....

Sätt att göra denna bot mera maintainable

  • Migrera kodbasen till Typescript
  • Använd något framework som discord-akairo

Genom att göra detta gör vi "development experience"-en mycket bättre och istället för att skapa våran egna handler så använder vi ett existerande som antagligen är mycket bättre och mer effektiv.

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.