aboutsummaryrefslogtreecommitdiffstats
path: root/tests/base.py (unfollow)
Commit message (Collapse)AuthorLines
2020-03-22HelpChannels: use more specific type hints for queuesGravatar MarkKoz-2/+2
2020-03-22HelpChannels: limit channels to a total of 50Gravatar MarkKoz-1/+3
Discord has a hard limit of 50 channels per category. It was decided 50 is plenty for now so no work will be done to support more than 50.
2020-03-22HelpChannels: explain the system in the cog docstringGravatar MarkKoz-1/+30
2020-03-22HelpChannels: cancel the task in _scheduled_taskGravatar MarkKoz-0/+2
2020-03-22HelpChannels: use >= instead of > to determine if timed outGravatar MarkKoz-1/+1
2020-03-22HelpChannels: compare contents to confirm message is a dormant messageGravatar MarkKoz-1/+10
* Add a new function to check if a message is a dormant message
2020-03-22HelpChannels: add a function to send or edit the available messageGravatar MarkKoz-5/+16
Edits the dormant message or sends a new message if the dormant one cannot be found.
2020-03-22HelpChannels: add a function to get the last message in a channelGravatar MarkKoz-5/+15
2020-03-22HelpChannels: put channels in the queue when they go dormantGravatar MarkKoz-0/+3
2020-03-22HelpChannels: add missing units of time in messagesGravatar MarkKoz-3/+3
2020-03-22HelpChannels: fix acquisition of the on_message lockGravatar MarkKoz-1/+1
* Use async_with * Don't call acquire()
2020-03-22HelpChannels: ignore messages sent by botsGravatar MarkKoz-0/+3
2020-03-22Resources: make all element names lower casedGravatar MarkKoz-118/+118
2020-03-22HelpChannels: fix creation of the init_cog taskGravatar MarkKoz-1/+1
The task has to be created on a specific loop because when the cog is instantiated, the event loop is not yet running.
2020-03-22Remove the free extensionGravatar MarkKoz-104/+0
Obsolete due to the new help channel system.
2020-03-22Bot: load the help channels extensionGravatar MarkKoz-0/+1
2020-03-22HelpChannels: add loggingGravatar MarkKoz-6/+83
2020-03-22HelpChannels: use a lock to prevent a channel from being processed twiceGravatar MarkKoz-5/+9
2020-03-22HelpChannels: wait for cog to be initialised before processing messagesGravatar MarkKoz-0/+2
2020-03-22HelpChannels: implement _scheduled_taskGravatar MarkKoz-0/+5
Make a channel dormant after specified timeout or reschedule if it's still active.
2020-03-22HelpChannels: cancel an existing task before scheduling a new oneGravatar MarkKoz-1/+9
2020-03-22HelpChannels: cancel scheduled tasks when the cog unloadsGravatar MarkKoz-2/+5
* Make cog_unload a regular method instead of a coroutine
2020-03-22HelpChannels: implement the on_message listenerGravatar MarkKoz-0/+9
It handles making channels in-use and replacing them with new available channels.
2020-03-22HelpChannels: add a function to make channels in-useGravatar MarkKoz-0/+13
It handles moving the channel to the category and scheduling it to be made dormant.
2020-03-22HelpChannels: implement the !dormant commandGravatar MarkKoz-1/+8
Basically a wrapper around move_to_dormant which ensures the current channel is in use. If it's not in-use, from the invoker's perspective, the command silently fails (it does at least log). InChannelCheckFailure was considered but it seemed like it'd be too spammy, especially if there'd be a long list of allowed channels.
2020-03-22HelpChannels: implement move_to_dormantGravatar MarkKoz-0/+8
Moves a channel to the Dormant category. Permissions will be synced with the new category.
2020-03-22HelpChannels: implement move_to_availableGravatar MarkKoz-0/+14
Moves a channel to the Available category. Permissions will be synced with the new category. * Add stubs for channel topic constants
2020-03-22HelpChannels: implement get_available_candidateGravatar MarkKoz-1/+15
Return a dormant channel to turn into an available channel, waiting indefinitely until one becomes available in the queue.
2020-03-22HelpChannels: implement create_dormantGravatar MarkKoz-2/+16
Create and return a new channel in the Dormant category or return None if no names remain. The overwrites get synced with the category if none are explicitly specified for the channel.
2020-03-22HelpChannels: implement get_idle_timeGravatar MarkKoz-3/+15
A design change was made to account for a channel being empty i.e. no messages ever sent. In such case, the function will return None. * Move a channel to the Dormant category if the channel has no messages
2020-03-22HelpChannels: make move_idle_channels only handle a single channelGravatar MarkKoz-10/+11
This function will get re-used in _scheduled_task, but it will only need to move a single channel. Therefore, to promote code re-use, this change was made. The init_cog will instead do a loop to call this on all channels in the in-use category.
2020-03-22HelpChannels: fix creation of queues in init_cogGravatar MarkKoz-2/+2
* Remove await from create_channel_queue * Call the correct function to create the name queue
2020-03-22HelpChannels: implement move_idle_channelsGravatar MarkKoz-1/+10
Make all in-use channels dormant if idle or schedule the move if still active. This is intended to clean up the in-use channels when the bot restarts and has lost the tasks it had scheduled in another life.
2020-03-22Constants: add a named tuple for scheduled task dataGravatar MarkKoz-2/+9
2020-03-22Constants: implement init_availableGravatar MarkKoz-0/+5
Initialises the Available category with channels if any are missing.
2020-03-22Constants: add a help channel name prefix constantGravatar MarkKoz-1/+5
2020-03-22HelpChannels: implement create_channel_queueGravatar MarkKoz-2/+15
It returns a queue of dormant channels in random order. The queue will be used to get the next available channel. Using a random order is simpler than trying to sort by the timestamp of the most recent message in each channel and this decision will only "negatively" impact the system when the bot restarts or the extension is reloaded. Ultimately, it just means in such events some dormant channels may chosen to become active again sooner than expected.
2020-03-22HelpChannels: only yield text channels from a categoryGravatar MarkKoz-2/+2
2020-03-22HelpChannels: retrieve category channels more efficientlyGravatar MarkKoz-7/+15
The channels property of categories sorts the channels before returning them. * Add a generator function to get category channels
2020-03-22HelpChannels: implement create_name_queueGravatar MarkKoz-1/+5
It returns a queue of element names to use for creating new channels, taking into account which names are already being used.
2020-03-22HelpChannels: add a function to return used channel namesGravatar MarkKoz-0/+13
2020-03-22HelpChannels: set a ready event when cog initialisation completesGravatar MarkKoz-0/+3
2020-03-22HelpChannels: cancel the init task when unloading the cogGravatar MarkKoz-1/+5
This will prevent initialisation from proceeding when the category channels fail to be retrieved.
2020-03-22HelpChannels: add a function to initialise the cogGravatar MarkKoz-0/+17
It's created as a task in __init__ because coroutines cannot be awaited in there.
2020-03-22HelpChannels: add a function to init the categoriesGravatar MarkKoz-0/+16
As the categories are essential for the functionality of the cog, if this function fails to get a category, it will remove/unload the cog.
2020-03-22HelpChannels: add a function to get a channel or fetch it from APIGravatar MarkKoz-0/+8
2020-03-22HelpChannels: add a loggerGravatar MarkKoz-0/+3
2020-03-22HelpChannels: add method stubsGravatar MarkKoz-1/+48
2020-03-22Constants: add help category constantsGravatar MarkKoz-3/+7
The original category was re-purposed as the "in-use" category so that deployment of the new system will not interrupt ongoing help sessions.
2020-03-22HelpChannels: add constants for active/dormant messagesGravatar MarkKoz-0/+24