aboutsummaryrefslogtreecommitdiffstats
path: root/bot/bot.py (unfollow)
Commit message (Collapse)AuthorLines
2019-12-06Add meta methods to Bot class.Gravatar scragly-1/+97
2019-12-06Fix inaccurate annotations for custom checks.Gravatar scragly-2/+2
2019-12-04Unlock AoC role to make announcements actually ping the usersGravatar Sebastiaan Zeeff-7/+34
The Advent of Code cog has a subscription system that allows members to subscribe to a daily notification indicating the puzzle for that day has become available. However, we introduces a more stringent role mentionability policy that meant that the mentions did not actually ping the members subscribed. To solve this, I've made sure that the bot unlocks the role before making the announcement using the `unlock_role` context manager. This also means the role is automatically unlocked after the message is sent. In addition, I noticed that Seasonalbot was consistently announcing the puzzle about 0.5 seconds early. I've correct this by adding a second to the sleep delay. In addition, the bot now verifies that the puzzle is available using a small HEAD request. While this does send a request to the AoC server, it prevents multiple users from sending unnecessary requests by following our link before the puzzle is actually available.
2019-12-04Make AoC channel ID configurable for testing environmentsGravatar Sebastiaan Zeeff-1/+1
I have made the `#advent-of-code` channel id configurable using the same environment variable technique used for other settings. This makes it easier to test features that rely on this channel in a test environment.
2019-12-04Add context manager to safely unlock role mentionabilityGravatar Sebastiaan Zeeff-0/+23
Currently, our regualar roles are not mentionable by default. This means that features that rely on roles to keep track of users that want to receive announcements, like the AoC Day Countdown, don't actually ping the users subscribed to it. The solution is obviously that the bot should unlock prior to making the announcement. However, this is complicated by the fact that there needs to be a sufficient delay. both between unlocking and sending the message and between sending the message and locking the role again. If not, Discord's not done synchronizing across all servers and some users won't receive a ping. To make this easier, I have implemented a context manager that takes an instance of `discord.Role` and an optional `delay` (default: 5s) that yields a context in which the role is unlocked. This context manager also makes sure that the role is locked even if an exception occured within the unlocked context.
2019-12-03Misc Bug FixesGravatar S. Co1-2/+2
* Fix typo in easter riddle type hint * Fix incorrect `PIL.Image` type hint (vs. `PIL.Image.Image`)
2019-12-03Bump pillow from 6.1.0 to 6.2.0Gravatar dependabot[bot]-20/+18
Bumps [pillow](https://github.com/python-pillow/Pillow) from 6.1.0 to 6.2.0. - [Release notes](https://github.com/python-pillow/Pillow/releases) - [Changelog](https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst) - [Commits](https://github.com/python-pillow/Pillow/compare/6.1.0...6.2.0) Signed-off-by: dependabot[bot] <[email protected]>
2019-12-02Fix Christmas season loading bugGravatar sco1-0/+7
The `SeasonBase.is_between_dates()` method assumes that the season's start and end dates are in the same year, which works for every season except for Christmas, since its end date is New Year's Day. To fix this, the christmas.end() method has been overloaded to return the next year instead of the current year. This does not affect checks made on 1 January of the next year, as the season's start date will guard against this.
2019-12-02Add envelope reaction if AoC join DM sends successfullyGravatar kwzrd-0/+2
2019-12-02Add envelope emoji constantGravatar kwzrd-0/+1
2019-12-02Delete whitespacesGravatar Matteo Bertucci-1/+1
2019-12-02Cancel season related tasks on cog unloadGravatar Matteo Bertucci-0/+5
2019-12-01fix line length in command `.aoc join`Gravatar decorator-factory-1/+1
2019-12-01Fix cmd annotationGravatar decorator-factory-1/+1
Fix the `brief` argument for `.aoc join` to make its behaviour more obvious.
2019-11-30Remove hardcoded date from AOC info link embedGravatar S. Co1-1/+1
If a date is not specified, the AOC site should redirect to the most recent year.
2019-11-30Fix AOC countdown logicGravatar S. Co1-3/+14
The current time delta until the next AOC event assumes that the next event is next year's. While this is was a safe assumption when written, since the command would not be available until the season is loaded on December 1st, it provides an incorrect answer if the season is loaded prior. The logic has been adjusted to return the closest December 1st that is not in the past. The feedback string has also been adjusted to give hours remaining if we're less than a day away from the event starting.
2019-11-30Refactor random generator to use a local instance rather than systemGravatar S. Co1-11/+15
2019-11-29Update icon path for 2019 festive seasonGravatar kwzrd-1/+1
2019-11-28Adding the runner icon to the rotation.Gravatar Leon Sandøy-0/+1
https://github.com/python-discord/branding/pull/37
2019-11-25Default seasons to not send announcementsGravatar S. Co1-4/+5
2019-11-25Add env var support for Advent of Code year specificationGravatar S. Co1-1/+1
To assist with debugging
2019-11-25Update leaderboard IDGravatar S. Co1-1/+1
2019-11-25Add the new blinky server guild iconGravatar Deniz-0/+1
2019-11-19Relock to d.py 1.2.5 due to API breaking change for emoji.Gravatar scragly-101/+117
2019-11-18year binds to datetime instead of a magic numberGravatar Eivind Teig-1/+2
2019-11-02Change off-season logo size to 512Gravatar kwzrd-6/+6
2019-11-02Add two new icons to icon constantGravatar kwzrd-0/+2
2019-10-31Hotfix end date of HacktoberGravatar Sebastiaan Zeeff-1/+1
The command is mostly used to calculate the time left in the DO's Hacktoberfest event we are participating in. However, the current end datetime was specified as a day before the actual end of the event. This hotfix remedies that for the end-calculation only. This code should get a proper fix to rework the entire logic to use the correct start and end datetimes for DO's event.
2019-10-24Readd cog init & rename *.py fileGravatar S. Co1-0/+3
2019-10-23Readd user agent to request headerGravatar kosayoda-1/+2
2019-10-23Filter draft PRs in query url insteadGravatar kosayoda-11/+4
2019-10-19Fixes the changes.Gravatar quizzicaltrains-5/+8
2019-10-18Changed several things.Gravatar quizzicaltrains-66/+59
2019-10-14Syntax cleanup, remove unnecessary emoji dictGravatar S. Co1-28/+27
2019-10-14Made the icon_URL variable conform to PEP8Gravatar RohanRadia-6/+6
2019-10-14Remove str() in f-stringGravatar RohanRadia-1/+1
Co-Authored-By: Kieran Siek <[email protected]>
2019-10-14Remove str() within f-stringGravatar RohanRadia-1/+1
Co-Authored-By: Kieran Siek <[email protected]>
2019-10-14Caps fixGravatar RohanRadia-1/+1
2019-10-13Update bot/seasons/evergreen/issues.pyGravatar RohanRadia-1/+1
Co-Authored-By: Kieran Siek <[email protected]>
2019-10-13Ignore Draft PRs in .hackstatsGravatar kosayoda-2/+10
2019-10-12allow all AoC commands in whitelisted channelsGravatar Numerlor-0/+8
2019-10-12Adds the monsterbio command!Gravatar quizzicaltrains-0/+96
2019-10-12Fixed forgetting to divide by 100.Gravatar vivax3794-1/+1
2019-10-12had the wrong prefix in docstring xDGravatar vivax3794-1/+1
2019-10-12fixed " misplace meant.Gravatar vivax3794-1/+1
2019-10-12Added Beginner to docstring.Gravatar vivax3794-1/+6
2019-10-09Fixed emoji error in embedGravatar RohanRadia-10/+13
2019-10-07Condensed importsGravatar RohanRadia-2/+1
2019-10-07Constants match pep8 formattingGravatar RohanRadia-10/+10
2019-10-07Trailing Commas RemovedGravatar RohanRadia-4/+4