Git Product home page Git Product logo

inhousequeue's Introduction

This is the open-source version of InHouseQueue using TrueSkill as MMR. Feel free to clone this and use it as a base for a personal non-commercial project.

We've been working hard and developing a custom MMR system, with many other improvements. This is also free, please take a look and invite it:

Pull requests are STILL welcome

In-House Queue

A Discord Bot designed to organise In-House Custom games for competitive 5v5 games.

Discord Servers

  • Discord Support server - Raise bugs or get help
  • Discord Queue server - Try the Bot out yourself!
  • Bot Invite link - Invite the Bot to your server

Discord Server setup

https://docs.inhousequeue.xyz/documentation/quick-start

Documentation

https://docs.inhousequeue.xyz/

All Commands

https://www.inhousequeue.xyz/commands

Installation

Running locally

Prerequisites

Python 3.9.X - Download python here

pip - https://pypi.org/project/pip/

  1. Clone or Download this repository:
git clone [email protected]:HenrySpartGlobal/InHouseQueue.git
  1. Rename a .env.example to .env.

  2. Fill in all the details Check out https://github.com/InHouseQueue/generate-emoji-ids to automatically print emoji Ids without doing these 1 by 1. Make sure you have emojis uploaded to your server. Only fill in emoji IDs for the games you are playing.

# Discord Bot Token
TOKEN=

# Emoji ID's for Roles in League of Legends
# Example <:MID:1066065288862380033>
# To get this, In discord Enter the emoji and add \ to the start of it. Then press enter.
TOP=""
JUNGLE=""
MID=""
SUPPORT=""
ADC=""

# Emoji ID's for Roles in Valorant
CONTROLLER=""
DUELIST=""
INITIATOR=""
SENTINEL=""

# Emoji ID's for Roles in Overwatch
TANK=""
DPS=""
SUPPORT_OW=""

# Discord ID of Owners. Use the SAME ID for BOTH values if there is only 1 owner.
DEV_1=
DEV_2=

# Guild/Server ID of where the bot is running. Use the SAME ID for BOTH values if there is only 1 server.
GUILD_1=
GUILD_2=

# Discord ID of the Bot
BOT_ID=

# Discord ID of the Error Log channel. Use the SAME ID for BOTH values if there is only 1 error log channel.
ERROR_LOG_CHANNEL_ID_1=
ERROR_LOG_CHANNEL_ID_2=
  1. Install requirements.

    1. pip install -r requirements.txt
  2. Run the Bot

python3 main.py
  1. Now set up the Bot with the steps in Discord server setup

Running locally with Docker

Guide

Self-hosting

I encourage you to Invite the Bot to your server, but if you want to make some changes and host it yourself feel free. Here is my Hosting guide

More details on the MMR algorithm used

https://docs.inhousequeue.xyz/documentation/reference/sbmm

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the GNU AFFERO GENERAL PUBLIC LICENSE - see the LICENSE.md file for details

The Affero General Public License v3.0 (AGPL-3.0) is the license for this project, which offers the following key features:

  • Based on the GNU General Public License v3.0 (GPL-3.0), it includes an additional clause addressing network interaction.
  • Mandates that the entire source code be accessible to users interacting with the software over a network.
  • Ensures that modified versions and derivative works of the software also remain open-source by requiring them to adopt the AGPL-3.0 license.
  • Grants end users the freedom to use, study, share, and modify the software.
  • Preserves copyright notices, disclaimers, and license information within the source code.
  • Excludes the granting of patent rights; contributors with patents covering their contributions must license those patents to users.
  • Relieves original authors and contributors of liability for damages or warranty claims.

Acknowledgments

Aarno

Copyright © 2023 HenrySpartGlobal

inhousequeue's People

Contributors

dorianaarno avatar henryspartglobal avatar maydit avatar

Stargazers

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

Watchers

 avatar  avatar

inhousequeue's Issues

Maps for Overwatch and Valorant

Valorant

Once a game is found, the lobby queue should select a map from below at random to be played. This can be another embed with the map image and "Map to be played" description. This will be optional.

Valorant Maps:

Haven - https://media.valorant-api.com/maps/2bee0dc9-4ffe-519b-1cbd-7fbe763a6047/splash.png
Split - https://media.valorant-api.com/maps/d960549e-485c-e861-8d71-aa9d1aed12a2/splash.png
Ascent - https://media.valorant-api.com/maps/7eaecc1b-4337-bbf6-6ab9-04b8f06b3319/splash.png
Icebox - https://media.valorant-api.com/maps/e2ad5c54-4114-a870-9641-8ea21279579a/splash.png
Fracture - https://media.valorant-api.com/maps/b529448b-4d60-346e-e89e-00a4c527a405/splash.png
Pearl - https://media.valorant-api.com/maps/fd267378-4d1d-484f-ff52-77821ed10dc2/splash.png
Lotus - https://media.valorant-api.com/maps/2fe4ed3a-450a-948b-6d6b-e89a78e680a9/splash.png
Bind - https://media.valorant-api.com/maps/2c9d57ec-4431-9c5e-2939-8f9ef6dd5cba/splash.png
Breeze - https://media.valorant-api.com/maps/2fb9a4fd-47b8-4e7d-a969-74b4046ebd53/splash.png

We will then send a map ban link like op.gg. Please select Bo1 (1Star on the website)
https://www.mapban.gg/en/ban/valorant/competitive

With this teams can ban maps and select which sides they want to start on, Attacking or Defending.

Overwatch

Overwatch Game modes + Maps:
Once lobby has started, select ONE game mode at random then ONE random map within the game mode.

Game modes + Map combinations

https://overfast-api.tekrop.fr/maps
Control:

Escort:

Hybrid:

Push:

Let's select game modes and maps at random at first. We can refine this to add map voting or similar later on.

Should be released with - #15

Bug: Cannot remove user from queue once ready check has begun

If the queue is in a ready check state and someone is not available, the /admin reset [member] will not work. It will remove them from the queue yes but the queue will stay in a ready check.

Even worse, if they come back after the /admin reset [member] has been run, and they click ready, the game will start but they won't be in the lobby.

Solution:
Given a user has not readied up
When the /admin reset [member] command has been run
Then they are properly removed from the queue
And the queue returns to a queue state

Temp workaround:
Wait for the timer to run out, or start an entirely new queue without them

Auto queue

  1. Someone runs /start
  2. A game is found and begun
  3. Bot automatically sends another queue by itself.

So save time, lets leave out the top.gg vote for now.

This will keep a steady flow of queues

More flexbility with commands

I want people to have more flexibility with the bot; many features can/should be toggled on and off so all servers can fine-tune the bot to their needs. For example, the MVP vote - can easily be an on/off feature! Also, the admin commands are all for Administrators only. We can be flexible here and move it down to the "manage server" role and then specific commands only Admins can run. Or even more flexible, an Admin can assign an admin command to any user - so they can run this.

Flexible commands

  1. Allow admins to give permissions to any user to run a command. /admin enable [command] [user] - The command should display a list of all admin commands. They can then select one, and the member can use it.
  2. Even better, /admin enable [command] [role] - the same, but it will give all people in that role the ability to use the command.
  3. If the above is not possible - /admin reset leaderboard, /admin change_winner - should be locked to Admin, and all other admin commands can be for Moderators (i.e. anyone with the "manage server" role)

Toggle on/off options

  1. MVP vote

Decrease base mu value

We are decreasing base mu from 8.33 to 5-7. The actual number is yet to be decided.

This will decrease the drastic differences in MMR early on. Although the default for TrueSkill is recommended it's mostly for public multiplayer games where players are meant to be playing 100s of games.

With the use case for this bot, it's unlikely individual players will reach 100s of games played. This means the algorithm may never provide an accurate rating of a player's skill as they'll never reach enough games.

We propose increasing the default confidence value so MMR gains/losses are less drastic, displaying a more "realistic" MMR with fewer games played.

Send Multi.opgg link

The multi-op. gg link should automatically be sent to the channel like the auto draft. This should only be sent for League of Legends.
Most likely, we have no use for the op. gg command itself.

DiscordIDs are shown after a while

When a player is offline, it displays their Discord ID sometimes, lets's find a way always to show a name. This can look messy and unclean

Persistent leaderboard

Leaderboard command that uses a channel to display a top 10static leaderboard that automatically updates.

maybe /top_players - should be based on Wins > Win rate > MMR

Add command to wipe Leaderboard (per guild)

  • Some discord servers have been doing Seasons, or Splits. May be good to have an admin command that can reset the leaderboard, so they can have a fresh start. Only for that guild!

Setup command

/setup [game]
A command to set up the server automatically for the admin instead of creating the channels themselves.

This will:

  1. Create a category called "InHouse"
  2. Create a text channel in that category called "queue" - Automatically be enabled as a queue and sends a queue straight away.
  3. Create a text channel in that category called match-history - Automatically enabled as the servers match history channel. Embed saying, "Match histories will be posted in here!"
  4. Create a text channel in that category called Top-10 - This will have an embed message saying
    "This channel will be used as your automatic leaderboard. Please run /admin top_ten [channelname] after you have played at least one game."

Default permissions for all these categories are that no one can talk in them. Apart from admins, obviously!
As discord does not care if two categories have the same name, this command can be run multiple times.

Update MVP to dropdown menu

Could we move this to a drop-down menu underneath the match history?
Each individual in the game can interact with?

DMs need to be more consistent.

Let's include the team and role and ensure the person is not on the list, just like we do for the duo queue.

Show teams after ready check

When ten players have been found, do not organise the teams into balanced teams until the game begins. Some players are dodging if they don't like the look of their team.

Let's move the duo system to this state of the queue as well.
The current duo system is a little flawed because if there is 9 people in queue, and the last person joins, they can't duo because the game automatically starts. So duos need to join early.

Attempting the change winner command when no winnerlog has been set

image

Lets have an error for when this happens

  1. When there isn't a winner log channel set in the server
  2. A game is played, and an admin runs admin change_winner
  3. There should be an error that says (You do not have a winner log set, please set one with /setwinnerlog [channel])

Verify command

A command that can be run after an initial set-up to make sure the bot is ready to be used

  1. /verify
  2. Bot attempts sends a message to the queue channel (Check! or something)
  3. Bot sends a message to the winnerlog
  4. Bot creates test lobby and voice channels
  5. Bot deletes test lobby and voice channels

If all these pass then a success message is sent and the server owner is informed that there are no permission issues.

Adding Support for other games

  • Support for dynamic button labels
  • Leaderboard for different games and an overall leaderboard
    /admin top_ten [game] [channel]
  • Changes in setchannel and setwinnerlog to support game parameter

Planned Games:

  • Overwatch
  • Valorant

Should be released with - #230

Players getting stuck in a game and unable to queue

I don't know the cause of this issue because I am never there to experience it. But at times, the bot will bug out, and players cannot queue any longer because they are stuck in a phantom game they cannot cancel. 2 issues at the same time on the 4th of December from support discord. The bot did not send winners to their winner log; they were stuck because the game was finished and not finished simultaneously.

Please read this message thread - https://discord.com/channels/1028306608100483082/1028307549608484974/1049467927470014474 (Support discord)

admin cancel does not work because that only works on current ongoing games.
Maybe a new command to fix this potential bug

New command: admin void [gameid] - will remove the game from the DB and unblock the players as a last resort

Adding warning and accept to admin reset leaderboard

  1. Let's add a warning when the admin reset leaderboard command is run. Same as we do for setting a winner log.

"This will reset all member's wins, losses, MMR and MVP votes back to 0. Are you sure?" X / ✔️

  1. Since we renamed the admin reset user to user_dequeue - We can now use the admin reset user to reset a single user's leaderboard stats.

Let's also include the warning message.

"This will reset all [nickanme]'s wins, losses, MMR and MVP votes back to 0. Are you sure?" X / ✔️

Send link to created Lobby

  • Once 10 players have readied up, the Bot should send an invite link to the created lobby
  • This lets players easily find the lobby if necessary, especially in big servers with many channels.

Teams customsation

A set-up where server owners can set up a generic game if they want to use the bot but do not play LoL, Overwatch or Valorant.

There will be a 4th option of "other" - where a server owner can set

This will make sense to set up after the bot has been released for Overwatch and Valorant, or it may be released simultaneously.

So I suspect the setchannel command will change to setchannel [game]
The options will be: LoL, Overwatch, Valorant, and Other. When they select "Other" - it should will create a generic queue "Player 1 - Player 5" and have a generic embed image (I will provide this)

Note: I have parked the need to custom lobbies of more or less than 5v5. Almost all competitive games are 5v5. If people start asking for more or less than 5v5 then we can consider.

Things to keep in mind:

  1. I would like to change the Banner image per game, and I will make a generic one for "Other."
  2. We may need to rewrite how the buttons work
  3. /start should recognise what game the channel has been set to and then start the correct queue.
  4. The Opgg embed sent in every channel now should only appear in an LoL lobby.
  5. The autodraft sent in every channel now should only appear in a LoL Lobby

May release along side - #217

Add roles to Match history

In the match history, adding the player's role to their name would be good. I will use an emoji for this.

:top :
:jungle:
:mid:
:adc:
:support:

Let's try reorganising the players to be shown in this order.
Can provide emoji ids.

Of course, these emojis will be different once we add support for Valorant and Overwatch so let's keep this in mind.

Multi clicks at the same time

When multiple people click a role at the same time, because of the slight delay, the bot seems to let everyone through at once, and there is a chance of multiple roles on the same team and more than 5 players per team. Players then need to leave 1 by 1 to solve this.

Is there any way we can stop this from happening? Maybe be more strict on how it handles the queue join, 2 players only? I am not sure

Enable/Disable MMR

Need a way to enable or disable the mmr matchmaking.
Some users want to decide on teams

/admin enable/disable MMR

Once this this is enabled, the Switch teams button returns and no MMR is counted for wins/loss. The counter also does not go up and neither does MMR.

Test mode command

A command that would put the entire bot into test mode, meaning they only need 2 people to test the functionality of the bot instead of 10. When we enable this manually, we edit the code and queue TOP. This command should do that.

  1. /admin testmode [on/off]
  2. All buttons but the first queue button are disabled/greyed out -
  3. 2 people Queue Top (this name will be different depending on if its valorant or overwatch)
  4. bot works as usual

We may need to discuss this as it could clash a little with #149

If it becomes too complex or hacky, let us scrap it and look for a dev-only command for me only.

Dockerize the bot

  • Create a docker container for the bot

Will make it much easier to deploy, especially for other people

Update names from MVP vote

Hard to know who is who sometimes, so this will make it clearer

  • Let's add the role the person played to the MVP vote DM

Bug: Top10 does not update

The top 10 stops auto-updating after a while. You need to rerun the command constantly, and it will update.

I have tried reproducing it, but it seems it doesn't work now.
Another solution would be to resend the updated leaderboard and delete the previous one. The same way we do with the queue, deleting it as soon as the winner log is posted.

Duo Queue

A system where 2 players can queue up and be on the same team 100% of the time.

Potential solution:

  1. Both players join the queue as normal.
  2. There will be an extra new button on the queue called "Duo". (Should only work when MMR is enabled)
  3. One player can click this, and a drop-down should appear. The drop-down will have the names of all players in the current queue. They select the player they want to duo with.
  4. Once a player has been selected, the other player receives a DM about the duo request. The player waiting also receives a ephemeral message that a DM has been sent.
  5. They accept/reject in the DM
  6. On acceptance, both players will be on the same team regardless of the MMR difference.
  7. Once acceptance, one player will physically move to Red/Blue side to join their duo and an emoji is next to their name showing they are duo.
  8. If the player cant move to the other side because its already taken by someone else, then an error message should appear. "This role on red/blue side is taken". We should not priortise duos so much that 2 can skip the queue over someone else.
  9. On reject, nothing happens, and they both stay in the queue, and MMR decides on their team.

Things to keep in mind:

  1. There should be some visual for others to know two players are a duo - maybe a star next to both names.
  2. If for whatever reason, the person's DM is private and the bot cannot send a DM, it should also send an ephemeral message stating this.
  3. Duo system should be toggle on/off per server.
  4. Make sure both users are of different roles - E.G both users can both queue Top, and then be allowed to click duo.

Cleaner Top leaderboards

  • Adding Losses to leaderboards
  • `` code block generates a cleaner look and feel.
  • Use emojis for top 10 leaderboards 1-10.
  • We can find out what role the person plays the most and use an to put next to their name. This can be done with emojis

Examples:
image

image

Confirmation when setting up a queue channel

I see a lot of people typing in the queue channel.

I think we either need an extra step that warns people that they will unable to type once this is set.
Example
/setchannel #channelname

Embed = "Message in this channel will automatically be deleted to keep the queue channel clean, do you want to proceed?"
Then a button to say yes/no

Only be in 1 queue at a time

A command to set queue preference;

  • Players can only be in 1 queue at a time
  • Players can join multiple queues but will be removed from others when one of their queues reaches the ready up phase

Update queue system

/start normal - Will create a normal queue, players can switch teams
/start mmr - Will create an MMR queue, teams allocated according to mmr

/start normal
Players will not gain MMR who play in this queue, but will gain a win on the leaderboard

Command to create multi op.gg Links

Players need a way to create a Multi op.gg link so they can see all players on the enemy team on one page

This will only work if players have their IGN as their discord nickname. So that is down to the server to enforce

Example op.gg link: https://www.op.gg/multisearch/euw?summoners=iHenners%2CAEBE%2CBolmanJr%2CTheForbiddenKing%2Cx+Blue+Eagles+x%2CTemodjin

So the command, or button or however we decide to do it, will take the Red and Blue team Nicknames and convert this into a link like the above.

Spaces between players have this %2C
Spaces between the player's IGN, like The John - will work. So we don't need to worry about handling that.

In many servers players, nicknames are prefixed with IGN:. For example, my discord nickname would be IGN: iHenners. We only want the iHenners part of the name. So we need to filter out stuff like IGN:, ign, ign:, IGN at the start of a nickname. If there isn't IGN, it should just take the whole nickname. This is where Regex might help.

So the command or button would look something like this in the code

f'https://www.op.gg/multisearch/[region]?summoners={nickname1}%2C{nickname1}%2C{nickname1}%2C{nickname1}%2C{nickname1}%2C

Another thing to note, they should be able to set the region https://www.op.gg/multisearch/[REGION]?summoners=

Valid regions - euw, na, eune, oce, kr, jp, br, las, lan, ru, tr

I suspect if it is a command, it will look something like

/opgg [region] [gameId] [red/blue] and this will send the op.gg link as a message.
It would be even more impressive if it could only be sent in that lobby channel. But not a priority.

Example question asked on StackOverflow: https://stackoverflow.com/questions/70320440/discord-py-bot-make-op-gg

Clean up queue channels

  1. Once a game has ended, the queue embed should be deleted from the queue channel. There is no need to keep it in there. Every info someone needs should be in the match history channel. It's crucial that it only gets deleted once the game has ended and there is a winner log.

  2. There is a problem with the bot: when the server restarts, the last queue before the restart is buggy. Solution - whenever the bot restarts, it should automatically send a new fresh queue in the queue channel.

Bug: Ready up check currently not working as intended

If someone doesn't ready up, they are kicked from the queue after 10 minutes. However, it looks like everyone is kicked out. The person who did not ready up is only removed "visually" on the queue embed. On the backend, everyone is kicked. Not working as intended currently.

Workaround: Everyone must re-queue.

Solution
Given someone does not queue up in 10 minutes
When they are removed from the queue
Then ONLY that person is removed from the queue
And the queue goes back to queue state, from ready

Bug - MVP vote

If someone does not vote for 1 game and they played another game, their following vote number will count twice?
Or at least the bot responds with 2 "Thank you for voting" messages

Allow players to select the champion they played

Players can select which champion they played. This can be a dropdown list and be part of the match history

Once it's set, it can't be changed.
image

Once they select which champion they played, this can be added to the member_history table as an extra tracker.
The champion they choose will show as an emoji next to the name in the match history (it will update the embed as they pick).

The champion should now also be an option on the /leaderboard command.

/leaderboard [character] - Will show players with the highest win rate on that champion/agent/hero. Let's limit this top 5. The thumbnail can also be the champion character.

/rank mvp/mmr - should display the champion they have played the most instead of the author ID

League of Legends = champion
Valorant = agent
Overwatch = hero 

Maybe we can use this naming convention depending on what game that would be a nice touch, otherwise we can just stick to [character] for everything.

League of Legends
One way to dynamically get the champion images:
https://ddragon.leagueoflegends.com/cdn/13.1.1/img/champion/{champion}.png

The first character in the champion's name is always uppercase. I can provide the name of all champions....
Example: https://ddragon.leagueoflegends.com/cdn/13.1.1/img/champion/Kaisa.png

We can grab the latest version of the game here -
https://ddragon.leagueoflegends.com/api/versions.json

And use that as well. New champions are added every 3 months or so. So It may look like
https://ddragon.leagueoflegends.com/cdn/{version}/img/champion/{champion}.png

Grabbing the latest version is beneficial because when they add a new champion, we will only need to add the champion's name to the list instead of editing the game version. Also, some champions get aesthetic reworks.

For Valorant:
https://valorant-api.com/v1/agents

So for the agent display icon, the path would be
['data']['displayname'] to get the agent name

then
['data']['displayIcon'] for the image

Overwatch
https://overfast-api.tekrop.fr/#tag/Heroes/operation/get_hero_heroes__hero_key__get

https://overfast-api.tekrop.fr/heroes/{hero_key}

Example:
https://overfast-api.tekrop.fr/heroes/cassidy
And we care for ['name'] and ['portrait']

If for whatever reason a champion doesn't exit the icon should be ❓
I can get you all the names of all characters in all the games when needed. But maybe with these api calls we wont need that.

Allow players to switch sides

Had suggestions from 2 different people to allow people to switch sides.

  • Be able to switch from blue > to red and vice versa as long as there is an available slot on the other side.

This way people can make teams a little easier / quicker

Add more options to disable/customize things

MVP vote dm - /admin MVP [enable/disable]
OP.GG Links /admin opgg [enable/disable]
LOL Draft Link /admin loldraft [enable/disable]

Customize the ready check timer /ready [mins]
voice channels will not create any voice channels, but will always still create lobby channel

Servers can opt out of getting the message in the queue whenever the bot restarts

Update how many members to show in "top_ten". Maybe a server wants top 3, or top 5.
I suspect having 3,5,10,15,20. As options would be a good start

Add spectate buttons to Lobby channel

For busy servers, people have noticed that it's hard to find what game to spectate, especially if there are a lot of queues happening.

  • let's add the spectate buttons to the lobby channel as well as the queue channel.

Bug: When admin change_winner is ran, MMR is not affected

  1. Game ends, and 1 team is accidently declared the winner - all players receive/lose MMR
  2. Admin runs /admin change_winner [gameid] Red
  3. Wins are converted as expected, but MMR is not. MMR still remains the same

Seems like an oversight on our part. Luckily this doesn't happen often but would be good to look into

Roles for Overwatch and Valorant

For Overwatch, I will add the emojis of the roles as we did for LoL, as it works precisely the same.

Overwatch roles:
Tank
DPS
DPS
Support
Support

Valorant Roles:
Controller
Initiator
Sentinel
Duelist
Flex - Flex is not a role, but it can be any of the above roles, depending on what is needed. When this is selected, allow the person to select the role they will play via a drop down.

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.