Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
44236eacec | |||
be43d3e03a | |||
f5097a9d2d | |||
42cf3afcb4 | |||
6ec8613b7f | |||
5135786ef6 | |||
3849dc4927 | |||
72d3432d44 | |||
27ab3bde67 | |||
b5f950a1ba |
@ -1,5 +1,9 @@
|
||||
# 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
|
||||
|
||||
- Discards the database engine in favour of data storage in `.yml` files
|
||||
|
@ -219,5 +219,6 @@ 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.
|
||||
This should also mean that the sign-up prompts should persist over reboots.
|
||||
The best possible way of setting this up is probably using functions to dynamically set up and remove component call-backs.
|
||||
Also components do not need to all have unique names, just unique names in the message they are part of.
|
||||
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.
|
||||
Discord will need to make substantial API updates in the future for rolling out the Threads feature.
|
||||
The bot will need updating again then.
|
||||
|
108
TODO.md
108
TODO.md
@ -1,107 +1,11 @@
|
||||
# To Do
|
||||
# To Do for Version 3.1
|
||||
|
||||
- [ ] Testing
|
||||
- [x] Dockerise
|
||||
- [ ] Infer/Transfer data from old bot
|
||||
- [ ] Deploy
|
||||
## Docker
|
||||
|
||||
## 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)``
|
||||
- [x] Re-build using `python:slim` as base image
|
||||
|
||||
## Bot Functionality and Processes
|
||||
|
||||
- [ ] ~~'Delete Commands' Function~~
|
||||
- [ ] ~~'Register Commands' Function~~
|
||||
- [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`.
|
||||
- [ ] Add support for Discord Threads following Discord Py library update
|
||||
- [ ] Update permission settings for GMs on game channels to support threads
|
||||
- [ ] ~~Change component response architecture to use dynamic callback functions instead of global listeners.~~ Not suitable because it does not provide persistence across reboots.
|
||||
|
@ -1,7 +1,7 @@
|
||||
FROM python:3.9.6-buster
|
||||
RUN apt-get update -y && apt-get upgrade -y && apt-get install libopus0 -y
|
||||
FROM python:3.9.6-slim
|
||||
COPY . /usr/src/app
|
||||
WORKDIR /usr/src/app
|
||||
RUN pip install --upgrade pip
|
||||
RUN pip install -r requirements.txt
|
||||
RUN apt-get update -y && apt-get upgrade -y && apt-get install libopus0 -y && \
|
||||
pip install --upgrade pip setuptools wheel && pip install -r requirements.txt && \
|
||||
apt-get autoremove -y
|
||||
CMD python3 -u ./bot.py
|
@ -17,6 +17,15 @@ class PitchListener(commands.Cog, name='Pitch Listener'):
|
||||
def __init__(self, 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')
|
||||
async def _pitch_listener(self, ctx:ComponentContext):
|
||||
conf = yaml_load(configFile)
|
||||
|
@ -23,7 +23,8 @@ class RestrictionListener(commands.Cog, name='Membership Restriction Listener'):
|
||||
lookup = yaml_load(lookupFile)
|
||||
if not conf[guildStr].get('restrict',False): return
|
||||
if message.author.bot: return
|
||||
if str(message.channel.category) in categories[guildStr]: return
|
||||
if message.channel.category is None: 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]['membership']]): return
|
||||
if message.channel.overwrites_for(message.author).manage_channels: return
|
||||
|
@ -129,7 +129,7 @@ class Configuration(commands.Cog, name='Configuration Commands'):
|
||||
if self.client.get_cog('Pitch Command') is None:
|
||||
loadCog(f'./{cogsDir}/slashcommands/secondary/pitch.py')
|
||||
flag = True
|
||||
if flag: await self.client.slash.sync_all_commands()
|
||||
if flag: await self.client.slash.sync_all_commands()
|
||||
|
||||
@cog_ext.cog_subcommand(
|
||||
base='config',
|
||||
|
@ -1,8 +1,9 @@
|
||||
version: '3.1'
|
||||
version: '3.5'
|
||||
|
||||
services:
|
||||
geasbot-app:
|
||||
build: ./app
|
||||
container_name: geas_bot
|
||||
volumes:
|
||||
- ./app:/usr/src/app
|
||||
restart: always
|
||||
restart: unless-stopped
|
Loading…
Reference in New Issue
Block a user