#dev-log

1 messages ยท Page 89 of 1

regal archBOT
odd spireBOT
regal archBOT
regal archBOT
oak estuaryBOT
regal archBOT
#

Sentry Issue: SIR-LANCEBOT-6Z

AttributeError: 'NoneType' object has no attribute 'get_role'
  File "discord/ext/commands/core.py", line 167, in wrapped
    ret = await coro(*args, **kwargs)
  File "bot/exts/events/advent_of_code/_cog.py", line 71, in aoc_subscribe
    role = ctx.guild.get_role(AocConfig.role_id)

Unhandled command error: 'NoneType' object has no attribute 'get_role'

The ...

#
[python-discord/bot] branch deleted: disable\-file\-logs
oak estuaryBOT
odd spireBOT
regal archBOT
#

Relevant Issues

<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Closes #952

Description

Disabled commands in DMs by default. Note that this only disables the invocation of a command in DMs, not handling of messages. This means commands which use DMs for other purposes, such as battleship will still work. (Tested with a game of battleship against @Akarys42. Issue will be updated with the victor)

Adds a toggle to the whitelist ove...

odd spireBOT
regal archBOT
#

Relevant Issues

  • -
    <!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->

Description

The PR introduces a quick fix to the AoC day and star stats feature, since it was tested on a fully populated leaderboard.

Did you:

  • [x] Join the Python Discord Community?
  • [x] Read all the comments in this template?
  • [x] Ensure there is an issue open, or link relevant discord discussions?
  • [x] Read and ...
odd spireBOT
odd spireBOT
odd spireBOT
regal archBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
odd spireBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
regal archBOT
#
[python-discord/bot] branch deleted: allow\-reply\-in\-remind
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
#

Due to how we select the channels inside the duckpond cog, if the channel is a thread the bot cannot find it

https://github.com/python-discord/bot/blob/0cfbac90575098a9f9e0c8ee2ee96d537f0413c4/bot/exts/fun/duck_pond.py#L168-L170

This raises a question though, why are we using on_raw_reaction_add and not a normal on_reaction_add with all the payload already resolved? I couldn't find the information in #621, maybe @lemonsaurus would remember?

#

We need some form of if-statement so that not all messages get added here.

I have an idea, in discord.py there is a way to say how many commands can get used at once. If we use this we can limit the amount of commands to one at a time, then completely reset this dictionary each time the command ends.

Maybe with a before and after hook we can setup so that some form of attribute gets set that says that a command is ongoing? That way it'll run even if the command errors out.

regal archBOT
regal archBOT
regal archBOT
#

It was done because we wanted to be able to duck messages even if they aren't in the cache.

With Continuous Deployments, the bot is quite frequently clearing the cache, and it would be poor user experience if it wasn't possible to duck a message just because there happened to be a redeploy right after the message.

If this isn't a problem, or if we can solve this problem without raw reactions, I'm sure that would be fine.

regal archBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
#
[python-discord/modmail-plugins] New branch created: notify\-fix
regal archBOT
#
[python-discord/bot] New branch created: optional\-timeblocks
odd spireBOT
regal archBOT
regal archBOT
#
[python-discord/site] New branch created: don't\-always\-calc\-activity\-blocks
#

https://github.com/python-discord/bot/pull/1971 must be merged before this.

We only truly care about how many activity blocks a user has when they have a small number of messages, as we only use this for the voice gate.

If a user has more than say 1k messages, then we really don't need to calculate their activity blocks, as it's quite an expensive query with many messages.

Also, for the tests we only actually care that thee key:value pairs are equal, the order of them isn't actually ...

odd spireBOT
regal archBOT
#

Relevant Issues

<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->

Discussion: [#dev-contrib message]

Description

This PR is simply to fix a grammatical mistake in the description ("brief") of the .spookify command on Sir Lancebot.

Did you:

odd spireBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
odd spireBOT
regal archBOT
regal archBOT
#

Sentry Issue: BOT-1QT

HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In content: Must be 2000 or fewer in length.
  File "discord/ext/commands/core.py", line 167, in wrapped
    ret = await coro(*args, **kwargs)
  File "bot/exts/info/site.py", line 129, in site_rules
    await ctx.send(f":x: Invalid rule indices: {invalid}")
  File "discord/abc.py", line 1422, in send
 ...
odd spireBOT
oak estuaryBOT
regal archBOT
#
[python-discord/site] branch deleted: don't\-always\-calc\-activity\-blocks
odd spireBOT
regal archBOT
regal archBOT
#
[python-discord/site] New branch created: alter\-query\-to\-leverage\-index
odd spireBOT
regal archBOT
regal archBOT
#

Personally, I like the idea of a complement or other color harmony command, however I don't see much utility of one for darken / lighten. If you really needed to darken or lighten a color, you could take the hsl part of your color and modify the lightness attribute.

The option to allow users to specify more than one color in a single command would be useful. I had an idea for an alternative approach. A "โž•" reaction would show up after color embeds that lets the user save the color into t...

odd spireBOT
regal archBOT
#
[python-discord/site] branch deleted: alter\-query\-to\-leverage\-index
odd spireBOT
regal archBOT
#

Now that we've moved to discord.py 2.0 we have access to discord.ext.commands.flags meaning we can have almost-UNIX-like command flags, so a possibility would be a command like:

!black --line-length 120 <code>

I do like the rest of it, but want to clarify, discord.ext.commands.flags are not unix-like.

The command would be more like this: !black line-length:120 code:'code to blackify'

to have an actual interface like that, we could use argparse on the command input.

regal archBOT
oak estuaryBOT
odd spireBOT
odd spireBOT
regal archBOT
#

I'm not convinced the linters and type checkers make sense to add. There was a discussion about black here before #community-meta message

That said, I'm not sure how widely useful it would be in the server

That's a red flag to me. If there is no good justification, then it should not be done. Please let's not agree to adding features without solid reasoning. Maybe I'm the odd one out, but I am against adding features just f...

regal archBOT
regal archBOT
#

Relevant Issues

<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Closes #937

Description

I created a new .christmasify cog in the avatar_modify.py file. I made this command very similar to the currently existing .spookify command, with different images to represent Christmas / New Years.

Did you:

odd spireBOT
regal archBOT
regal archBOT
regal archBOT
#

The game itself works pretty well! Two suggestions from me however -
1 ) Change the text to text when the embed with all the words used and formatted into the prompt
2 ) We could use validation for checking whether something is a verb, noun, or adjective? Not sure about plural nouns or places, but we could use nltk.corpus.wordnet for validation. This is something that is more of a consideration as it depends on what you want to do.

odd spireBOT
regal archBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
#

You can use special keywords in the PR description so GitHub will automatically close an issue upon merge. You can read more here: https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword. This makes sure any issue that should be closed are in fact closed (and I won't have to go proactively hunt for such issues!), keeping our very chaotic issue tracker ever so slightly less chaotic and scary :)

I th...

regal archBOT
odd spireBOT
regal archBOT
regal archBOT
ocean rock
#

@dusk berry force pushing could be harmful! be careful!

dusk berry
odd spireBOT
regal archBOT
#
jb3
[python-discord/site] branch deleted: add\-dm\_sent\-field
#
jb3

61f9dae Add dm_sent field to infractions model & seri... - TizzySaurus
1e3725d Update documentation to include dm_sent field - TizzySaurus
546a2d1 Fix linting - TizzySaurus
454ad49 Merge migrations with upstream - jchristgit
e2cd5bd Merge pull request #621 from python-discord/add... - jb3

odd spireBOT
odd spireBOT
regal archBOT
#

FWIW I don't think Black needs to be a first-class command especially as https://black.now.sh exists. I can't imagine it'll be used often enough to justify the (even if minor) maintenance cost. If someone wants to demo Black they could just point to a pre-filled Playground URL. I'd argue that adding Black as an available snekbox package would be more useful once we declare an official API for Black and start getting more user help requests in regards to that. I suspect this would be easier to...

regal archBOT
regal archBOT
regal archBOT
regal archBOT
#

Hi!

We haven't actually done any work on it yet! Could you message me on
discord please? (mathstrains19#2057)

On Fri, 26 Nov 2021, 16:40 bones, @.***> wrote:

I'm quite interested, could I take your place? Are you still working on
this @mathstrains21 https://github.com/mathstrains21?

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/python-discord/sir-lancebot/issues/787#issuecomment-980119642,
o...

regal archBOT
#
[python-discord/site] branch deleted: redirects
odd spireBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
#

f093907 Create a signal to unassign roles from user whe... - D0rs4n
0f24bdc Add test to check role unassignment - D0rs4n
9d255dc Patch roles test to use fresh instance from the DB - D0rs4n
f34a520 Patch signals to use post_delete, instead of pr... - D0rs4n
053d43e Merge pull request #572 from D0rs4n/pr/deletero... - jchristgit

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/site] branch deleted: static\-docs
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
#
[python-discord/bot] New branch created: bsoyka/greens
odd spireBOT
regal archBOT
#

I'm inclined to keep this the same name for the sake of easily referencing it with the discordpy docs. We do this with all the other colours, so I'm not sure this is a good reason to strafe from that.

This is made worse by the fact that it's actually misleading (rather than just confusing having a non-existent colour) since discord.Colour.green is actually 0x2ecc71, not 0x68c290 (which are rather different).

regal archBOT
#

Tested with:

diff --git a/pydis_site/apps/api/models/bot/message.py b/pydis_site/apps/api/models/bot/message.py
index 60e2a553..8261b4fc 100644
--- a/pydis_site/apps/api/models/bot/message.py
+++ b/pydis_site/apps/api/models/bot/message.py
@@ -27,7 +27,7 @@ class Message(ModelReprMixin, models.Model):
     author = models.ForeignKey(
         User,
         on_delete=models.CASCADE,
-        help_text="The author of this message."
+        help_text="The creator of this mes...
#

Yea, that makes sense. We have two options here docker-compose up or docker-compose up --no-recreate or docker-compose up --force-recreate.

The former checks if there are any changes to pick up, if there are it recreates the containers then attaches to them. The latter attaches to the currently running containers and doesn't do any changes.

I'm leaning more towards the latter.

IE for the latter this task would become `docker-compose up web -d --no-recreate && docker-compose exe...

#

Hmm alright I can investigate this perms issue a little later, I'm a little lost at first glance.

Is there a way to pass this arguments, or even make it mandatory?
Yea, I can add --name on the end of this task, which would work the user to do poetry run task dockermigrations <name>. I only did it this was for consistency with the makemigrations task.

Forcing a named migration probably is best here.

regal archBOT
odd spireBOT
regal archBOT
regal archBOT
#

After some #dev-contrib discussion, it might be easier to simply adjust one or two of the soft greens to use bright green.

The original intentions behind this issue were to make these two messages, which are in the same place and both related to the help system, match:

image

Instead of combining the two colors altogether, I'll change the helpdm message to use bright_green.

#
[python-discord/bot] branch deleted: bsoyka/greens
#
[python-discord/bot] New branch created: bsoyka/helpdm\-green
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
#
[python-discord/bot] New branch created: bsoyka/rules\-bug
odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: bsoyka/rules\-bug
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] New branch created: bsoyka/rules\-shortening\-space
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
#

The game itself works pretty well! Two suggestions from me however - 1 ) Change the text to text when the embed with all the words used and formatted into the prompt 2 ) We could use validation for checking whether something is a verb, noun, or adjective? Not sure about plural nouns or places, but we could use nltk.corpus.wordnet for validation. This is something that is more of a consideration as it depends on what you want to do.

This comment no longer applies.

night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
#
[python-discord/bot] branch deleted: bsoyka/helpdm\-green
odd spireBOT
regal archBOT
#
[python-discord/sir-lancebot] branch deleted: file\_logging
odd spireBOT
oak estuaryBOT
odd spireBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] New branch created: bsoyka/discordpy\-bots
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
regal archBOT
#

After the channels were changed to a set I am getting this crash loop:

sir-lancebot    | Traceback (most recent call last):
sir-lancebot    |   File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 672, in _load_from_module_spec
sir-lancebot    |     setup(self)
sir-lancebot    |   File "/bot/bot/exts/events/advent_of_code/__init__.py", line 8, in setup
sir-lancebot    |     from ._cog import AdventOfCode
sir-lancebot    |   File "/bot/bot/exts/event...
regal archBOT
regal archBOT
regal archBOT
odd spireBOT
odd spireBOT
regal archBOT
#

After the channels were changed to a set I am getting this crash loop:

sir-lancebot    | Traceback (most recent call last):
sir-lancebot    |   File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 672, in _load_from_module_spec
sir-lancebot    |     setup(self)
sir-lancebot    |   File "/bot/bot/exts/events/advent_of_code/__init__.py", line 8, in setup
sir-lancebot    |     from ._cog import AdventOfCode
sir-lancebot    |   File ...
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/sir-lancebot] New branch created: aoc\-count\-timestamp
#

Description

Swapped out our custom logic to create a human readable delta with a Discord time stamp.

This allows users to hover over the time stamp to get an exact date, along with automatically rounding to the most significant unit.

I have also added a refactor commit to swap the conditional block around, so the "smaller" code path is the one in the if statement, which makes the function easier to read

Screenshots

Before:
![image](https://user-images.githubusercontent.com...

odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: bsoyka/rules\-shortening\-space
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
regal archBOT
odd spireBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/sir-lancebot] branch deleted: aoc\-count\-timestamp
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
regal archBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#

So! This is fun. The addition of nominee.id will no longer make this fail silently if a user leaves the guild after they were nominated but before they're up for a vote.

self.make_review() returns (string, None, None). review is therefore a non-empty string and that short-circuit logic there won't work anymore. nominee.id now tries to access the id attribute which a NoneType doesn't have.

So, the if not review should explicitly check for the nominee, not the review.

odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: kill\-sir\-threadevere
#

edb18d5 Add thread archive time enum to constants - ChrisLovering
292a500 Refactor make_review to return nominee too - ChrisLovering
c217c3e Manage nomination threads - ChrisLovering
6bd2a56 Update nomination message regex - ChrisLovering
0a4ba0b Supress NotFound when archiving a nomination - ChrisLovering

odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
regal archBOT
#

Description

To support something I'd like to do this year regarding assigned roles, there needs to be a nice way for people to associate their Discord account IDs with their name/account of Advent of Code. I'd like to shift the bulk of the work of figuring this out away from myself and to the users themselves. I'd like them to create the "links" between their accounts.

Proposed Implementation

Steal the Hacktober stats implementation!
The user should be able to run .aoc link . ...

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: subscribe\-with\-buttons
#

8680df2 Move handle_role_change to a util file - ChrisLovering
0465db9 Remove the subscribe command from the verificat... - ChrisLovering
5df26ba Add self assignable roles to config - ChrisLovering
4f70109 Add an interactive subscribe command - ChrisLovering
4c98287 Ensure the user interacting is still in guild b... - ChrisLovering

odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
#

e9c2bcc Send webhook embed containing information about... - Shivansh-007
a2958fb Add incidents webhook to default config template - Shivansh-007
c32aee3 Send multiple webhook messages in case of more ... - Shivansh-007
7c4fdba Use MessageConverter to find messages - Shivansh-007
d521273 Use str() when checking for message.content - Shivansh-007

#
[python-discord/bot] branch deleted: dynamic\-views
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] New branch created: subscribe\-redirect
#

Instead of silently failing in channels other than bot commands for non-staff, the bot now instead redirects the command output to bot commands and pings the user.

To facilitate this, I had to change the ctx.reply to a ctx.send since the invocation message may be in a different channel.

This shows the output from the command when ran in bot-commands and then below is the output if the user runs the command from another channel.
![image](https://user-images.githubusercontent.com/9753350...

odd spireBOT
odd spireBOT
regal archBOT
#
[python-discord/sir-lancebot] New branch created: redirect\-aoc\-commands
#

Description

This ports the redirect_output decorator from Python bot (first two commits) and then uses it to redirect all AoC commands that can be run in the main channel to the AoC commands channel

Did you:

  • [ ] Join the Python Discord Community?
  • [ ] Read all the comments in this template?
  • [ ] Ensure there is an issue open, or link relevant discord discussions?
  • [ ] Read and agree to the [contributing guidelines](https://pythondisc...
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
odd spireBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
#

Description

Allow the topic command to take a channel as an argument, so the channel can be used to get a topic from the provided channel's pool, rather than the single channel.

Reasoning

This would let some of the lesser accessed topics be useful outside of their own channel. For example, being able to draw from all of the topics in the normally-allowed channels would be beneficial to letting some lesser-used topics circulate.

Proposed Implementation

Add an optional c...

#

I'm not entirely sure if there's a way to inject stuff into a help docstring, although that would be nice.

If we could use {prefix} in the help text, and format it separately, that would work...

Perhaps an implementation in the bot.add_cog method which would format all of the function's docstrings.

simplified:

for func in cog.commands:
   func.__doc__ = func.__doc__.format(prefix=self.prefix)

This would also allow adding other values too... hmmmm. If done in one...

#

Tried something personally, I kind of like this, but obviously shouldn't use this in a production environment, although all of the docstrings are controlled.

Once again, this is not likely the proper iterator, but meh

# bot.add_cog
# iterates through all of the commands of the cog and formats their docstrings
# this might need to be elsewhere or work differently, not sure
for func in cog.commands:
  func.__doc__ = eval('f"""' + func.__doc__ + '"""',func.__globals__)
#

Description

Sir Lancebot doesn't handle Advent of Code usernames with spaces very well.

Steps to Reproduce

Run .aoc lb followed by any AoC username with at least one space.

Expected Behaviour

The bot would handle the arguments together as a username.

Actual Behaviour

The bot uses the first word and ignores the rest, unless the username is wrapped in quotes.

Known Impacted Platforms

  • [x] Web
  • [x] Desktop
  • [x] Android App
  • [x] iOS App

P...

regal archBOT
#
[python-discord/sir-lancebot] New branch created: aoc\-link
#
[python-discord/sir-lancebot] New branch created: aoc\-lb\-multiword
#

Relevant Issues

Approved by @janine9vn: #dev-contrib message

<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Closes #962

Description

I made .adventofcode leaderboard's self_placement_name argument keyword-only to accept multi-word usernames without needing quotation marks.

Did you:

odd spireBOT
regal archBOT
#

Description

This adds functionality to the Advent of Code cog for users to "link" their Discord Account with their Advent of Code name on the leaderboard. The cog doesn't explicitly make use of it, but it is necessary to exist and be functional for something I want to do.

This is implemented with a Redis Cache. A user can link their discord account with a name they specify and it's stored as a key-value pair with the Discord ID as the key.

There is no validation that the name they ...

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/sir-lancebot] branch deleted: update\-role\-constants
#

11d00e7 Rename Roles.moderator to Roles.moderation_t... - TizzySaurus [71d800a](https://github.com/python-discord/sir-lancebot/commit/71d800add94df3d678786ab482747ae904290129) Rename Roles.admintoRoles.admins - TizzySaurus [dc5f73b](https://github.com/python-discord/sir-lancebot/commit/dc5f73be8c18ef11c701822e8c600c8fca7b149c) Rename Roles.ownertoRoles.owners - TizzySaurus [e2da188](https://github.com/python-discord/sir-lancebot/commit/e2da188b554aba07b6c5a7a25b8af0baa74973cb) Check role id in MODERATION_ROLES instead of co... - TizzySaurus [aa272db`](https://github.com/python-discord/sir-lancebot/commit/aa272dbe789e86013969bc6f4e506d70ddfc63be) Check role id in STAFF_ROLES instead of compari... - TizzySaurus

odd spireBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
regal archBOT
regal archBOT
odd spireBOT
odd spireBOT
regal archBOT
#

I see this exists https://discordpy.readthedocs.io/en/master/api.html#discord.Message.to_reference but that's for creating message references. So it could be used by adding reference=ctx.message.to_reference(fail_if_not_exists=False), to the ctx.send call.

However fail_if_not_exists is just for messages that are deleted/NotFound before the send could happen. The API still raises the error `discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In message_ref...

regal archBOT
#

Description

So my idea was to add a BlackJack game where the user can do !blackjack to start the game against Sir-Lancebot (which will be the dealer), the member is going to start with 5000 chips and he will bet a amount of chips for a round, he can save up these chips and buy a few perks for other game ideas I had (which will be in other issue requests). Those perks would be something similar like "chip booster 15%" and similar perks. And maybe (with some help) we could also make player ...

regal archBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
#
[python-discord/king-arthur] New branch created: edit\-interaction\-message\-on\-interaction
odd spireBOT
odd spireBOT
regal archBOT
#
jb3
[python-discord/king-arthur] branch deleted: edit\-interaction\-message\-on\-interaction
odd spireBOT
regal archBOT
#

I believe there is a possible race condition which would extend the amount of bugs.

If a channel is currently being closed while this runs, they would be awaiting an edit coroutine. This would allow the program to switch context and run the waiting task here.

However, the api would still be completing when this task decides to reload the cog, furthering the issue.

Its a race condition that would make the problem worse, imo.

A solution with that could be some asyncio.Locks, in or...

regal archBOT
#
[python-discord/bot] New branch created: clean\_improvements
#

This PR follows observations of how the new clean features were being used.

Changes:

  • All clean commands now use the clean limit (message, time delta, ISO datetime) instead of traverse.
  • Consequently, clean all has been removed as clean until now effectively fulfills that role.
  • Removes the cache usage argument from the clean commands. The cache will be used if the age of the oldest message requested for cleaning is younger than the oldest message in the cache (meaning, all...
odd spireBOT
regal archBOT
#

I've looked into it when we opened the issue, but the cog is pretty resilient. If the closing process is still on the bot side, that shouldn't affect matters since it'll be canceled and resynced on startup.

If it's waiting on an API call from discord, I think it actually does not cancel until it's done, but I may be mistaken. Either way, the worst case scenario if it doesn't is that we'll move one channel twice, but it'll be to the same place both times, so nothing will break.

regal archBOT
odd spireBOT
regal archBOT
#

11d00e7 Rename Roles.moderator to Roles.moderation_t... - TizzySaurus [71d800a](https://github.com/python-discord/sir-lancebot/commit/71d800add94df3d678786ab482747ae904290129) Rename Roles.admintoRoles.admins - TizzySaurus [dc5f73b](https://github.com/python-discord/sir-lancebot/commit/dc5f73be8c18ef11c701822e8c600c8fca7b149c) Rename Roles.ownertoRoles.owners - TizzySaurus [e2da188](https://github.com/python-discord/sir-lancebot/commit/e2da188b554aba07b6c5a7a25b8af0baa74973cb) Check role id in MODERATION_ROLES instead of co... - TizzySaurus [aa272db`](https://github.com/python-discord/sir-lancebot/commit/aa272dbe789e86013969bc6f4e506d70ddfc63be) Check role id in STAFF_ROLES instead of compari... - TizzySaurus

odd spireBOT
regal archBOT
#
[python-discord/sir-lancebot] branch deleted: aoc\-lb\-multiword
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
regal archBOT
#
[python-discord/bot] New branch created: fix\-message\-convertor
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#

its possible to patch with a provided object, rather than patching with a mock.

we can provide the new= param, https://docs.python.org/3/library/unittest.mock.html?highlight=unittest mock#patch

This means that we don't need to use a mock at all, which should save making a useless objects (and all of its internal workings, unittest isn't exactly known for being fast in prod)

#

There is somewhat a problem here, conceptually.

Internally on dpy, load_extension, unload_extension, and reload_extension are all not awaitables.

However, the new load_extension for the bot is defined as a coro. There may be internal methods that call load_extension, but I don't think there are, so it should be good.

However, because of these three lines,

https://github.com/python-discord/sir-lancebot/blob/029a6324823d4d8e934c12edbc41d221e59d809a/bot/exts/core/extensions.py#L24...

regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#

I don't think using mocks here is really a problem. This function is only called when something explicitly calls the message converter, and I struggled to find anything that does to test this function with. Mind you that the message object in context, and the message passed to on_message do not go through this. The only thing that goes through this are commands which accept a message as their arg.

#

As a heads up, poetry.lock got all of the dependencies updated.

To fix this, please be sure you are using poetry 1.1.x

First revert poetry.lock locally.

Ensure that pyproject.toml is the same, with tldextract in it.

Next, use poetry lock --no-update
This will relock poetry without updating all of the dependencies.

However, it may be worth an update seperately to the dependencies, as this updated redis, rapidfuzz, sentry, etc

odd spireBOT
regal archBOT
#

Description

Too many people are trying to get the leaderboard rapidly. Since it only updates once every 30 minutes, a channel of #aoc-leaderboard would be nice while the game is afoot. This would automatically update every 30 minutes, as the leaderboard currently does. The current aoc lb command would link to the #aoc-leaderboard channel, maybe showing the user where they currently are, but linking to the channel to view the full lb.

Reasoning

![image](https://user-images.githubu...

#

A very similar idea (a pinned message) has been brought up [briefly](#aoc-bot-commands message) on Discord already, and Kat's decision was that we want to reduce calls to the AoC servers as much as possible, so we're only refreshing the leaderboard when it's requested. (cc: @janine9vn)

I'm open to discussing potential solutions to this, but I don't think there's a good way to do this without making unnecessary calls to AoC.

#

A very similar idea (a pinned message) has been brought up [briefly](#aoc-bot-commands message) on Discord already, and Kat's decision was that we want to reduce calls to the AoC servers as much as possible, so we're only refreshing the leaderboard when it's requested. (cc: @janine9vn)

I'm open to discussing potential solutions to this, but I don't think there's a good way to do this without making unnecessary calls to AoC.
...

#

Additionally, we would be able to use discord timestamps, to show a helpful message in the lb command of how long until the lb can be refreshed again.

This may be worth a second and different issue, given that this can be implemented regardless of the rest of this pr.

_Originally posted by @onerandomusername in https://github.com/python-discord/sir-lancebot/issues/966#issuecomment-985238562_

Given the amount of updating, and times ran the command, it would helpful to see a timest...

regal archBOT
regal archBOT
regal archBOT
#
[python-discord/bot] branch deleted: subscribe\-redirect
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
oak estuaryBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: pep\-main
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
regal archBOT
#

This patches the Message converter, not fetching a message from the API. This is the doc string for Discord.py's message converter https://github.com/Rapptz/discord.py/blob/master/discord/ext/commands/converter.py#L373-L386.

The second step there doesn't actually work. It doesn't fall back to the context channel if just a messageID is given, it actually only checks the cache.

Line 84 of this PR is what is actually patching this behaviour, where if _get_as_snowflake doesn't return a chan...

regal archBOT
odd spireBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] New branch created: fetch\-thread\-if\-not\-in\-cache
odd spireBOT
regal archBOT
#

The game itself works pretty well! Two suggestions from me however -
1 ) Change the text to text when the embed with all the words used and formatted into the prompt
2 ) We could use validation for checking whether something is a verb, noun, or adjective? Not sure about plural nouns or places, but we could use nltk.corpus.wordnet for validation. This is something that is more of a consideration as it depends on what you want to do.

odd spireBOT
regal archBOT
regal archBOT
#

We will definitely not have a leaderboard that refreshes automatically every 30 minutes. As it stand now we're already pushing the limits of the refresh rate with 30 minutes considering we're requesting 7 leaderboards everytime. The 30 minute cooldown is an absolute minimum, meaning we would expect there to be longer intervals throughout the day where we don't make the request.

Additionally, having a standalone channel with a message for the leaderboard places even more emphasis on the lea...

odd spireBOT
regal archBOT
#

As a heads up, poetry.lock got all of the dependencies updated.

To fix this, please be sure you are using poetry 1.1.x

First revert poetry.lock locally.

Ensure that pyproject.toml is the same, with tldextract in it.

Next, use poetry lock --no-update This will relock poetry without updating all of the dependencies.

However, it may be worth an update seperately to the dependencies, as this updated redis, rapidfuzz, sentry, etc

this has been deemed not t...

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#

Description

(Full list of changes is located on #778's review comments)

  • constants
    Some constants are unused, or not used well.
  • move ratelimits
    Ratelimits are only handled after a single call to fetch data, would make most sense to handle them in the fetch_data method
  • remove git alias
    while we're here, this should go as github is not git, and this allows future use of git as a command or tag.
  • add wait for deletion
    if a user wants to delete the embed, they will now be a...
#

Update: as mentioned by @janine9vn, there is already a timestamp of the last update.

However, I did not notice that until it was pointed out by her.

As the current embed is like this, below a wall of codeblock, its not very noticiable.
image

To update this issue, my suggestion is changing the every 30 minutes to something a bit different, where the time is a discord relative ti...

odd spireBOT
regal archBOT
#

Description

Remove the subscribe commands from lance, because as of https://github.com/python-discord/bot/pull/1868, this is now supported on Bot. (Beautifully executed, too)

Reasoning

No sense in having two commands that do the same thing, more maintenance work!

Proposed Implementation

TODO:

  • [ ] remove lovefest role command
  • [ ] remove advent of code command (deferred until January, when the command can no longer be assigned or removed)

Additional Detai...

regal archBOT
#

now that !subscribe exists on Python, the lovefest command is irrelevant

Relevant Issues

Partially closes #970 -- lovefest migration
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->

Description

Added a custom error that would be handled by the error handler, in order to deal with this migrations in the future. This has the benefit of only needing to raise an exception with the new command, and the error will be logged and an embed sh...

odd spireBOT
odd spireBOT
regal archBOT
#

NOTE: Do not merge until January

Depends on #971, where the initial implementation is.

Relevant Issues

<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Partially closes #970

Description

Yanked the aoc subscribe commands. See #971 for how this works.

Did you:

  • [x] Join the Python Discord Community?
  • [x] Read all the comments in this template?
  • [x] Ensure there is an issue open, or l...
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
#

max_continues is used when we hit the maximum redirection depth, which is hardcoded to 3 in L151:
https://github.com/python-discord/bot/blob/80abaef2cb991a86e97a40650efdc7b9541341d2/bot/utils/services.py#L151

That is to say, if you have a site that resolves after 5 redirects, the program will work as follows:

  • 0 continues: Will not resolve since we only do a max of 3 redirects
  • 1 continue: Will fail once, the continue. The max redirects for this is 6, and since we only have 5, i...
#

This is a little better documented on the actual command:

Setting max_continues will continue unfurling, even if we hit limits on the worker.

I don't mind renaming it if we find a better name. The reason I didn't bother making the other number configurable is that the range of valid values for it is a lot more difficult to control, and is dictated entirely by the range in the worker. I didn't want to maintain the range in two places. Continues is completely independent of the worker t...

#

Exposing our own IP: Not much of a concern at the moment, since my plan is just to run unfurling against a very small set (either a list in constants, or a filter list). Exposing our IP to a service like bit.ly is not a problem.

Is this still a problem since we're using a cloudflare worker (as implemented in https://github.com/python-discord/workers/pull/20) which runs on cloudflare's network, and would expose their ip?

#

This is a little better documented on the actual command:

Setting max_continues will continue unfurling, even if we hit limits on the worker.

Yeah that isn't clear to someone who doesn't understand the workers. This would be better:

Setting max_continues means that unfurling will retry if the limit of redirects on an individual worker is hit.

I think what makes sense is just having the continues yes..

regal archBOT
#

I agree with some of what Jason is saying.

since Since the logging statement is before it happens, it should be in present or future tense.

If I was in a late debugging session trying to figure out what happened, I would think that the account successfully got linked, until I dug a bit further.

Changing the tense would save some time, and make more sense, as being past tense implies it has happened, when it hasn't.

regal archBOT
#

11d00e7 Rename Roles.moderator to Roles.moderation_t... - TizzySaurus [71d800a](https://github.com/python-discord/sir-lancebot/commit/71d800add94df3d678786ab482747ae904290129) Rename Roles.admintoRoles.admins - TizzySaurus [dc5f73b](https://github.com/python-discord/sir-lancebot/commit/dc5f73be8c18ef11c701822e8c600c8fca7b149c) Rename Roles.ownertoRoles.owners - TizzySaurus [e2da188](https://github.com/python-discord/sir-lancebot/commit/e2da188b554aba07b6c5a7a25b8af0baa74973cb) Check role id in MODERATION_ROLES instead of co... - TizzySaurus [aa272db`](https://github.com/python-discord/sir-lancebot/commit/aa272dbe789e86013969bc6f4e506d70ddfc63be) Check role id in STAFF_ROLES instead of compari... - TizzySaurus

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/sir-lancebot] branch deleted: aoc\-link
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#

Description

Changes in the AoC DayAndStarView:

  • From now on, when the interacting user and the original author of the view is different, the bot will send an ephemeral message, regarding the issue, instead of the default error message.

Did you:

  • [x] Join the Python Discord Community?
  • [x] Read all the comments in this template?
  • [x] Ensure there is an issue open, or link relevant discord discussions?
  • [x] Read and agree to the [contr...
odd spireBOT
regal archBOT
regal archBOT
#

It is not so high priority, so I think this should be solved with exception raising and handling in global error handler. This would remove possible future duplication.

I'm not sure how that would work in the interaction environment.
If an error is raised in the interaction_check, it'll call the View.on_error(See): The default implementation prints the traceback to stderr.
...

#
[python-discord/bot] branch deleted: fetch\-thread\-if\-not\-in\-cache
oak estuaryBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: fix\-message\-convertor
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
#
[python-discord/sir-lancebot] New branch created: fix\-message\-converter
#

Description

Ported from https://github.com/python-discord/bot/pull/1990/

Discord.py's message converter is supposed to infer channelID based on ctx.channel if only a messageID is given. A refactor (linked below) a few weeks before d.py's archival broke this, so that if only a messageID is given to the converter, it will only find that message if it's in the bot's cache.

Did you:

odd spireBOT
regal archBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
odd spireBOT
regal archBOT
night lilyBOT
#
Sir Lancebot

Connected!

regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: Update\-Username\-Checks
#

aa08fe2 Normalise names before checking for matches - ChrisLovering
baf8239 Check if we recently alerted about a bad name b... - ChrisLovering
8efbff6 Return early when getting name matches - ChrisLovering
5901ac0 Also run name filters against a cleaned version... - ChrisLovering
d0dc7a0 Build an intermediate list for speed in filteri... - ChrisLovering

oak estuaryBOT
odd spireBOT
regal archBOT
night lilyBOT
#
Sir Lancebot

Connected!

oak estuaryBOT
regal archBOT
#
[python-discord/snekbox] New branch created: cgroupsv2