Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
339 commits
Select commit Hold shift + click to select a range
6e25969
Refactor of Player initialization
BadWolf1023 Jul 6, 2024
00bf0b8
Add mention property for Plater
BadWolf1023 Jul 6, 2024
445c77d
Add __repr__ for Player
BadWolf1023 Jul 6, 2024
2167799
Remove unused function
BadWolf1023 Jul 6, 2024
e34c2c0
Refactor: Add type hinting
BadWolf1023 Jul 6, 2024
f91df62
Remove unused function
BadWolf1023 Jul 6, 2024
bfe1f91
Refactor: Type hint
BadWolf1023 Jul 6, 2024
68ffca1
Remove unused function
BadWolf1023 Jul 6, 2024
b7cbaa8
Change how num_players is computed
BadWolf1023 Jul 6, 2024
a61eb7d
Main one room algorithm
BadWolf1023 Jul 6, 2024
a62007a
Unit Testing for algorithm
BadWolf1023 Jul 6, 2024
11a7794
Bug fix
BadWolf1023 Jul 6, 2024
33b9793
Added function for testing player ratings
BadWolf1023 Jul 6, 2024
7dbd37a
Bug fixed for testing function
BadWolf1023 Jul 6, 2024
74237ad
Bug fix
BadWolf1023 Jul 6, 2024
ea59dd3
Bug fix on display list
BadWolf1023 Jul 6, 2024
712c3c6
Display modification
BadWolf1023 Jul 6, 2024
a4d0cde
Bug fix
BadWolf1023 Jul 6, 2024
a969b16
Addresses #9
BadWolf1023 Jul 6, 2024
563bc6e
Addresses optional part on #9
BadWolf1023 Jul 6, 2024
3093cc4
Bug fix on algorithm
BadWolf1023 Jul 7, 2024
ba44c76
Make players comparable based on mmr
BadWolf1023 Jul 7, 2024
60d74a1
Bug fix
BadWolf1023 Jul 7, 2024
341ec83
Modify display of test function
BadWolf1023 Jul 7, 2024
c76df70
More bug fixes
BadWolf1023 Jul 7, 2024
819f182
Another bug fix
BadWolf1023 Jul 7, 2024
63d9a11
Fixes #13 + Clean refactor
BadWolf1023 Jul 7, 2024
42c9cbb
Minor text adjustment
BadWolf1023 Jul 7, 2024
7bf68dd
Forgot to upload part of refactor
BadWolf1023 Jul 7, 2024
e7f2554
Reverse part of commit, add error message back
BadWolf1023 Jul 7, 2024
07aacde
Merge pull request #4 from BadWolf1023/unacceptable-range-algorithm
BadWolf1023 Jul 8, 2024
e876296
Extend discord command
BadWolf1023 Jul 8, 2024
65639d2
Add additional extension time to Mogi object
BadWolf1023 Jul 8, 2024
c8eae07
Change the extension functionality to...
BadWolf1023 Jul 8, 2024
591f8f9
Finish extend functionality
BadWolf1023 Jul 8, 2024
1ff1908
Bug fixes: extension int should be timedelta
BadWolf1023 Jul 8, 2024
1f37c2c
Bug fix, did not rename class variable in all places
BadWolf1023 Jul 8, 2024
e0931fb
Merge pull request #5 from BadWolf1023/extend-command
BadWolf1023 Jul 8, 2024
9f516ff
Fix bug with mmr check when subbing
BadWolf1023 Jul 8, 2024
c634d63
See last commit
BadWolf1023 Jul 8, 2024
1a2efda
Prevent someone from subbing into room twice
BadWolf1023 Jul 8, 2024
df93b4a
Merge pull request #6 from BadWolf1023/bug-can-sub-multiple-times
BadWolf1023 Jul 8, 2024
b196cff
Structure to Player object to support hosts
BadWolf1023 Jul 8, 2024
2201bcc
Can host command interface support
BadWolf1023 Jul 8, 2024
8fb53c7
Create host_fcs.py
BadWolf1023 Jul 8, 2024
a0ecb52
Mogi.populate_host_fcs
BadWolf1023 Jul 8, 2024
36a73dd
Room.host_list to keep track of the room's host order
BadWolf1023 Jul 8, 2024
1902da7
Room.create_host_list
BadWolf1023 Jul 8, 2024
a487769
Room.get_host_str
BadWolf1023 Jul 8, 2024
85d5cb3
Add mogi_objects.Room to VoteView
BadWolf1023 Jul 8, 2024
6ec8faf
Populate host fcs and create the host list
BadWolf1023 Jul 8, 2024
037f700
When room begins, display the hosts appropriately
BadWolf1023 Jul 8, 2024
735ed34
Textual bug fix
BadWolf1023 Jul 8, 2024
eef4247
Change back to guild id for production
BadWolf1023 Jul 8, 2024
d34837a
Add extra line
BadWolf1023 Jul 8, 2024
45d6828
Merge branch 'unacceptable-range-algorithm' into can_host_command
BadWolf1023 Jul 8, 2024
c82a80f
Merge pull request #7 from BadWolf1023/can_host_command
BadWolf1023 Jul 8, 2024
07ade2d
Thread name will update with tier in title
BadWolf1023 Jul 8, 2024
64a75a0
Change mmr sub range to 700
BadWolf1023 Jul 8, 2024
6e01bce
Update sub range text from 500 to 700
BadWolf1023 Jul 8, 2024
7e6c2cd
Merge pull request #11 from BadWolf1023/unacceptable-range-algorithm
emilp-595 Jul 9, 2024
5dc72ac
Start the first event of the day 1 hour sooner
emilp-595 Jul 9, 2024
1caaf27
Revert "Start the first event of the day 1 hour sooner"
emilp-595 Jul 9, 2024
723e37c
reimplemented all old mk8 queuebot features
itoi06 Jul 14, 2024
05708aa
Simplify usage of is_restricted
BadWolf1023 Jul 16, 2024
f39be8d
Pushed check for specific game mmr fetch into mmr.py file
itoi06 Jul 16, 2024
91162d9
Bug fix
BadWolf1023 Jul 16, 2024
21e8b71
Interface to pull all ratings every 10 minutes for mkw and mk8dx
BadWolf1023 Jul 16, 2024
3d878b0
Remove unnecessary url variable in testing functions
BadWolf1023 Jul 16, 2024
798a6e1
Refactor of rating function name in JoinView
BadWolf1023 Jul 16, 2024
195147b
Merge branch 'ito-mk8dx' into bulk_rating_pull_feature
BadWolf1023 Jul 16, 2024
4ff0680
reverted unnecessary check for game
itoi06 Jul 16, 2024
2f65c81
changed method of checking late player for mk8dx
itoi06 Jul 16, 2024
573ad61
Added an explicit display_time variable for mogis to control how star…
itoi06 Jul 16, 2024
e4a05ca
All functionality for validating API rating responses, parsing, and r…
BadWolf1023 Jul 16, 2024
da37e17
Merge remote-tracking branch 'bw-origin/bulk_rating_pull_feature' int…
BadWolf1023 Jul 16, 2024
6b2088a
Finished Ratings.get_rating
BadWolf1023 Jul 16, 2024
573d9b6
Merge remote-tracking branch 'origin/ito-mk8dx' into bulk_rating_pull…
BadWolf1023 Jul 16, 2024
8618c2e
Merge issue fix
BadWolf1023 Jul 16, 2024
49469a5
Bug fix
BadWolf1023 Jul 16, 2024
1584e4c
fixed way tier is calculated for rooms
itoi06 Jul 17, 2024
e5f6ca7
Merge pull request #8 from emilp-595/main
BadWolf1023 Jul 19, 2024
a208798
f-string bug fix
BadWolf1023 Jul 19, 2024
9865693
Type hint for function return
BadWolf1023 Jul 19, 2024
1e033d8
bug fix: need to return boolean status (success/fail)
BadWolf1023 Jul 19, 2024
9e02bed
Function description
BadWolf1023 Jul 19, 2024
5477acb
Required changes for validating & parsing MK8DX JSON
BadWolf1023 Jul 19, 2024
9c57e43
Minor bug fixes
BadWolf1023 Jul 19, 2024
234eb81
Remove print
BadWolf1023 Jul 19, 2024
81a4bf1
Fix race condition: switching host status
BadWolf1023 Jul 19, 2024
21fac8c
Remove check, race condition no longer possible
BadWolf1023 Jul 19, 2024
5b2b357
Big commit, see description
BadWolf1023 Jul 19, 2024
5e4b036
Type hinting for IDE
BadWolf1023 Jul 19, 2024
340576a
Bug fix (minor display issue) with extension display
BadWolf1023 Jul 19, 2024
1e95c7f
Bug fix
BadWolf1023 Jul 19, 2024
20bb288
Fix incorrect type hinting
BadWolf1023 Jul 19, 2024
499a7ee
Bug fix
BadWolf1023 Jul 19, 2024
63c6cc1
Merge pull request #19 from BadWolf1023/bulk_rating_pull_feature
thomasgonda3 Jul 19, 2024
123cb14
Merge pull request #22 from BadWolf1023/locks-and-race-conditions
thomasgonda3 Jul 19, 2024
38bf146
Hotfix: Bot error on start bc not defined
BadWolf1023 Jul 20, 2024
6f2fd55
Testing Bot: start queue immediately
BadWolf1023 Jul 20, 2024
d59d4e6
See description
BadWolf1023 Jul 20, 2024
9fa82eb
Better testing for MKW
BadWolf1023 Jul 20, 2024
6d197c6
Hotfix: fix no lockdown when not enough rooms
BadWolf1023 Jul 20, 2024
b0ffbf6
Make valid players check class function
BadWolf1023 Jul 20, 2024
d13362b
Hotfix: how did this happen?
BadWolf1023 Jul 20, 2024
f6abb73
Hotfix: negative ratings did not read in testing func
BadWolf1023 Jul 20, 2024
6ea903a
Hotfix: how did this get in?
BadWolf1023 Jul 20, 2024
828b03e
Minor line refactor
BadWolf1023 Jul 20, 2024
e7bf762
Feature: Continue extension if rooms would cancel
BadWolf1023 Jul 20, 2024
7565093
common.is_int helper function
BadWolf1023 Jul 20, 2024
58e4900
Any room cancelled functions
BadWolf1023 Jul 20, 2024
60369a0
Fix bug where players show all removed when cancelled mogi
BadWolf1023 Jul 20, 2024
11827f4
Any modifications, including sorting, should be
BadWolf1023 Jul 20, 2024
a5bba14
All room algorithm complete
BadWolf1023 Jul 20, 2024
a8cc802
All room old algorithm (not used) for alternative functionality
BadWolf1023 Jul 20, 2024
2328c5d
Suggested lifetime changes
BadWolf1023 Jul 20, 2024
e69e44a
Changes to configs
BadWolf1023 Jul 20, 2024
f85b556
Bug fix in two Mogi methods
BadWolf1023 Jul 20, 2024
db99d42
Adjust debugging function for MKW
BadWolf1023 Jul 20, 2024
b600965
check_room_channels_task -> check_room_threads_task
BadWolf1023 Jul 20, 2024
3e055ed
Room.thread -> Room.channel
BadWolf1023 Jul 20, 2024
07c6941
Mogi.get_room_from_thread -> Mogi.get_room_from_channel_id
BadWolf1023 Jul 20, 2024
486bb90
Mogi.is_room_thread -> Mogi.channel_id_in_rooms
BadWolf1023 Jul 20, 2024
913bd3c
Refactor of get_tier
BadWolf1023 Jul 20, 2024
70b300c
Bug fix: coroutine not awaited
BadWolf1023 Jul 20, 2024
12b49e2
Refactor: fix global name shadowing
BadWolf1023 Jul 20, 2024
91c2f56
Add imports
BadWolf1023 Jul 20, 2024
d2df780
Full room and role maintainer functionality
BadWolf1023 Jul 20, 2024
1946b17
Merge pull request #26 from BadWolf1023/all-room-invalid-range-algorithm
emilp-595 Jul 23, 2024
4eb5ac8
SquadQueue.maintain_roles: Refactor + comments
BadWolf1023 Jul 25, 2024
58f3fdd
Add Mogi.all_room_channel_ids()
BadWolf1023 Jul 25, 2024
bcc0320
Refactor Mogi.channel_id_in_rooms()
BadWolf1023 Jul 25, 2024
50718a7
Buf fix with Room.avg_mmr
BadWolf1023 Jul 25, 2024
4979ab1
Remove testing text
BadWolf1023 Jul 25, 2024
82b6ace
Finalized implementation of recycled tier channels
BadWolf1023 Jul 25, 2024
b34c36d
RT config for recycled tier channels
BadWolf1023 Jul 25, 2024
0cca897
Feature: Backup thread creation in no available tier channels
BadWolf1023 Jul 25, 2024
1ffdd46
Create README.md
BadWolf1023 Jul 25, 2024
a394821
Merge pull request #27 from BadWolf1023/channel-tiers
BadWolf1023 Jul 25, 2024
42c4ce6
Remove testing statement
BadWolf1023 Jul 25, 2024
bdce04d
Config changes for min and max mmr
BadWolf1023 Jul 25, 2024
e7cfe98
Player minimum maximum mmr helper properties
BadWolf1023 Jul 25, 2024
bd1c4ad
Refactor Player property name
BadWolf1023 Jul 25, 2024
199c600
Change list display
BadWolf1023 Jul 25, 2024
ed06cee
Adjusted mmr text when player queues
BadWolf1023 Jul 25, 2024
441f2f6
Late player adjusted mmr text
BadWolf1023 Jul 25, 2024
12e7afd
Threshold function to use adjusted mmr
BadWolf1023 Jul 25, 2024
52ce9f9
Use adjusted_mmr in appropriate places
BadWolf1023 Jul 25, 2024
3fa252a
Display spacing fix with adjusted mmr
BadWolf1023 Jul 25, 2024
d26c67e
Remove unused function
BadWolf1023 Jul 25, 2024
28d2dea
Add adjusted MMR to display in queue join made rooms
BadWolf1023 Jul 25, 2024
0ec1879
Bug fix
BadWolf1023 Jul 25, 2024
cf4bcee
Another bug fix
BadWolf1023 Jul 25, 2024
ff313b7
Do not display late player and adjusted mmr in rooms
BadWolf1023 Jul 25, 2024
fb39f78
Merge pull request #29 from BadWolf1023/mmr-cap-feature
BadWolf1023 Jul 25, 2024
a2e5b0b
Optimization to speed up room creation
BadWolf1023 Jul 25, 2024
41125a9
Merge pull request #30 from BadWolf1023/optimize-recycle-channels
BadWolf1023 Jul 25, 2024
5130935
Refactor code out to SquadQueue.find_room_by_interaction
BadWolf1023 Jul 25, 2024
767756b
Added /host command
BadWolf1023 Jul 25, 2024
6f24e78
Removed print statements
BadWolf1023 Jul 25, 2024
b47658d
Merge pull request #31 from BadWolf1023/host-command
BadWolf1023 Jul 25, 2024
006d27d
Add race arg to /sub command
BadWolf1023 Jul 25, 2024
12cd334
Merge pull request #32 from BadWolf1023/add-race-arg-for-host-command
BadWolf1023 Jul 25, 2024
6e6cd97
Correct pen times for MKW
BadWolf1023 Jul 25, 2024
1b53697
Merge pull request #33 from BadWolf1023/correct-pen-times
BadWolf1023 Jul 25, 2024
1d04ca1
Move host message text to first message
BadWolf1023 Jul 25, 2024
494e888
Update mogi_objects.py
BadWolf1023 Jul 25, 2024
2dc8c28
Bug fix
BadWolf1023 Jul 25, 2024
2e30635
Another bug fix
BadWolf1023 Jul 25, 2024
fc3d884
Merge pull request #34 from BadWolf1023/move-host-to-first-message
BadWolf1023 Jul 25, 2024
f4b0db2
Auto extend feature
BadWolf1023 Jul 25, 2024
da2dd95
Merge pull request #35 from BadWolf1023/mkw-auto-extend-feature
BadWolf1023 Jul 25, 2024
5591d5a
No teams for MKW 6v6 + drafting instructions
BadWolf1023 Jul 25, 2024
91b2ffb
Bug fix
BadWolf1023 Jul 25, 2024
0e062dc
fix drunk changes
BadWolf1023 Jul 25, 2024
4abadfb
Adjust text formatting
BadWolf1023 Jul 25, 2024
b3a5cc5
Merge pull request #36 from BadWolf1023/mkw-6v6-changes
BadWolf1023 Jul 25, 2024
a50b5e8
Update .gitignore
BadWolf1023 Jul 26, 2024
c2bdfa3
Store staff settings + allow configuration changes
BadWolf1023 Jul 26, 2024
b5d9736
Merge pull request #37 from BadWolf1023/staff-settings
BadWolf1023 Jul 26, 2024
27aa751
config settings for recycle tiers
BadWolf1023 Jul 26, 2024
3f08baf
Merge branch 'finalizations-and-recycle-text-channels' of https://git…
BadWolf1023 Jul 26, 2024
c9144b7
Config checker
BadWolf1023 Jul 26, 2024
faa7e8c
Merge pull request #38 from BadWolf1023/config-assertions
BadWolf1023 Jul 26, 2024
e314a5a
Hotfix for vote issue
BadWolf1023 Jul 27, 2024
68d8a1b
Update mogi_objects.py
BadWolf1023 Jul 27, 2024
3ef4e28
Docker fixes to save staff settings
BadWolf1023 Jul 27, 2024
1550056
Fix temp roles being removed from subs
BadWolf1023 Jul 27, 2024
993ca22
Bug fix: do not attempt assigning role if using threads
BadWolf1023 Jul 29, 2024
54aca1b
Merge pull request #28 from emilp-595/finalizations-and-recycle-text-…
BadWolf1023 Aug 1, 2024
9487622
forces races_left arg in sub to select a number between 1 and 12
itoi06 Aug 3, 2024
9952623
changed the link to the message at mogi start for mkw
itoi06 Aug 3, 2024
289a86e
added mk8dx version of redeploy
itoi06 Aug 3, 2024
b3ba600
Merge pull request #39 from emilp-595/ito-extra
thomasgonda3 Aug 3, 2024
b7f17af
formatted whole project with autopep8 1.6.0 (pycodestyle: 2.8.0)
itoi06 Aug 9, 2024
68c108e
Merge pull request #40 from emilp-595/ito-formatting
thomasgonda3 Aug 9, 2024
0ebaa7b
Initial forced format feature commit
itoi06 Aug 10, 2024
698908e
fixed redeploy files for linux
itoi06 Aug 10, 2024
6f789c6
adjusted example config files to match current production and the sch…
itoi06 Aug 10, 2024
2d9535b
added capability to force format 6v6
itoi06 Aug 13, 2024
36c2d28
Merge pull request #41 from emilp-595/ito-forced-format-mogis
emilp-595 Aug 13, 2024
0aa418e
update mogi list formatting, update purge criteria
cyndaquilx Aug 14, 2024
ad7e7bf
Merge pull request #42 from BadWolf1023/cyndaquilx/list-task-edit
BadWolf1023 Aug 14, 2024
36254a3
Fixed description of schedule_forced_format_times
itoi06 Aug 14, 2024
0dce289
Merge pull request #43 from emilp-595/ito-forced-format-mogis
thomasgonda3 Aug 14, 2024
f6813d9
refactored voteview to prevent voting on forced format mogis while pl…
itoi06 Aug 15, 2024
6f9e5a6
Merge pull request #44 from emilp-595/ito-forced-format-mogis
thomasgonda3 Aug 15, 2024
2038770
fixed 6v6 draft text
itoi06 Aug 16, 2024
fcc1ab6
Merge pull request #45 from emilp-595/ito-6v6fix
thomasgonda3 Aug 16, 2024
994904d
Added the functionality to autoschedule ff mogis
itoi06 Aug 22, 2024
571a5a8
Merge pull request #46 from emilp-595/ito-forced-format-autoscheduling
thomasgonda3 Aug 22, 2024
6150752
added better error handling
itoi06 Aug 24, 2024
c0e59ad
Merge pull request #47 from emilp-595/ito-error-handling
thomasgonda3 Aug 24, 2024
708182a
added host to both messages instead of only top message
itoi06 Aug 24, 2024
107dbaf
Merge pull request #48 from emilp-595/ito-hoststr
thomasgonda3 Aug 24, 2024
2ea3d1d
changed schedule channel to purge posts for longer periods of time in…
itoi06 Aug 29, 2024
b4e2cac
Edited write_history header to include number of rooms
itoi06 Aug 29, 2024
95b8a9e
Merge pull request #49 from emilp-595/ito-quickfix
thomasgonda3 Aug 29, 2024
640f30d
Fixed odd names screwing up discord markdown
itoi06 Aug 30, 2024
40cc0fa
Merge pull request #50 from emilp-595/ito-discord-markdown
thomasgonda3 Aug 30, 2024
983166b
changed the autoscheduler display
itoi06 Sep 8, 2024
4c93c0b
Merge pull request #51 from emilp-595/ito-autoscheduler-format
thomasgonda3 Sep 8, 2024
2160a34
Hard-coded MMR Ranges + redeploy change
emilp-595 Sep 20, 2024
44a5df4
Re-added self.TIER_INFO in initialization
emilp-595 Sep 21, 2024
35a4361
enforce specific team selection in forced format 6v6 mk8dx
itoi06 Jan 15, 2025
f64ed3d
Merge pull request #52 from emilp-595/ito-mk8dx-6v6-force-teams
thomasgonda3 Jan 15, 2025
c1c5da1
sort players within each team by mmr
itoi06 Jan 19, 2025
9bf86f5
Merge pull request #53 from emilp-595/ito-order-teams
thomasgonda3 Jan 19, 2025
5ac69e7
get_tier_mkw function updated
emilp-595 Feb 10, 2025
0c43abc
MKW Tier Calculation Modification
emilp-595 Mar 26, 2025
664dd02
MKW Queue Quick Start
emilp-595 Mar 27, 2025
c1747b8
Fixed Queue Schedule Message
emilp-595 Mar 28, 2025
df44f03
initial commit
itoi06 May 13, 2025
77a927c
Created commands for modifying available vote buttons
itoi06 May 13, 2025
2d10dc8
1st good working version of mkworld bot
itoi06 Jun 11, 2025
ecd114d
created command to change format of ongoing queue
itoi06 Jun 11, 2025
fa17d53
added tiers unique to mkworld
itoi06 Jun 11, 2025
223e0e2
create new forced format if applicable and empty
itoi06 Jun 12, 2025
31b73bd
updating players per room/buttons updates current mogi as well
itoi06 Jun 16, 2025
64c7f7e
created way to schedule future mogis with specific amounts of players
itoi06 Jun 19, 2025
e4c0f95
see daily queue schedule for mkworld
itoi06 Jun 20, 2025
46bc584
fixed join text
itoi06 Jun 22, 2025
a0bffdd
lowered polling of mmr to 30 minutes
itoi06 Jun 23, 2025
0a531d8
fixed security issue commands usable in dms
itoi06 Jun 23, 2025
d00f8a4
queues that should be forced format when ff queue is emptied get sche…
itoi06 Jun 23, 2025
ff4e2c7
quick fix to scoreboard command
itoi06 Jun 23, 2025
beb60f6
fixed bug in autoschedule
itoi06 Jun 23, 2025
484b6be
fixed silly mistake with overwritten variable name
itoi06 Jun 23, 2025
653ec75
updated default config values
itoi06 Jun 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
/.venv*
/config.json
/credentials.json
.idea/*
/example_configs/test/*
staff_settings.pkl
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"python.formatting.provider": "autopep8",
"python.formatting.autopep8Args": ["--aggressive", "--max-line-length=79"],
"editor.formatOnSave": true
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This branch lets the bot recyle using existing text channels rather than creating threads for each room.
2,526 changes: 1,975 additions & 551 deletions cogs/SquadQueue.py

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import json
from enum import Enum, auto
from typing import TypeVar, Type, List
import config_checker

_T = TypeVar('_T')

with open('./config.json', 'r') as cjson:
CONFIG = json.load(cjson)


class Server(Enum):
MKW = auto()
MK8DX = auto()
MKWorld = auto()


if CONFIG["lounge"] == "MKW":
SERVER = Server.MKW
elif CONFIG["lounge"] == "MK8DX":
SERVER = Server.MK8DX
elif CONFIG["lounge"] == "MKWorld":
SERVER = Server.MKWorld
else:
raise ValueError(
f"{CONFIG['lounge']} is not a valid option for the 'lounge' attribute in the config.")


def divide_chunks(list_: list, chunk_size: int):
# looping till length l
for i in range(0, len(list_), chunk_size):
yield list_[i:i + chunk_size]


def flatten(matrix: List[List[_T]]) -> List[_T]:
flat_list = []
for row in matrix:
flat_list.extend(row)
return flat_list


def is_int(var: str) -> bool:
try:
int(var)
return True
except ValueError:
return False


config_checker.check(CONFIG)
103 changes: 103 additions & 0 deletions config_checker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@

STRONGLY_REQUIRED_FIELDS = [
("token", str),
("is_production", bool),
("lounge", str),
("lounge_description", str),
("guild_id", int),
("queue_join_channel", int),
("queue_sub_channel", int),
("queue_list_channel", int),
("queue_history_channel", int),
("queue_general_channel", int),
("queue_schedule_channel", (int, type(None))),
("admin_roles", list),
("admin_roles.list_items", int),
("helper_staff_roles", list),
("helper_staff_roles.list_items", int),
("members_for_channels", list),
("members_for_channels.list_items", (int, bool)),
("roles_for_channels", list),
("roles_for_channels.list_items", int),
("PLACEMENT_PLAYER_MMR", int),
("placement_role_id", int),
("frequently_tagged_role_id", int),
("restricted_role_id", int),
("muted_role_id", int),
("queue_messages", bool),
("sec_between_queue_msgs", int),
("username", str),
("password", str),
("url", str),
("track_type", str),
("FIRST_EVENT_TIME", int),
("FIRST_EVENT_TIME_DESCRIPTION", str),
("FORCED_FORMAT_ORDER", list),
("FORCED_FORMAT_ORDER_OFFSET", int),
("FORCED_FORMAT_HOURLY_OFFSET", int),
("FORCED_FORMAT_AUTOSCHEDULE_AMOUNT", int),
("QUEUES_BETWEEN_FORCED_FORMAT_QUEUE", (int, type(None))),
("JOINING_TIME", int),
("QUEUE_OPEN_TIME", int),
("DISPLAY_OFFSET_MINUTES", int),
("EXTENSION_TIME", int),
("ROOM_JOIN_PENALTY_TIME", int),
("MOGI_LIFETIME", int),
("SUB_RANGE_MMR_ALLOWANCE", int),
("SUB_MESSAGE_LIFETIME_SECONDS", int),
("ROOM_MMR_THRESHOLD", int),
("MATCHMAKING_BOTTOM_MMR", (int, type(None))),
("MATCHMAKING_TOP_MMR", (int, type(None))),
("USE_THREADS", bool)
]


def check(config: dict):
for required_field_name, required_field_type in STRONGLY_REQUIRED_FIELDS:
check_list_items = required_field_name.endswith(".list_items")
if check_list_items:
required_field_name = required_field_name[:-len(".list_items")]

if required_field_name not in config:
raise ValueError(
f"Did not find field '{required_field_name}' in config. Your config appears to be out of date.")
field_data = config[required_field_name]
if not isinstance(required_field_type, tuple):
required_field_type = (required_field_type,)
if check_list_items:
for item in field_data:
if type(item) not in required_field_type:
raise TypeError(
f"""For field '{required_field_name}', expected items to be of type {" or ".join([str(t) for t in required_field_type])}, but items in config were of type {type(item)}""")
else:

if type(field_data) not in required_field_type:
raise TypeError(
f"""For field '{required_field_name}', expected type {" or ".join([str(t) for t in required_field_type])}, but config type is {type(field_data)}""")

# Validate tier channels data if needed
if not config["USE_THREADS"]:
required_field_name = "TIER_CHANNELS"
if required_field_name not in config:
raise ValueError(
f"Did not find field '{required_field_name}' in config. Your config appears to be out of date.")
tier_channel_data = config[required_field_name]
if not isinstance(tier_channel_data, dict):
raise TypeError(
f"""For field '{required_field_name}', expected type dict, but config type is {type(tier_channel_data)}""")
for k, v in tier_channel_data.items():
if not isinstance(k, str):
raise TypeError(
f"""For field '{required_field_name}', the keys must all be of type str, but a key of type {type(k)} was found.""")
needed_keys = [("tier_role_id", int), ("channel_ids",
list), ("role_ids_can_see_already", list)]
for sub_k, sub_type in needed_keys:
if sub_k not in v:
raise ValueError(
f"Did not find field '{sub_k}' in each item of TIER_CHANNELS in the config. Your config appears to be out of date.")
sub_data = v[sub_k]
if not isinstance(sub_data, sub_type):
raise TypeError(
f"""For field '{sub_k}' in TIER_CHANNELS data, found type {type(sub_data)}, expected {sub_type}.""")

print("Config file validated.")
56 changes: 56 additions & 0 deletions example_configs/prod/mk8dx_prod_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"token": "",
"is_production": true,
"lounge": "MK8DX",
"lounge_description": "Valid options are MKW, MKWorld, or MK8DX",
"guild_id": 445404006177570829,
"queue_join_channel": 1186158671525318719,
"queue_sub_channel": 1186158767029620766,
"queue_list_channel": 1221665101904478340,
"queue_history_channel": 1194440106266865684,
"queue_general_channel": 1186158671525318719,
"queue_schedule_channel": 1274492585917812807,
"admin_roles": [
464610815299944448,
910528103225389107
],
"helper_staff_roles": [
910528103225389107
],
"members_for_channels": [
934740707934081035,
743532508343304242,
735910635082219570
],
"roles_for_channels": [],
"PLACEMENT_PLAYER_MMR": 1500,
"placement_role_id": 730980761322389504,
"frequently_tagged_role_id": 682445864400453739,
"restricted_role_id": 600495108999086090,
"muted_role_id": 600495108999086090,
"queue_messages": true,
"sec_between_queue_msgs": 2,
"username": "username",
"password": "password",
"url": "https://lounge.mkcentral.com/",
"track_type": "rt",
"FIRST_EVENT_TIME": 0,
"FIRST_EVENT_TIME_DESCRIPTION": "First event time is the number of minutes from 0:00 UTC that the bot would run the first event of the day. As an example, if this were set to 5, and the QUEUE_OPEN_TIME were set to 70, and the bot were to reboot at 2:00 UTC, the next event would immediately start and create rooms at 2:25 UTC.",
"FORCED_FORMAT_ORDER": ["FFA", "3v3", "FFA", "4v4"],
"FORCED_FORMAT_ORDER_OFFSET": 3,
"FORCED_FORMAT_HOURLY_OFFSET": 0,
"FORCED_FORMAT_AUTOSCHEDULE_AMOUNT": 1,
"QUEUES_BETWEEN_FORCED_FORMAT_QUEUE": 9,
"QUEUE_OPEN_TIME": 60,
"JOINING_TIME": 55,
"DISPLAY_OFFSET_MINUTES": 5,
"EXTENSION_TIME": 3,
"ROOM_JOIN_PENALTY_TIME": 6,
"MOGI_LIFETIME": 180,
"SUB_RANGE_MMR_ALLOWANCE": 500,
"SUB_MESSAGE_LIFETIME_SECONDS": 1200,
"ROOM_MMR_THRESHOLD": 9999999,
"MATCHMAKING_BOTTOM_MMR": null,
"MATCHMAKING_TOP_MMR": null,
"USE_THREADS": true
}
67 changes: 67 additions & 0 deletions example_configs/prod/mkw_ct_prod_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"token": "",
"is_production": true,
"lounge": "MKW",
"lounge_description": "Valid options are MKW, MKWorld, or MK8DX",
"guild_id": 387347467332485122,
"queue_join_channel": 1253109700107567155,
"queue_sub_channel": 1253109752418930779,
"queue_list_channel": 1253109466027655338,
"queue_history_channel": 1253109800196243618,
"queue_general_channel": 1253109398193045534,
"queue_schedule_channel": null,
"admin_roles": [
387347888935534593,
877629421811540016
],
"helper_staff_roles": [
520808674411937792,
792891432301625364,
521149807994208295
],
"members_for_channels": [
235148962103951360,
155149108183695360,
815483289515196416,
892420397570592768,
775415990238314518,
774812906830299136,
745443073202323586,
774866940950872095,
1019051989734273054
],
"roles_for_channels": [
520808645252874240,
520808674411937792
],
"PLACEMENT_PLAYER_MMR": 750,
"placement_role_id": 723753340063842345,
"frequently_tagged_role_id": 1167985222533533817,
"restricted_role_id": 797208908153618452,
"muted_role_id": 434887701662007296,
"queue_messages": true,
"sec_between_queue_msgs": 2,
"username": "username",
"password": "password",
"url": "https://www.mkwlounge.gg",
"track_type": "ct",
"FIRST_EVENT_TIME": 5,
"FIRST_EVENT_TIME_DESCRIPTION": "First event time is the number of minutes from 0:00 UTC that the bot would run the first event of the day. As an example, if this were set to 5, and the QUEUE_OPEN_TIME were set to 70, and the bot were to reboot at 2:00 UTC, the next event would immediately start and create rooms at 2:25 UTC.",
"FORCED_FORMAT_ORDER": [],
"FORCED_FORMAT_ORDER_OFFSET": 0,
"FORCED_FORMAT_HOURLY_OFFSET": 0,
"FORCED_FORMAT_AUTOSCHEDULE_AMOUNT": 1,
"QUEUES_BETWEEN_FORCED_FORMAT_QUEUE": null,
"QUEUE_OPEN_TIME": 80,
"JOINING_TIME": 75,
"DISPLAY_OFFSET_MINUTES": 0,
"EXTENSION_TIME": 5,
"ROOM_JOIN_PENALTY_TIME": 8,
"MOGI_LIFETIME": 150,
"SUB_RANGE_MMR_ALLOWANCE": 700,
"SUB_MESSAGE_LIFETIME_SECONDS": 1200,
"ROOM_MMR_THRESHOLD": 9000,
"MATCHMAKING_BOTTOM_MMR": null,
"MATCHMAKING_TOP_MMR": null,
"USE_THREADS": true
}
Loading