aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
...
| | | * | | HelpChannels: fix typo in docstringGravatar MarkKoz2020-03-29-1/+1
| | | | | |
| | | * | | BotCog: fix AttributeError getting a category for a DMChannelGravatar MarkKoz2020-03-29-1/+1
| | | | | |
| | | * | | HelpChannels: remove positions from element namesGravatar MarkKoz2020-03-29-127/+125
| | | | | | | | | | | | | | | | | | | | | | | | There is no longer a reliance on static alphabetical position numbers.
| | | * | | HelpChannels: fix alphabetical sorting of dormant channelsGravatar MarkKoz2020-03-29-13/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a channel is moved, all channels below have their positions incremented by 1. This threw off the previous implementation which relied on position numbers being static. Co-authored-by: Sebastiaan Zeeff <[email protected]>
| | | * | | Constants: add a config value to toggle help channels extensionGravatar MarkKoz2020-03-22-6/+10
| | | | | |
| | | * | | HelpChannels: mention the helper notifications in cog docstringGravatar MarkKoz2020-03-22-0/+1
| | | | | |
| | | * | | HelpChannels: set idle minutes to 30 & max total channels to 32Gravatar MarkKoz2020-03-22-2/+2
| | | | | |
| | | * | | HelpChannels: write channel topicsGravatar MarkKoz2020-03-22-4/+14
| | | | | |
| | | * | | Resources: add newline to end of elements.jsonGravatar MarkKoz2020-03-22-1/+1
| | | | | |
| | | * | | HelpChannels: remove permission overwrites completelyGravatar MarkKoz2020-03-22-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Resetting a specific permission still keeps the overwrite for the member around despite having default values. These will accumulate over time so they should be completely removed once the permission needs to be reset.
| | | * | | HelpChannels: use constant for command prefix in notificationGravatar MarkKoz2020-03-22-1/+1
| | | | | |
| | | * | | HelpChannels: fix unawaited coro warning for set_permissionsGravatar MarkKoz2020-03-22-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was happening when attempting to schedule a task twice for a user. Because the scheduler refuses to schedule a duplicate, the coroutine is deallocated right away without being awaited (or closed explicitly by `scheduled_task`). To fix, any existing task is cancelled before scheduling. This also means if somehow a user bypasses the lack of permissions, their cooldown will be updated. However, it probably doesn't make a difference as if they can bypass once, they likely can bypass again.
| | | * | | HelpChannels: fix unawaited coro warningGravatar MarkKoz2020-03-22-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | Explicitly close the callback if it's a coroutine.
| | | * | | HelpChannels: remove name attribute access for channels in logsGravatar MarkKoz2020-03-22-23/+23
| | | | | | | | | | | | | | | | | | | | | | | | Can rely on `__str__` already being a channel's name.
| | | * | | HelpChannels: make category checks direct & efficientGravatar MarkKoz2020-03-22-9/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace retrieval of all channels of a category with a direct comparison of the categories themselves. In the case of the `on_message` listener, the change enables the check to be done before the lock acquisition. This is because it doesn't rely on the channels in the category to be up to date. In fact, it doesn't even need the category object so it can exit early without needing to wait for the cog to be ready.
| | | * | | HelpChannels: include info about claim cooldowns in available messageGravatar MarkKoz2020-03-22-0/+3
| | | | | |
| | | * | | HelpChannels: reset send permissionsGravatar MarkKoz2020-03-22-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ensures everyone has a clean slate when the bot restarts or the cog reloads since the tasks to reinstate permissions would have been cancelled in those cases.
| | | * | | HelpChannels: allow users to claim a new channel every 15 minutesGravatar MarkKoz2020-03-22-0/+24
| | | | | |
| | | * | | HelpChannels: create generic way to schedule any awaitableGravatar MarkKoz2020-03-22-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To support scheduling different coroutines, `_scheduled_task` now accepts an awaitable in the data arg. The data arg is actually a named tuple of the wait time and the awaitable.
| | | * | | HelpChannels: prevent cog load if config is invalidGravatar MarkKoz2020-03-22-7/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They must be greater than 0 because the cog obviously couldn't do anything without any channels to work with. It must be greater than max_available because it'd otherwise be impossible to maintain that many channels in the Available category. * Create a new function to validate the value * Move validation against MAX_CHANNELS_PER_CATEGORY into the function rather than just logging a warning
| | | * | | HelpChannels: initialise available channels after moving idle onesGravatar MarkKoz2020-03-22-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will ensure the maximum amount of dormant channels possible before attempting to move any to the available category. It also allows the dormant command to already be enabled in case there are still no dormant channels when trying to init available channels.
| | | * | | HelpChannels: disable the dormant command until cog is readyGravatar MarkKoz2020-03-22-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ready event wasn't used because channels could change categories between the time the command is invoked and the cog is ready (e.g. if move_idle_channel wasn't called yet). his may confused users. So would potentially long delays for the cog to become ready.
| | | * | | Scheduler: fix dict size changing while cancelling all tasksGravatar MarkKoz2020-03-22-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Make a copy of the dict * Add a `ignore_missing` param to `cancel_task` to suppress the warning for a task not being found
| | | * | | HelpChannels: fix last notification time not being setGravatar MarkKoz2020-03-22-1/+3
| | | | | |
| | | * | | HelpChannels: fix task cancelling itselfGravatar MarkKoz2020-03-22-2/+0
| | | | | |
| | | * | | Scheduler: fix incorrect task id in error logGravatar MarkKoz2020-03-22-1/+1
| | | | | |
| | | * | | HelpChannels: cancel existing task in the dormant commandGravatar MarkKoz2020-03-22-0/+1
| | | | | |
| | | * | | HelpChannels: fix candidate channel not being returned after waitingGravatar MarkKoz2020-03-22-1/+1
| | | | | |
| | | * | | HelpChannels: remove loop arg from schedule_task callsGravatar MarkKoz2020-03-22-2/+2
| | | | | |
| | | * | | HelpChannels: explicitly specify if a task should be cancelledGravatar MarkKoz2020-03-22-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When rescheduling an idle channel, the task will only be cancelled if the function was told the channel should currently have a task scheduled. This means warnings for missing tasks will appear when they should. The previous approach of checking if a task exists was flawed because it had no way to tell whether a task *should* exist. It assumed nothing is wrong if a task doesn't exist. Currently, the only case when a task shouldn't exist is when the cog is initialised and channels from the bot's previous life are being scheduled.
| | | * | | Scheduler: add a method to cancel all tasksGravatar MarkKoz2020-03-22-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The dictionary which was iterated to cancel tasks is now "private". Therefore, the scheduler should provide a public API for cancelling tasks. * Delete the task before cancelling it to prevent the done callback, however unlikely it may be, from deleting the task first
| | | * | | HelpChannels: rename elements dict to name_positionsGravatar MarkKoz2020-03-22-3/+3
| | | | | |
| | | * | | HelpChannels: prefix channel names after reading from fileGravatar MarkKoz2020-03-22-15/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prefixing them early on means subsequent code doesn't have to deal with stripping the prefix from channel names in order to get their positions. * Remove `count` parameter from `get_names`; define it in the body
| | | * | | HelpChannels: cancel channel queue tasks on cog unloadGravatar MarkKoz2020-03-22-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Store queue get() tasks in a list * Create a separate function to wait for a channel from the queue * Add comments for the various groups of attributes defined in __init__
| | | * | | HelpChannels: add trace logging for notificationsGravatar MarkKoz2020-03-22-0/+5
| | | | | |
| | | * | | HelpChannels: move newest in-use channel to the topGravatar MarkKoz2020-03-22-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This gives the newest questions the most visibility.
| | | * | | BotCog: determine if a help channel by checking its categoryGravatar MarkKoz2020-03-22-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Initialising the dictionary with help channel IDs doesn't work anymore since help channels are now dynamic.
| | | * | | Constants: remove old help channel constantsGravatar MarkKoz2020-03-22-18/+0
| | | | | |
| | | * | | HelpChannels: handle potential notification exceptions locallyGravatar MarkKoz2020-03-22-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The notification feature is not critical for the functionality of the help channel system. Therefore, the exception should not be allowed to propagate and halt the system in some way.
| | | * | | HelpChannels: notify configured list of roles instead of helpers onlyGravatar MarkKoz2020-03-22-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Rename function `notify_helpers` -> `notify` * Use bullet-point list for config options in the docstring
| | | * | | Constants: add a roles list constant for help channel notificationsGravatar MarkKoz2020-03-22-1/+5
| | | | | |
| | | * | | Constants: add a channel constant for help channel notificationsGravatar MarkKoz2020-03-22-6/+11
| | | | | |
| | | * | | Constants: rename HelpChannels.notify_helpers to notifyGravatar MarkKoz2020-03-22-4/+4
| | | | | |
| | | * | | HelpChannels: adjust the helper notification messageGravatar MarkKoz2020-03-22-3/+3
| | | | | |
| | | * | | HelpChannels: add a minimum interval between helper notificationsGravatar MarkKoz2020-03-22-9/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add configurable constant for minimum interval * Move helper notifications to a separate function
| | | * | | HelpChannels: log previous position when getting alphabetical positionGravatar MarkKoz2020-03-22-1/+5
| | | | | |
| | | * | | HelpChannels: notify helpers if out of channelsGravatar MarkKoz2020-03-22-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Send a message in the #helpers channel pinging the @helpers role to notify them of a lack of help channels. Can be toggled off in the config.
| | | * | | HelpChannels: add a function to get a channel's alphabetical positionGravatar MarkKoz2020-03-22-4/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Log a warning if a channel lacks the expected help channel prefix * Log the old and new channel positions
| | | * | | HelpChannels: add a warning if more than 50 channels existGravatar MarkKoz2020-03-22-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Discord only supports 50 channels per category. The help system will eventually error out trying to move channels if more than 50 exist.
| | | * | | HelpChannels: sort dormant channels alphabeticallyGravatar MarkKoz2020-03-22-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The channels are easier to find when sorted alphabetically. * Merge some trace and info logs