aboutsummaryrefslogtreecommitdiffstats
path: root/bot (follow)
Commit message (Collapse)AuthorAgeLines
* Add ability to automatically send issues if matching <repo>#<issue>Gravatar Shivansh-0072021-01-23-27/+69
|
* Fixed battleship reading uppercases incorrectly.Gravatar aruna20192021-01-21-1/+1
|
* Implement Spooky Name Rate gameGravatar Vivaan Parashar2021-01-21-0/+2607
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | removed commented code added the delete command Changed the name from ratethespook to spooknamerate renamed file too rename ratethespook.json to spooknamerate.json Added more names from mockaroo added one user one reaction removed print statements fixed flake8 comments and prevented the user from deleting the word while polling fixed typo, added random messages, made each entry unique, fixed one user one reaction, made it for one day. I think I am done commented some code autopep8ed edited few lines of code added comments added some comments edited code edited code edited fixed syntax error fixed flake8 complaints fixed flake8 complaint fixed small error added a `word` command and informed user if they don't have a registered word fixed a small error where the first and last names weren't separated removed unecessary code changed word to name remove slash in multiline strings and remove unecessary comments. Also, lock the background loop to `OCTOBER` and make emojis into discord emoij form (:emoij_name:) fixed an accidental tab removed another unecessary comment remove more unecessary comments remove `.keys()` for dictionaries removed `len() > 0` for lists and dicts and changed emojis to '\N{}' form Fixed code so that return value is that specified and added fail-safes instead of `if` and `else`s f-stringify fixed borderline api abuse and missing space in defining word lint code multiple imports on one line and fix typo remove unecessary return, shorten var typehint remove 'Just' in suggestion and add extra line in json file. - unecessary comment and replace on with for in help embed description shorten emoij_message remove check in delete command use defaultdict sort imports group imports, add typehinting, remove unnecessary comments and docstring, remove redundant elses and returns sort imports refactor var wrds, use generator instead of list use typing.Dict[str, str] instead of dict and use .items() instead of get() add a comment remove reduntant comment Renamed variable to avoid conflicts add asyncio locking to prevent Runtime error add some comments lock all commands to OCTOBER enhance looping in checking messages add `cog_check` instead of limiting each command remove unused import remove test code and comments use fail fast rename function Make storage persistent and make sure announce_word does not go off everytime the bot restarts fixed typo make data persist, rename everything that has word in it to 'name' and make sure announce_name doesn't start off everytime the bot restarts. remove testing code which would cause a real mess if commited. Which I did commit. use a separate file for the name and first_time becuase re-dumping such a long file might take time make var for repetitive paths and change .day to .hour change scheduling logic lint code add cog_unload fix error in spooknamerate_names.json and fix the before_loop in spooknamerate.py revert accidental changes and remove commented code remove unused code refactor vars to caps and make emojis_val global edit docstring and make seasonalbot_commands to community_bot_commands make annotation correct and add check when channel is None for get_channel Add fullstop Loop directly over data Add a proper dash and fix linting Fix linting reverted to making EMOJIS_VAL global and fixed capitalization fix small error verify it is working and simplify import remove data files Use redis caching instead of JSON and rename remove empty title and description in embed and use discord's red color remove var typehint add Client.month_override for dev move ping function rename seasonalbot to sir-lancebot remove unnecessary newline fix line formatting move added_messages to global Add more info on the caches remove + alias improve formatting use str.format instead of func fix error directly used Channels.community_bot_commands get user from cache instead of actively fetching the user move help messages to constant add more info in err msg Apply suggestions from review Co-authored-by: ks129 <[email protected]> remove unnecessary comments remove another redundant comment improve formatting and use better var names hard-code a var Use get or fetch format Remove redundant commit Fix in_allowed_month for debugging remove extra space make channel name link to channel simplify uteration use msg.reactions directly rename r to reaction and directly use variable reformat code use from_dict instead of manually creating the Embed Remove commented code fix channel linking add some debugging support add some more info to the debug mode Directly use getLogger sort imports Remove (name) in function doctype Use SpookNameRate.debug everywhere Shrink function call to one line and remove extra info in comment Use fail fast in on_reaction_add use environment var for debug mode Set debug val to False by default Fix some line breaks that formatting with black had made and use fail fast Use custom environment variable instead of the global bot env var make bot reply and store info from the bot's reply instead of the user's message remove an accidental swp file fix the reaction not getting removed remove extra brackets use generators instead of lists fix logging statement simplify loop rename spooknamerate to spookynamerate Correct docstring Improve the name announcing code Ignore reaction of all bots rearrange or send "Name deleted" instead of "Message deleted" Add client prefix
* Merge branch 'master' into IGDB-V4Gravatar ks1292021-01-17-37/+5
|\
| * Updates ConstantsGravatar Hassan Abouelela2021-01-15-2/+4
| | | | | | | | | | Updates the constants file with the new channel ID, and renames both channels to match the new names.
| * Remove sprint channels from the configuration.Gravatar Matteo Bertucci2021-01-15-34/+0
| | | | | | Now that the core dev sprint has ended, we can safely remove those. It caused the wrong channel message to be huge because of all the deleted channels.
| * Actually use 256 coloursGravatar Chris2021-01-09-1/+1
| |
* | Add OAuth response to warning.Gravatar Chris2021-01-08-1/+4
| |
* | Switch to post requests and start task at right time.Gravatar Chris2021-01-08-9/+10
| |
* | Use current token if we can't get a new oneGravatar Chris2021-01-08-12/+21
| |
* | Move renewal window to a constGravatar Chris2021-01-08-2/+5
| |
* | Un-comment out task startGravatar Chris2021-01-08-1/+1
| |
* | Revert change to trashcan emojiGravatar Chris2021-01-08-1/+1
| |
* | Get and renew V4 OAuth tokenGravatar Chris2021-01-08-8/+50
|/
* Merge branch 'master' into hackstatsGravatar ks1292021-01-06-867/+1108
|\
| * Remove unused importGravatar William Da Silva2020-12-29-1/+1
| |
| * Merge branch 'master' into omdb-to-tmdbGravatar William Da Silva2020-12-28-815/+1058
| |\
| | * Merge branch 'master' into prideavatar-urlGravatar ks1292020-12-28-780/+988
| | |\
| | | * Use sir-lancebot instead pydis-sir-lancebot for release nameGravatar ks1292020-12-19-1/+1
| | | | | | | | | | | | Co-authored-by: Joe Banks <[email protected]>
| | | * Remove aiohttp integration from SentryGravatar ks1292020-12-19-3/+1
| | | |
| | | * Add release tag to Sentry SDK initializationGravatar ks1292020-12-19-3/+4
| | | |
| | | * Add Git SHA as constantGravatar ks1292020-12-19-0/+2
| | | |
| | | * Add Redis and aiohttp integrations to SentryGravatar ks1292020-12-19-1/+7
| | | |
| | | * Clarify comment on AoC Status Task startup delayGravatar Sebastiaan Zeeff2020-12-13-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Advent of Code Status Countdown task needs to wait for two things to happen to prevent it from failing during the startup sequence: 1. The Websocket instance discord.py creates needs to be available as an attribute of the bot, otherwise discord.py fails internally: Traceback (most recent call last): File "discord/client.py", line 1049, in change_presence await self.ws.change_presence( activity=activity, status=status, afk=afk ) File "advent_of_code/_cog.py", line 52, in countdown_status await bot.change_presence(activity=discord.Game(playing)) AttributeError: 'NoneType' object has no attribute 'change_presence' 2. Allegedly, according to the discord.py community, trying to change the status too early in the sequence to establish a connection with Discord may result ub the Discord API aborting the connection. To solve this, I've added a `wait_until_guild_available` waiter, as it guarantees that the websocket is available and the connections is mature. Kaizen: I've changed the name `new_puzzle_announcement` to `new_puzzle_notification` to better reflect its function.
| | | * Merge branch 'master' into sebastiaan/advent-of-code/refactor-background-tasksGravatar Sebastiaan Zeeff2020-12-13-60/+154
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | # Conflicts: # bot/exts/christmas/advent_of_code/_cog.py # bot/exts/christmas/advent_of_code/_helpers.py
| | | | * Add callback to log errors in AoC background tasksGravatar Sebastiaan Zeeff2020-12-13-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, our Advent of Code background tasks fail without logging errors or printing error messages. This makes it difficult to debug the errors and means that they may fail silently. While we should ideally find the root cause that hides such errors, I've added a done_callback function in the meantime to help us debug the current issues with the Advent of Code Notification Task.
| | | | * Change AOC_WHITELIST names for clarityGravatar janine9vn2020-12-11-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AOC_WHITELIST was changed to AOC_WHITELIST_RESTRICTED because it is clearer that commands with this parameter in the `@override_in_channel()` decorator will be restricted to the aoc commands channel and not be allowed in the main aoc channel. In the same vein, AOC_WHITELIST_PLUS was changed to AOC_WHITELIST.
| | | | * Change Default AoC Commands ChannelGravatar janine9vn2020-12-11-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes the default value of the advent_of_code_commands constant to be the same channel ID as sir-lancebot-commands. If no AoC commands channel is set in the .env file, it'll re-direct people to sir-lancebot-commands instead.
| | | | * Remove extra pleaseGravatar janine9vn2020-12-11-1/+1
| | | | | | | | | | | | | | | | | | | | Please -= 1
| | | | * Remove re-raising the errorGravatar janine9vn2020-12-11-2/+0
| | | | | | | | | | | | | | | | | | | | Per Mark's comment, re-raising the error isn't necessary.
| | | | * Change custom error handler to match new styleGravatar janine9vn2020-12-11-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | I'm a bit ahead of the game and changing the error handler to match the new style that Iceman will PR shortly.
| | | | * Add cog-level error handler for Incorrect ChannelGravatar janine9vn2020-12-11-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If any of the "spammier" commands (stats, leaderboard) are used within the primary advent of code channel, rather than a non-specific embed we instead reply with the channel they should be using. This also adds a "AOC_WHITELIST_PLUS" constant that makes it easier to adjust what channels the non-spammier aoc commands can be used in.
| | | | * Disallow .aoc commands in primary aoc channelGravatar janine9vn2020-12-11-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commands like `.aoc leaderboard` and `.aoc stats` proved to be spammy in the main advent of code channel. An aoc_commands channel has been added for aoc commands and this update prohibits aoc commands from being used in the primary aoc channel and adds the comands channel to the whitelist. This also specifically allows the less spammier commands: join, subscribe, unsubscribe, and countdown in the primary channel to foster discussion though.
| | | | * Merge pull request #540 from RohanJnr/error_handler_changesGravatar Mark2020-12-11-21/+10
| | | | |\ | | | | | | | | | | | | Modify error handler check for locally handled errors.
| | | | | * Check if error.original is an instance of OSError.Gravatar Rohan2020-12-11-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | Also, remove error handler for get_command and video_command.
| | | | | * Modify snakes_cog error handler.Gravatar Rohan2020-12-07-16/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | local error handler no longer checks for BadArgument error and the attribute handled will be set to True on the error if an OSError occurs.
| | | | | * Check value of handled attribute on error in global error handler.Gravatar Rohan2020-12-04-1/+1
| | | | | |
| | | | | * Modify error handler check for locally handled errors.Gravatar Rohan2020-12-02-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Error handler now checks if the error has the attribute "handled" for locally handled errors.
| | | | * | Mitigate session expiry by using fallback sessionGravatar Sebastiaan Zeeff2020-12-05-17/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, an expired session cookie wreaked havoc to our Advent of Code commands: All commands that relied on leaderboard data failed because we couldn't refresh our data and the cache had expired. To mitigate an expired session, I've added a fallback session feature that enables us to try again with a different session. While it will issue an error message to inform us to refresh the expired session cookie, it does mean that the functionality should continue to work in the mean time. The fallback session cookie is currently set to my session cookie, using an environment variable, `AOC_FALLBACK_SESSION`. It is important that the user connected to the session is a member of all boards and that it's a fresh session: We don't want our fallback to expire! At the same time, while a single fallback session works, the AoC website also does not like too many requests from a single user. That's why we'll still use a multi-session model under normal circumstances. To check for expired sessions, I've added a URL check: The Advent of Code website will silently redirect people with an expired session, issuing an 200: OK status as usual. The only way to really check for it is by comparing the final URL in the response object to the URL we set out to GET. I've added a custom exception to signal such an unexpected redirect. Finally, instead of having the commands just break, I've added an Exception signal that propagates back to the caller. The solution, with try-except, is a bit hacky and could benefit from an actual error handler, but I wanted to get things fixed first; polish can be added later.
| | | | * | Support a fallback session cookie in constantsGravatar Sebastiaan Zeeff2020-12-05-2/+20
| | | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To mitigate problems due to expiring session cookies, I'm currently in the process of adding support for a fallback cookie. Basically, my Advent of Code account is a member of *all* leaderboards, which means that my cookie can be used to fetch all leaderboards as well. As my session cookie should not expire until after the event, it should not give us any issues. However, to avoid issues with issuing too many requests from one session, we should still make sure to set individual session values regardless of the mitigation.
| | | | * Fix leaderboard glitch caused by duplicate namesGravatar Sebastiaan Zeeff2020-12-02-13/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We noticed that some entries on our leaderboard had an incorrect star count attached to their name. After a bit of digging, @HassanAbouelela discovered that this was caused by the use of the member's name as the key for the leaderboard dictionary: If different accounts used the same display name for the leaderboard, they'd be combined into one glitched score dict. The fix @HassanAbouelela wrote is to use the member id instead of the name as the key for the leaderboard. I've changed a few names here and there, but nothing major. This commit closes #536
| | | * | Update docstrings and fix grammar in commentsGravatar Sebastiaan Zeeff2020-12-02-10/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've updated some docstrings to include more information about the inner workings of some of the functions. In addition, I've also slightly reformulated some block comments to improve their grammar. Kaizen change: There was a redundant list comprehension in the Advent of Code section of the constants. I've removed it.
| | | * | Clarify time_left_until_est_midnight functionGravatar Sebastiaan Zeeff2020-12-01-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The helper function calculates the time left until the next midnight in the EST timezone, not necessarily the next midnight during and Advent of Code event. To prevent confusion, I've clarified its function by changing the name of the function and its docstring.
| | | * | Let puzzle notification sleep until AoC startsGravatar Sebastiaan Zeeff2020-12-01-58/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of cancelling the task when it starts up outside of the boundaries of the Advent of Code, the task will now hibernate until just before the event starts if starts up before December. This allows it to actually announce the first puzzle. After the announcement for the last day of the current event is made, it will terminate itself. It will only start hibernating again when we've updated the environment variables for next year's event, ensuring that it does not run unnecessarily. To prevent issues with the guild cache not being available, I've added our new `wait_until_guild_available` waiting function. I've also moved the calls that get teh role/channel to before the loop, as there's no need to get them each time the loop goes around. I've also changed the way we calculate the time we need to sleep, as the old way used truncated seconds, meaning that we would always wake up relatively early. Instead, I'm now using fractional seconds, which means we can reduce the safety padding to a fraction of second. More accurate announcement timing!
| | | * | Ensure status countdown waits for bot start-upGravatar Sebastiaan Zeeff2020-12-01-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Trying to change the rich presence status of the bot too early in the bot's start-up sequence will cause the task to fail. To make it wait, I've added a `bot.wait_until_guild_available` point before the main loop of the task starts. This seems to solve the issue reliably, despite the `guild_available` event not being directly related to when the bot's connection with the API is ready to accept presence updates. However, the `ready` event is know to fire too early, according to the discord.py community.
| | | * | Let status update task sleep until the AoC startsGravatar Sebastiaan Zeeff2020-12-01-31/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've refactored the rich presence countdown task by making it hibernate until 2 hours before the next Advent of Code starts if the task starts up before the event has started. This ensures that the task will run when the event starts and allows it to countdown to the first challenge. After the event for the configured Advent of Code year has finished, the task will terminate. This also means that the task will terminate immediately in the year following the currently configured Advent of Code; it will only start hibernating again once we configure the bot for the next event. No unnecessary, year-long hibernation.
| | | * | Add function that allows tasks to sleep until AoCGravatar Sebastiaan Zeeff2020-12-01-0/+22
| | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our Advent of Code background tasks were written in such a way that they relied on the extension being loaded in December and only in December. However, since the deseasonification, the extension is loaded prior to December, with some commands being locked to that month with a check instead. This meant that our background tasks immediately cancelled themselves, as they observed themselves to be running outside of the boundaries of the event. As there was no mechanism for starting them back up again, these tasks would only start running again after redeployment of Sir Lancebot. To solve this issue, I've added a helper function that allows tasks to wait until a x hours before the event starts. This allows them to wake up in time to prepare for the release of the first puzzle.
| | | * Fix daily stats by converting day, star to strGravatar Sebastiaan Zeeff2020-12-01-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The daily stats function contained a bug that prevented it from working correctly. The reason was that I was looking for `int` keys where the actual keys were strings. I now make sure to create a `str` from the `int` I get back from `range`.
| | | * Add support for ignoring scores from specific daysGravatar Sebastiaan Zeeff2020-12-01-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've added support for ignoring scores from specific days. A list of days to ignore can be provided using the environment variable `AOC_IGNORED_DAYS` as a comma-separated list. This example would ignore day 1 and day 23: AOC_IGNORED_DAYS=1,23 I've also added a helper function to sort the leaderboard not only on the achieved score, but also on the number of stars an individual has completed.
| | | * Clarify text of DM with Advent of Code join codeGravatar Sebastiaan Zeeff2020-11-30-5/+7
| | | |