Compare commits
No commits in common. "master" and "version-3" have entirely different histories.
@ -1,9 +1,5 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## Minor Updates in Version 3.0.1
|
|
||||||
|
|
||||||
- Re-builds the Docker image to use a `python:slim` base instead of `python:buster`, reducing the footprint of the image to a quarter of its previous size.
|
|
||||||
|
|
||||||
## Major Changes in Version 3
|
## Major Changes in Version 3
|
||||||
|
|
||||||
- Discards the database engine in favour of data storage in `.yml` files
|
- Discards the database engine in favour of data storage in `.yml` files
|
||||||
|
@ -219,6 +219,5 @@ Programming around this will need a further layer of complexity, involving flags
|
|||||||
|
|
||||||
I have set the member verification prompt to use a global listener to avoid a situation where it creates several backlogged processes when multiple people post sign-ups at the same time.
|
I have set the member verification prompt to use a global listener to avoid a situation where it creates several backlogged processes when multiple people post sign-ups at the same time.
|
||||||
This should also mean that the sign-up prompts should persist over reboots.
|
This should also mean that the sign-up prompts should persist over reboots.
|
||||||
Other developers for Discord Components recommended the use of dynamic call-backs, however these do not persist after reboots so are not suitable for this purpose.
|
The best possible way of setting this up is probably using functions to dynamically set up and remove component call-backs.
|
||||||
Discord will need to make substantial API updates in the future for rolling out the Threads feature.
|
Also components do not need to all have unique names, just unique names in the message they are part of.
|
||||||
The bot will need updating again then.
|
|
||||||
|
108
TODO.md
108
TODO.md
@ -1,11 +1,107 @@
|
|||||||
# To Do for Version 3.1
|
# To Do
|
||||||
|
|
||||||
## Docker
|
- [ ] Testing
|
||||||
|
- [x] Dockerise
|
||||||
|
- [ ] Infer/Transfer data from old bot
|
||||||
|
- [ ] Deploy
|
||||||
|
|
||||||
- [x] Re-build using `python:slim` as base image
|
## Bot Architecture
|
||||||
|
|
||||||
|
- [x] Simplify directory tree
|
||||||
|
- [x] Split event listeners into individual cogs.
|
||||||
|
- [x] Update with re-organised data and config structure
|
||||||
|
- [x] Correct references to data in existing cogs.
|
||||||
|
- [x] Setup minimally functioning configs of guild on startup
|
||||||
|
- [x] Synchronise core configuration `/commands` on startup
|
||||||
|
- [ ] ~~Synchronise secondary `/commands` on complete configuration~~ ``(see below)``
|
||||||
|
|
||||||
## Bot Functionality and Processes
|
## Bot Functionality and Processes
|
||||||
|
|
||||||
- [ ] Add support for Discord Threads following Discord Py library update
|
- [ ] ~~'Delete Commands' Function~~
|
||||||
- [ ] Update permission settings for GMs on game channels to support threads
|
- [ ] ~~'Register Commands' Function~~
|
||||||
- [ ] ~~Change component response architecture to use dynamic callback functions instead of global listeners.~~ Not suitable because it does not provide persistence across reboots.
|
- [x] Infer Permissions from Config
|
||||||
|
- [x] Dynamic Command Prefixes
|
||||||
|
- [ ] Infer current games from Server Structure
|
||||||
|
`Create a separate cog to do this instead of having a migrate command, install the cog temporarily and remove the cog once migration is done.`
|
||||||
|
- [ ] Re-enable logging
|
||||||
|
- [x] Delete Dev/Test Functions
|
||||||
|
- [x] Error handlers
|
||||||
|
- [x] Debug Features
|
||||||
|
- [ ] ~~Command Installer/Uninstaller~~
|
||||||
|
- [x] Help Channel Event Listener
|
||||||
|
- [x] Add Config key for Help Channel
|
||||||
|
- [ ] ~~Slash Command Buttons or~~ `This kind of got subsumed into other features.`
|
||||||
|
- [ ] ~~Reaction listener selectors~~ `So did this.`
|
||||||
|
- [x] Member Verification
|
||||||
|
- [x] Add Config key membership signup channels
|
||||||
|
- [x] Add config keys: Membership Category Roles
|
||||||
|
- [x] Message Receive listener
|
||||||
|
- [x] ~~Message React listener~~ or buttons `Used buttons waiting within the same command thread. Possibly update to global listener if performance is affected.`
|
||||||
|
- [x] Membership Restriction
|
||||||
|
- [x] Message Receive Listener
|
||||||
|
- [x] Membership Validation Listener
|
||||||
|
- [x] Re-synchronise commands after any relevant config changes `(See from above)`
|
||||||
|
- [ ] Role Delete (~~member~~, ~~admin~~, ~~game~~) `Admin role missing won't cause any issues as server role will still remain in control`
|
||||||
|
`Deleting membership roles will also trigger a mess. Event listener will trigger and attempt to execute simultaneously with the command to delete the role, which will cascade into several errors. In order to make this work, it is best to have the commands interact solely with the roles, and then subsequently the listeners to sync with the data.`
|
||||||
|
- [ ] ~~Channel delete (notifications, logs, game text channel)~~ `There aren't any critical settings that depend on this just yet, and it is hard to set this up without circularity`
|
||||||
|
- [ ] ~~Category delete (games)~~ `Circularity problem: if the category delete event listener is set up, it will react to the bot deleting categories when managing games.`
|
||||||
|
- [x] Flag for checking completeness of configuration for a guild.
|
||||||
|
- [x] Function for checking configs for completeness
|
||||||
|
- [ ] ~~Synchronise game channel on role updates~~
|
||||||
|
- [ ] ~~Exception to event listener to prevent circularity~~ ~~`unsure what this means`~~
|
||||||
|
`I remember what this is now: if you have a listener for when roles get deleted, and if the bot deletes a role, then it triggers the listener. It might be worth restructuring this such that the Bot command only deletes the role, which then triggers the listener that deletes the categories and synchronises data. That way, the roles can be deleted manually or via the command. Otherwise, it is not possible in the Discord API to have this exception, as the Bot only responds to the 'Guild' deleting the role, not the user or bot or admin that issued the command.`
|
||||||
|
|
||||||
|
## Event Listeners
|
||||||
|
|
||||||
|
## Review Configs When
|
||||||
|
|
||||||
|
- [x] Guild Changing Ownership
|
||||||
|
- [x] Roles Modified
|
||||||
|
- [x] Mod Channel Deleted
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
|
||||||
|
- [x] Configure Bot function and sub commands
|
||||||
|
- [x] botrole (role group)
|
||||||
|
- [x] committeerole (role group)
|
||||||
|
- [x] modchannel (channel group)
|
||||||
|
- [x] help channel (channel group)
|
||||||
|
- [x] signup channel (channel group)
|
||||||
|
- [x] newcomer role (role group)
|
||||||
|
- [x] returning player role (role group)
|
||||||
|
- [x] student role (role group)
|
||||||
|
- [x] help notifications (notification group)
|
||||||
|
- [x] signup notifications (notification group)
|
||||||
|
- [x] Set up timeslots
|
||||||
|
- [x] Delete timeslots
|
||||||
|
- [x] Base command
|
||||||
|
- [x] ~~Delete all games with the timeslot~~
|
||||||
|
Do the opposite: block deleting timeslots with existing games.
|
||||||
|
|
||||||
|
- [x] List timeslots
|
||||||
|
- [x] Set up command permissions
|
||||||
|
- [x] Slash Commands
|
||||||
|
- [x] Admin Commands
|
||||||
|
- [x] Game Management Commands
|
||||||
|
- [x] Native Bot Commands
|
||||||
|
- [x] Migrate existing bot commands
|
||||||
|
- [x] setupgame
|
||||||
|
- [x] ~~definebotrole~~ config
|
||||||
|
- [x] deletegame
|
||||||
|
- [x] ~~reset~~ purge
|
||||||
|
- [ ] ~~migrate~~ `See above`
|
||||||
|
- [x] ~~kickplayer~~ `/player remove`
|
||||||
|
- [x] ~~addplayer~~ `/player add`
|
||||||
|
- [x] ~~leavegame~~ `/player leave`
|
||||||
|
- [x] Pitch command and sub-commands
|
||||||
|
- [ ] ~~run~~ `Combined both sub-commands into single command and prompt response.`
|
||||||
|
- [ ] ~~clear~~
|
||||||
|
|
||||||
|
## Misc
|
||||||
|
|
||||||
|
- [x] Review documentation
|
||||||
|
- [x] Finalise README.md
|
||||||
|
- [x] CHANGELOG.md
|
||||||
|
- [x] COMMANDS.md
|
||||||
|
- [x] resources.md
|
||||||
|
- [x] Make sure to document `not using discord_components and staying with discord-py-slash-commands library alone`.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
FROM python:3.9.6-slim
|
FROM python:3.9.6-buster
|
||||||
|
RUN apt-get update -y && apt-get upgrade -y && apt-get install libopus0 -y
|
||||||
COPY . /usr/src/app
|
COPY . /usr/src/app
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
RUN apt-get update -y && apt-get upgrade -y && apt-get install libopus0 -y && \
|
RUN pip install --upgrade pip
|
||||||
pip install --upgrade pip setuptools wheel && pip install -r requirements.txt && \
|
RUN pip install -r requirements.txt
|
||||||
apt-get autoremove -y
|
|
||||||
CMD python3 -u ./bot.py
|
CMD python3 -u ./bot.py
|
@ -17,15 +17,6 @@ class PitchListener(commands.Cog, name='Pitch Listener'):
|
|||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
self.client = client
|
self.client = client
|
||||||
|
|
||||||
@commands.Cog.listener(name='on_component')
|
|
||||||
async def _response_defer(self, ctx:ComponentContext):
|
|
||||||
pitches = yaml_load(pitchesFile)
|
|
||||||
guildStr = str(ctx.guild.id)
|
|
||||||
if not pitches.get(guildStr, {}): return # If no pitches for current guild, ignore.
|
|
||||||
[timeslot] = [*pitches[guildStr]]
|
|
||||||
if ctx.origin_message.id not in pitches[guildStr][timeslot]['messages'] + [pitches[guildStr][timeslot]['control']]: return # If the context id is not in the pitch menu, ignore
|
|
||||||
await ctx.defer(hidden = True)
|
|
||||||
|
|
||||||
@commands.Cog.listener(name='on_component')
|
@commands.Cog.listener(name='on_component')
|
||||||
async def _pitch_listener(self, ctx:ComponentContext):
|
async def _pitch_listener(self, ctx:ComponentContext):
|
||||||
conf = yaml_load(configFile)
|
conf = yaml_load(configFile)
|
||||||
|
@ -23,8 +23,7 @@ class RestrictionListener(commands.Cog, name='Membership Restriction Listener'):
|
|||||||
lookup = yaml_load(lookupFile)
|
lookup = yaml_load(lookupFile)
|
||||||
if not conf[guildStr].get('restrict',False): return
|
if not conf[guildStr].get('restrict',False): return
|
||||||
if message.author.bot: return
|
if message.author.bot: return
|
||||||
if message.channel.category is None: return
|
if str(message.channel.category) in categories[guildStr]: return
|
||||||
if str(message.channel.category.id) not in categories[guildStr]: return
|
|
||||||
if (set(message.author.roles) & set([message.guild.get_role(x) for x in conf[guildStr]['roles']['admin']]) or message.author == message.guild.owner): return
|
if (set(message.author.roles) & set([message.guild.get_role(x) for x in conf[guildStr]['roles']['admin']]) or message.author == message.guild.owner): return
|
||||||
if set(message.author.roles) & set([message.guild.get_role(x) for x in conf[guildStr]['membership']]): return
|
if set(message.author.roles) & set([message.guild.get_role(x) for x in conf[guildStr]['membership']]): return
|
||||||
if message.channel.overwrites_for(message.author).manage_channels: return
|
if message.channel.overwrites_for(message.author).manage_channels: return
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
version: '3.5'
|
version: '3.1'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
geasbot-app:
|
geasbot-app:
|
||||||
build: ./app
|
build: ./app
|
||||||
container_name: geas_bot
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./app:/usr/src/app
|
- ./app:/usr/src/app
|
||||||
restart: unless-stopped
|
restart: always
|
Loading…
Reference in New Issue
Block a user