aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
...
| | * | | | | | | | | | | | | | | Use `on_raw_message_edit`Gravatar Shivansh2021-10-11-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally it was using `on_message_edit` which would have failed if the message was not in the bot' cache. Therefore we would have to use a raw listener.
| | * | | | | | | | | | | | | | | Delete msg link embed if no link on editGravatar Shivansh2021-10-11-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Earlier, if we edited a message which contained message links originally but not now, then the webhook message wouldn't get deleted. This commits fixes that bug.
| | * | | | | | | | | | | | | | | Make `extract_message_links` an instance methodGravatar Shivansh2021-10-11-31/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since it was used cog's state (`self.bot`), it would be better to move it to the cog.
| | * | | | | | | | | | | | | | | Use better variable namesGravatar Shivansh2021-10-11-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit also adds a line which was got removed by mistake earlier.
| | * | | | | | | | | | | | | | | Apply requested changes to doc stringsGravatar Shivansh2021-10-11-4/+4
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Only process the first 10 message linksGravatar Shivansh2021-10-11-3/+1
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | (incidents):Log with error if webhook not foundGravatar Shivansh2021-10-11-0/+3
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | (incidents): Use subtests for test_shorten_textGravatar Shivansh2021-10-11-4/+4
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | (incidents): Add test for text shortnerGravatar Shivansh2021-10-11-10/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pass all 3 cases of text shortening to the test case and test them, the cases being: i. If the message is just one word, then shorten to 50 characters. ii. Maximum lines being 3. iii. Maximum characters being 300. This commit also removes a misc bug, of passing self, while asserting equal.
| | * | | | | | | | | | | | | | | (incidents): Refactor text shortnerGravatar Shivansh2021-10-11-10/+16
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Rework text shortner.Gravatar Shivansh2021-10-11-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Explanation: It is unnecessary to show 300 characters, when there is only one word which is so long, so if there is only one word in the text, it would be truncated to 50 words. Also in some cases, there are messages of many lines with 1 word on each line(say), this would again make the embed big and polluting, so it would limit the number of lines to a maximum of 3. Rest of the feature is the same as before. This implementation has been inspired from the `format_output` function of snekbox cog.
| | * | | | | | | | | | | | | | | Write tests for this featureGravatar Shivansh2021-10-11-3/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In short, I have written two tests, one which tests the whether `extract_message_links` is called on message edits or not. And the second one to test the regex of `extract_message_links` and assert the message link embeds sent by it. Special thanks to kwzrd💜#1198 for helping me out with it.
| | * | | | | | | | | | | | | | | Fix truncation bugGravatar Shivansh2021-10-11-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When you take a long message, just one word of 400 A's then the truncated wouldn't be able to handle it properly and just return the placeholder. This is a bug in the textwrap.shorten function. To solve this, I went the long way to use slicing on the list. This commit seems to have resolved the bug.
| | * | | | | | | | | | | | | | | Handle discord.errors.NotFound while deleting msg link webhook embedsGravatar Shivansh-0072021-10-11-1/+4
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Remove leading whitespace from msg link embed contentGravatar Shivansh-0072021-10-11-1/+1
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Rename 'send_webhooks' to 'send_message_link_embed'Gravatar Shivansh-0072021-10-11-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Boris Muratov <[email protected]>
| | * | | | | | | | | | | | | | | Appy requested grammar changes.Gravatar Shivansh-0072021-10-11-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Boris Muratov <[email protected]>
| | * | | | | | | | | | | | | | | Remove redundant codeGravatar Shivansh-0072021-10-11-4/+2
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Rework message link embed.Gravatar Shivansh-0072021-10-11-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Instead of default black colour, use gold to give it some shine! - Mention the channel also in the channel field. - Add message ID in footer, so it is easy to figure out for which message link is that embed.
| | * | | | | | | | | | | | | | | Bug fixesGravatar Shivansh-0072021-10-11-16/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - `await` message link embeds cache get - don't double send webhook embeds (edit, send) on message edits
| | * | | | | | | | | | | | | | | Don't send errors, instead log them.Gravatar Shivansh-0072021-10-11-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Errors shouldn't be sent in #incidents. Instead, log them with log.exception and make the function return.
| | * | | | | | | | | | | | | | | Do required flake8 changes in docstrings.Gravatar Shivansh-0072021-10-11-4/+8
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Use tasks to fetch incidents channel webhook.Gravatar Shivansh-0072021-10-11-9/+13
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | On msg edits, edit the msg link embed rather than deleting itGravatar Shivansh-0072021-10-11-4/+9
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Make incidents channel webhook a cog level attributeGravatar Shivansh-0072021-10-11-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This would not fetch it everytime.
| | * | | | | | | | | | | | | | | Use str() rather than f string for single variable.Gravatar Shivansh-0072021-10-11-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makes the intent much more clear.
| | * | | | | | | | | | | | | | | Don't allow more than 10 embeds per report.Gravatar Shivansh-0072021-10-11-53/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If more than 10 embeds found, just get the first 10 and ignore the rest.
| | * | | | | | | | | | | | | | | Revert changes done by black.Gravatar Shivansh-0072021-10-11-43/+13
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Updates type hints for `message_link_embeds_cache`.Gravatar Shivansh-0072021-10-11-1/+7
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Refactors code.Gravatar Shivansh-0072021-10-11-26/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Earlier on message edit the message wasn't run through extract message links to see if new message links are added or if some got deleted. Similarly the cache was updated when a message got deleted. Now it makes extract message links a helper function and runs it on message edits and deletes in case there are some changes in the message links. This commit also updates the doc strings for functions according to the new changes done.
| | * | | | | | | | | | | | | | | Use `DiscordException` instead of broad exception clause.Gravatar Shivansh-0072021-10-11-2/+2
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Apply grammar and style changes.Gravatar Shivansh-0072021-10-11-13/+20
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Run black code formatter.Gravatar Shivansh-0072021-10-11-21/+53
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Ignore N802 in 'asyncSetUp' and 'asyncTearDown' function in test_incidents.pyGravatar Shivansh-0072021-10-11-2/+2
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Allign comments to maintain readabilityGravatar Shivansh-0072021-10-11-3/+3
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Modify tests to support redis cache, done with the help @SebastiaanZGravatar Shivansh-0072021-10-11-16/+16
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Run webhook message deletion if webhook_msg_id var is TrueGravatar Shivansh-0072021-10-11-5/+7
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Update regex to support all message links i.e. support for 'app', 'canary', ↵Gravatar Shivansh-0072021-10-11-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'ptb'
| | * | | | | | | | | | | | | | | Add a docstring to 'send_webhooks' functionGravatar Shivansh-0072021-10-11-0/+9
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | If message content more than 500 characters shorten it done to 300 charactersGravatar Shivansh-0072021-10-11-24/+34
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Rollback to changes which aren't requiredGravatar Shivansh-0072021-10-11-6/+6
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Fix tests according to the changes done to incidents.pyGravatar Shivansh-0072021-10-11-3/+19
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Use str() when checking for message.contentGravatar Shivansh-0072021-10-11-1/+1
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Use MessageConverter to find messagesGravatar Shivansh-0072021-10-11-25/+35
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Send multiple webhook messages in case of more than 10 message linksGravatar Shivansh-0072021-10-11-9/+22
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Add incidents webhook to default config templateGravatar Shivansh-0072021-10-11-0/+1
| | | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | | Send webhook embed containing information about the message if there is a ↵Gravatar Shivansh-0072021-10-11-4/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | message link in the incident report
| | | | | * | | | | | | | | | | | Add ability to reply to message for `!remind`Gravatar Izan2021-11-16-2/+16
| |_|_|_|/ / / / / / / / / / / / |/| | | | | | | | | | | | | | |
* | | | | | | | | | | | | | | | Update order of off-topic channels (#1956)Gravatar mina2021-11-14-2/+2
|/ / / / / / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reverse order of off-topic channels from ot0, ot1, ot2 to ot2, ot1, ot0
* | | | | | | | | | | | | | | Change log level from `WARNING` to `DEBUG`. (#1950)Gravatar TizzySaurus2021-11-11-3/+1
| | | | | | | | | | | | | | |