#dev-log

1 messages ยท Page 80 of 1

regal archBOT
#

Fixes #1715

If the cog is reloaded while there are less than the maximum amount of available channels, it makes some channels available until the limit is reached. When a channel is made available, it updates the available_help_channels set. The update_available_help_channels() function would not update this set if it sees that the set already contains elements. This resulted in only the channels that were just made available being in the set; the set would not contain the channels tha...

odd spireBOT
regal archBOT
regal archBOT
#

dcd3bc3 Add February in_month check to love calculator ... - ChrisLovering
cd90422 Require both members used in love calculator ha... - ChrisLovering
c334c20 Sort the members before calculating a love score - ChrisLovering
66d5315 Update love calculator docstring to reflect new... - ChrisLovering
0a2e184 Remove unneeded checks in love calculator command - ChrisLovering

#
[python-discord/sir-lancebot] branch deleted: love\-command\-checks
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
oak estuaryBOT
#

Doc item doc_item.symbol_id='resources' present in loaded documentation inventories not found on site, inventories may need to be refreshed.

regal archBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
#
[python-discord/bot] New branch created: wookie184\-patch\-1
odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: wookie184\-patch\-1
oak estuaryBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
#

@Xithrius do you have a status on when you might be able to respond to Mark's comments/finish this up? It seems pretty close and would be nice to get it merged fairly soon. Thanks!

I'm still in the process of slowly resolving all of this. At the same time, I will also be needing to resolve the current file conflict. I also hope to merge this soon.

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

Connected!

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: bug/info/bot\-13b/code\-snippet\-msg\-404
#

3504731 CodeSnippets: refactor on_message - MarkKoz
cfbeabb CodeSnippets: move init to the top of the c... - MarkKoz
4753264 CodeSnippets: refactor snippet parsing into a s... - MarkKoz
900bf69 CodeSnippets: don't send snippets if the origin... - MarkKoz
a6ac449 Merge branch 'main' into bug/info/bot-13b/code-... - ChrisLovering

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

5f0d7f7 Enhance security in the Webhook remover. - D0rs4n
d388d39 Improve code consistency in webhook_remover - D0rs4n
e8b2235 Fix up, and improve code consistency in webhook... - D0rs4n
7d73215 Patch the regEx pattern in webhook_remover to m... - D0rs4n
60b1d16 Improve output message consistency in webhook_r... - D0rs4n

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

I had actually written a small patch to allow for forcefully breaking lines (more specifically, I used the escape sequence used for time units -- \u2003 -- as a non-escapable break).

The implementation had the added benefit of not requiring any docstring changes. At this point, it's gone, and this PR is very outaded, but it should be pretty easy to take the work already done here, add on the patch I just described in a new PR.

regal archBOT
#
[python-discord/bot] branch deleted: bug/help/1715/avail\-set\-init
#

8731b19 HelpChannels: fix incomplete init of available ... - MarkKoz
f6a1f00 HelpChannels: simplify formatting of category n... - MarkKoz
052cead HelpChannels: use utility method to get availab... - MarkKoz
cb99afe Merge branch 'main' into bug/help/1715/avail-se... - MarkKoz
5a7256f Merge #1752 - help channels: fix initialisation... - MarkKoz

odd spireBOT
oak estuaryBOT
odd spireBOT
odd spireBOT
regal archBOT
#

Have managed to reproduce this locally, it seems discord will let you upload profile pictures as small as 1x1px, and even when accessing them with e.g. ?size=1024 discord will not upscale them. The fix for this is pretty simple, just using PIL to resize the image before applying the effect. This will also make images display more consistently in the embeds.

I can implement this

regal archBOT
odd spireBOT
regal archBOT
#

While this works fine, I don't think the current comment is entirely clear. It says that -1 is needed, but it isn't very clear why, and if we aren't using it then surely it isn't needed.

From some testing it seems that -1 was there to prevent values triggering on the number before. e.g. without -1 the message for 100 in the JSON also appears on 99. I think this behaviour isn't a problem, but the current comment should be changed to explain this behaviour, or at least remove the...

regal archBOT
#

Passing an empty list here instead of having the else block here would be better as you are already checking if contents is populated in the wikipedia_search_command.

            return lines

The else block can be used in the wikipedia_search_command. This will require you to define the lines variable (line 64) outside the if-else scope.
And also don't forget to change the function return annotation to only List[str] instead of Optional[List[str]].

#

Nice stuff, I'm approving this as it does seem to work, although there are two comments I would like to make.

Firstly, while the randomness of the articles chosen is nice, there are a lot of wikipedia articles, to the extent that usually picking a random wikipedia page will give you some obscure topic you have no idea about. For example:

[redacted] is a village in Nowkand Kola Rural District, in the Central District of Qaem Shahr County, Mazandaran Province, Iran. At the 2006 cens...

odd spireBOT
regal archBOT
#

We should handle APIErrors and ResponseCode errors (if the response code is not 200). APIError could mean there is an error with the feed of the response which this PR is solving. We might have unexpected errors where the response code is not 200, do we have any instances of this situation of non 200 responses?

This issue can be delt separately from the issues being solved by this PR but I would like to know what others think about this.

The Wikipedia API will always send back a r...

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

Changing my review to 'approve' to speed things along. Although I'm still interested in the answer to the above question.

Since I do check if the API call is OK with the checking if 200 at the front, this is more if there is some other error between a good response from Real Python and the bot sending the embeds to the user in Discord. It is a kind of catchall, and could probably function just as well without it.

I'm currently away from my normal set up so I wouldn't be able to test ...

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

Doc item doc_item.symbol_id='environment-variables' present in loaded documentation inventories not found on site, inventories may need to be refreshed.

regal archBOT
odd spireBOT
regal archBOT
regal archBOT
#
[python-discord/bot] New branch created: mbaruh/anti\-spam
regal archBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] New branch created: Formatting\-issues\-on\-the\-\!server\-command
odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: Formatting\-issues\-on\-the\-\!server\-command
oak estuaryBOT
odd spireBOT
regal archBOT
#

We sometimes need to query user data such as the user or infractions embed, when all we have is the username.

Since the site DB stores user ID's and usernames, and already has an endpoint to retrieve stored data based on username, we can use that in case the user is not in the guild and we try to query by their username, to get the user's ID.

This can be implemented by improving the FetchedUser converter to handle cases where the given arguement doesn't represent an integer.

regal archBOT
regal archBOT
#

Description

The proposal is to allow users to run the bookmark .bm command in help channels. Currently the command can be run in some other channels such as off-topic, but it is not allowed in the help channels.

Reasoning

Sometimes I wish to bookmark a particularly helpful response I receive in a help channel without having to go to #bot-commands or #sir-lancebot-playground. It would be very nice for users to be able to run .bm within their current help channel.

Prop...

regal archBOT
odd spireBOT
regal archBOT
#

I'd like to propose that everywhere in the bot (barring talent pool) that uses STAFF_ROLES as a check is changed to also include both python community and partners as passing that check.

These places would be:

  • Duck pond (for seeing if a message was from a staff member)
  • Help command (Posts output in channel, rather then being relayed to bot-commands)
  • Role list (a command to list all roles)
  • Role info (a command to get info on a given role)
  • User info (Posts output in channel,...
#

So this was the way I was doing it originally, but reacting to every message has the effect of burying the board even faster. My reasoning was that, in terms of gameplay, the player needs to know if their answer was incorrect (so they can correct it, or see where they went wrong), but doesn't immediately need to know whether their answer was accepted or was a repeat.

Currently I have it updating the list of claimed solutions below the board. I found that to be a good compromise in testing,...

odd spireBOT
odd spireBOT
odd spireBOT
odd spireBOT
regal archBOT
#
jb3
[python-discord/king-arthur] New branch created: jb3/add\-cronjobs
#
jb3
[python-discord/king-arthur] branch deleted: jb3/add\-cronjobs
regal archBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
#

Description and reasoning

The current uwuification algorithm is very simple and frankly unsatisfactory, as there have been many recent advances in the field of uwuification I believe that Sir Lancebot would be greatly improved by the addition of a more feature-rich uwugorithm.

Proposed Implementation

I personally have written a more advanced uwuifier in python that does not depend on any external libraries and am willing to implement it into...

#

Hey! Congrats on finishing your project!

Iโ€™m not personally in favor of this idea. There are costs to implementing any feature, which most people donโ€™t consider. The most obvious costs are implementation, and review, but the more expensive ones are maintenance.

I really donโ€™t care all that much about this command, and I donโ€™t think itโ€™s worth investing effort into making it some super generator that will replace all generators (TM).

If the current implementation is unsatisfactory, le...

#

That's a valid concern, I personally believe that it's a fine feature, also with things like this, once they're up and running, maintenance isn't a real burden since there are no additional dependencies and there would be a single call to a black box which alters a string, not exactly a towering monolith of complexity. I'd personally be more interested in seeing the project grow, not regress in terms of features.

Either way, not my call.

odd spireBOT
regal archBOT
regal archBOT
#

If the current implementation is unsatisfactory, letโ€™s remove it.

I disagree with this. Lancebot is, at its whole, a fun bot. If people want to improve on existing things, more power to them.

I've read the code for the implementation @gitautas wrote up. Since it uses all built-ins and execution/processing time is minimal, there is very little strain on the system itself. @gitautas Has also mentioned (in voice chat) that they are more than willing to make it native to Lancebot in...

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

Closes #622, closes #665, closes #1522

This PR gives the AntiSpam cog the ability to detect spam of users across channels, and even when their messages (or part of them) were deleted, either by them or automatically because of another filter.

Implementation

The feature was implemented by making the on_message listener search for messages in a cache, rather than the history of the channel the message was sent in.

The MessageCache class

The cache used is an instance of a class...

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/sir-lancebot] New branch created: avatar\-effects\-fix
#

Relevant Issues

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

Description

Resized images to 1024x1024 before applying effects. Also made a small refactor

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 [contributing guideline...
odd spireBOT
night lilyBOT
#
Sir Lancebot

Connected!

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

@MarkKoz the UserConverter relies on the cache, which is usually not enough. Whenever we try look someone up by name#discrim when they've left the guild we get an error.

From my understanding this will still be the case. The UserConverter only doesn't rely on cache when the user id is passed. If you want name#discrim support for non-cached users then the UserConverter doesn't give this (again, if I'm correctly understanding everything).

regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
sullen whaleBOT
#
Thread Bot

Connected!

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

2ea95a0 Update reminders to reply instead of using a ju... - D0rs4n
d681725 Improve code consitency in remainders - D0rs4n
d697860 Provide jump_url in reminders even when the bot... - D0rs4n
7e8d24f Modify reminder response messages to be in the ... - D0rs4n
69b65a2 Merge branch 'main' into pr/replinders - Akarys42

odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] New branch created: log\-info\-reminder\-replies
odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: log\-info\-reminder\-replies
oak estuaryBOT
odd spireBOT
regal archBOT
#
[python-discord/metricity] New branch created: sync\-channels\-guard\-no\-category
#
[python-discord/metricity] branch deleted: sync\-channels\-guard\-no\-category
regal archBOT
#
[python-discord/bot] New branch created: metabase\-sharing
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
oak estuaryBOT
#

Doc item doc_item.symbol_id='resources' present in loaded documentation inventories not found on site, inventories may need to be refreshed.

ashen phoenix
#

!docs refreshdoc

oak estuaryBOT
#
Inventories refreshed
regal archBOT
#
[python-discord/site] New branch created: swfarnsworth/smarter\-resources/new\-resources
regal archBOT
#

Sentry Issue: BOT-1M7

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
  File "bot/utils/time.py", line 78, in discord_timestamp
    return f""
  File "bot/exts/info/information.py", line 260, in create_user_embed
    joined = discord_timestamp(user.joined_at, TimestampFormats.RELATIVE)
  File "bot/exts/info/information.py", line 235, in user_info
  ...
regal archBOT
#
[python-discord/bot] New branch created: TizzySaurus\-patch\-1
odd spireBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: TizzySaurus\-patch\-1
oak estuaryBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: dawnofmidnight/site\-urls
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
#

How exactly are we planning on implementing this functionality?

My thoughts currently is that rather than adding another converter, we'd allow the passed user to be a str and in the case it is a string, we call some utility function which will query the database -- the utility function returning either None or raising an error when the username isn't found and returning the wanted data (e.g. infractions) when the username is found.

#

This is an outdated comment:
https://github.com/python-discord/bot/blob/4e158b2a64e6f640847f0f7d2f229c96cecb2c46/bot/exts/moderation/watchchannels/bigbrother.py#L97

Otherwise looks great

What exactly is this if statement here doing? I feel like it's supposed to check the user is in the server and isn't staff, but that's not what it's currently doing (the and should be an or and instead of hasattr(user, 'roles') can use isinstance(user, discord.User) (although if we on...

#

In a recent staff meeting we agreed that we weren't giving enough love to our patreon supporters.

As such, we have agreed that we should have the bot post in #community-meta every time someone new receives one of the patreon roles, along with posting once a month (on the 1st, just after the patreon subscription cycle) with a full list of all of our supporters.

The post when we get a new supporter should include:

  • A mention for the user who has started supporting
  • What tier they ar...
#

Making it a converter brings other complications, such as what would the converter return?

From my understanding it'd have to end up returning t.Union[MemberOrUser, discord.Object] when the person is valid since we want to allow for deleted accounts but then this leads to a typehint being of two different types, potentially leading to further implications.

There's also the fact that we'd be querying the database twice (once for the conversion, and a potential second time for the actua...

#

I feel like it's supposed to check whether the user is a staff, but would make more sense for the hasattr part to be isinstance(user, discord.Member)

I suppose it's more ducktype-y to check for the attribute instead of the whole type. However, we know the converter can only return one of two types, so it doesn't really matter in this case.

Yeah, I guess. I'll just pretend I didn't see this and update the comment to say discord.User instead of FetchedUser.

odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: remove\-redundant\-converters
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
#

The biggest downside I see is that itโ€™ll leave a possible security vulnerability if the user doesnโ€™t set it, and nothing will tell them so

Yeah, that's the concern, and I think it's a completely valid point. I'm thinking that production could just "take the hit" and set the env var to False explicitly. It has to set other env vars anyway.

What is the verdict then? do we set an env var in prod, and default to true?

regal archBOT
#
[python-discord/bot] New branch created: TizzySaurus\-patch\-1
odd spireBOT
regal archBOT
regal archBOT
#

Currently the typehint for the mentions argument of the !remind command is Greedy[Mentionable], where Mentionable = t.Union[discord.Member, discord.Role].

The issue with have a greedy discord.Member is that cases like !remind 3d fix this" ends up raising the error fix is not a valid duration string.since the3d` gets matched to a member instead of the duration of 3 days.

My proposed solution to this, is simply to instead do Greedy[t.Union[UserMentionOrID, discord.Role]]...

#

Making it a converter brings other complications, like what would it return?

I suppose we'd want the converter to return a custom datatype instance which has all of the user data obtainable from the database?

I'm struggling to envisage how exactly this would work.

The way it would work is that it would try to find the username and discrim in the database, and if it's there fetch the ID. Once you have the ID you can use the discord API as usual.

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

9ad34a8 Move metabase error handling to a cog error han... - ChrisLovering
30bcc28 Change metabase config to base url, rather than... - ChrisLovering
ce80b92 Add alias for metabase export - ChrisLovering
eb5cede Trigger typing, to avoid wrapping whole func in... - ChrisLovering
4a0d619 Add ability to publish metabase questions - ChrisLovering

#
[python-discord/bot] branch deleted: metabase\-sharing
odd spireBOT
regal archBOT
#

The biggest downside I see is that itโ€™ll leave a possible security vulnerability if the user doesnโ€™t set it, and nothing will tell them so

Yeah, that's the concern, and I think it's a completely valid point. I'm thinking that production could just "take the hit" and set the env var to False explicitly. It has to set other env vars anyway.

What is the verdict then? do we set an env var in prod, and default to true? I don't mind that approach.

I am okay ...

oak estuaryBOT
odd spireBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: TizzySaurus\-patch\-1
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
regal archBOT
#

If we decide to use the quackstack API, there shouldn't be any reason to stall this issue and it can be worked on. Otherwise, if we decide to use quackstack via a PyPI package and generate the duck images ourselves, we would need to wait for python-discord/quackstack#52.

There are downsides to both of them, if we use the API, anyone wanting to run the quack command on sir-Lancelot would need to have the API running and if we decide to use the PyPI package and generate the image ourselves, ...

#
[python-discord/bot] branch deleted: fix\-reminder\-greediness
odd spireBOT
regal archBOT
oak estuaryBOT
odd spireBOT
regal archBOT
regal archBOT
#

@MarkKoz I think the current duplicated functions should remain where they are for now. If we do decide to move these functions somewhere else, it should be within a different PR focused on refactoring.

The functions themselves in my own attempt of refactoring ended up taking a bit too many variables as arguments. That may have just been me though, and it was quite a while since said last attempt. Although at this point in time it seems to be still the same case.

I feel li...

#
jb3

Instead of serving ducks from our hosts we should upload generated ducks to an S3 host (preferably Linode Object Storage, which is compatible with any S3 wrapper).

Once generated we'll return these links to the clients and serve from there to save bandwidth and improve speed of delivery. We should check for presence of an image before generating so that we don't store duplicate ducks.

regal archBOT
#

@Xithrius I'm not sure I'll have the time, and I haven't worked with the codebase for quite a while so I might need some getting use to.

Also (for hacktoberfest stats/prs), this year's hacktoberfest (if it's happening) probably doesn't need the "first 3 days counts even if it doesn't haven hacktoberfest label" anymore. Again, I haven't been on discord for a long time nor have I seen the commits and stuff so I'm not sure if that needs to be changed before October.

In any case, I think we...

regal archBOT
#

The biggest downside I see is that itโ€™ll leave a possible security vulnerability if the user doesnโ€™t set it, and nothing will tell them so

Yeah, that's the concern, and I think it's a completely valid point. I'm thinking that production could just "take the hit" and set the env var to False explicitly. It has to set other env vars anyway.

What is the verdict then? do we set an env var in prod, and default to true? I don't mind that approach.
...

regal archBOT
regal archBOT
#
[python-discord/bot] New branch created: antispam\-ignore\-bot\-mentions
#
[python-discord/bot] New branch created: TizzySaurus\-patch\-1
odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: TizzySaurus\-patch\-1
odd spireBOT
oak estuaryBOT
odd spireBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: feat/mod/1665/override\-auto\-mute
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#

We can't get the timezone of the user calling the command, I propose we use the same time/duration converter we have in Python.
This converter accepts durations and ISO date times (Timezone naive) . It may also be in lancebot already, but I can't check right now.

I think discord.Message.created_at is tz aware, is it not?

It is tz-aware yes, but that just means that it includes the tzinfo that it's UTC, it does not include the timezone of the invoker.

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

We can't get the timezone of the user calling the command, I propose we use the same time/duration converter we have in Python.

This converter accepts durations and ISO date times (Timezone naive) . It may also be in lancebot already, but I can't check right now.

I think discord.Message.created_at is tz aware, is it not?

It is tz-aware yes, but that just means that it includes the tzinfo that it's UTC, it does not include the timezone of the invoker....

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#

0199600 Ignore bot mentions in antispam mentions rule - wookie184
7daab91 Fix current tests by using MockMember in mentio... - wookie184
a6121e6 Added some more test cases to ensure bot mentio... - wookie184
c2c4319 Merge branch 'main' into antispam-ignore-bot-me... - mbaruh
37de267 Merge pull request #1770 from python-discord/an... - mbaruh

#
[python-discord/bot] branch deleted: antispam\-ignore\-bot\-mentions
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/sir-lancebot] New branch created: coinflip\-command
#

Relevant Issues

Closes #612.

Description

Implemented coinflip command within bot/exts/evergreen/coinflip.py.

The command simulates flipping a coin. If a coin side was provided to the command, then the bot states whether the user correctly guessed the side of the flipped coin.

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 di...
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#

I'd like to propose that we add mypy to the codebase and add it to our linting workflow.

The initial PR for this would be a large one, fixing the legacy issues, but from then on it'll be picked up before a PR can even be merged.

There are stubs that we can add as dev dependencies for discord.py and any other deps that we find lacking in the type hinting department.

This issue is mostly for planning for now, as I'd like to get more opinions on this change.

regal archBOT
#

Description

Add 30 to 70 (tbd, we're making the q/a pairs currently as we speak) new question/answer pairs to the Python category. They will range from easier topics such as dunder methods for container classes, to harder and more obscure ones like whether __prepare__ in a metaclass should be an instance, static, or class method.

The subsequent PR, if this issue is approved, will also add some more possible answers to some of the past questions.

We'll do this once in a while to ke...

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

I've never given mypy a proper shot before. The one time I tried it I got a bad impression because I was immediately trying to do something it cannot support (defining a JSON type, which is recursive). It's left me with the impression that it may be a burden trying to appease mypy. Anyway, I am open to trying it.

My concern is the type stubs. Do all packages we use have type stubs? Are they all well maintained and up to date? What recourse do we have if something is lacking type stubs or f...

regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#

I read through the issue, I'm not sure about the consensus on using enums, but I think defining the categories with an enum would look a bit more consistent. Also.. I believe to implement the no-delete "functionality" we should sort of "hand-over" the control to the embed helper, and it'll handle the logic needed to allow the users to delete the message.
Like:

await embed_helper(ctx, no_delete=False,category=embed_categories.ERROR, description="Something went wrong")

That...

regal archBOT
#

My concern is the type stubs. Do all packages we use have type stubs? Are they all well maintained and up to date? What recourse do we have if something is lacking type stubs or falls out of date?

To install all the known stubs we can do mypy --install-types. I can't remember from my testing how many this installs but it does install a few.

As for libraries without stubs, we can just not check those libraries by passing --disable-error-code import. We probably also want to ignore ...

odd spireBOT
regal archBOT
#

Exactly what the title says.

@Akarys42 said on Discord that they remember users by the pfp moreso than their name, which I concur with. There's also the fact that some members have nicknames and so displaying the name#discrim can make you think you've nominated the wrong person.

By displaying the mention, we can easily see their pfp + nickname, and if someone really wanted the name#discrim they can still access it.

#
[python-discord/bot] New branch created: TizzySaurus\-patch\-1
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
#

I'd be interested in working on this, but need to know what approach we'd like to take.

Would it simply be a case of changing has_no_roles_check(*STAFF_ROLES) to has_no_roles(*STAFF_ROLES, partners, python_community), or do we want to add some sort of separate roles-category for this?

What I would do is add the two roles to the existing STAFF_ROLES constant. You can then explicitly list all of those roles except partners and community members in the duck pond cog.

#

Description

In https://github.com/python-discord/bot/issues/1683 we decided to limit the internal eval command to owners if the bot is in debug mode, it would probably make sense to do a similar thing for sir-lancebot.
We already have a debug constant that seems to default to true
https://github.com/python-discord/sir-lancebot/blob/0a1b7b4bedbb6c19ad572869b57b466adae66b4a/bot/constants.py#L137
So all that needs to be done is add a check to the command, as was done in the Python bot P...

#

741c0dc Specify DEBUG_MODE via the config file - MarkKoz
14056b3 Restrict internal eval to bot owner when in deb... - MarkKoz
b6b0525 Enable debug mode by default - MarkKoz
6098a47 Merge branch 'main' into enhance/1683/restrict-... - Akarys42
3a6b9d1 Merge pull request #1700 from python-discord/en... - Akarys42

#
[python-discord/bot] branch deleted: enhance/1683/restrict\-int\-eval
odd spireBOT
regal archBOT
oak estuaryBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
#

Do we want to allow partners + python community to have member-pings in the !remind command?

I think that would be fine, although I wouldn't mind.

Also in terms of commits, do we want "Allow partners + python community to use x" for each "x" or just one overall "Allow
partners + python community more access"

I think one overall commit would be good.

And do we want to allow partners + python community to use the snowflake command anywhere?

Sounds fine to allow that.

regal archBOT
#
[python-discord/bot] New branch created: community\-partners\-access
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#

429ca2a Add constants.STAFF_PARTNERS_COMMUNITY_ROLES - TizzySaurus
2c93e2d Allow partners & members of the python communit... - TizzySaurus
675b961 Allow partners & members of the python communit... - TizzySaurus
5be8cd1 Allow partners & members of the python communit... - TizzySaurus
5998a8e Minor linting fixes - TizzySaurus

#
[python-discord/bot] branch deleted: community\-partners\-access
oak estuaryBOT
regal archBOT
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
#

Yes, but most of times in the code you choose a random reply(ERROR_REPLIES) as well, you set the color, all around the code. Furthermore, making a helper would make it much more easier to generate embeds that could be deleted. (Like mentioned in the issue description)

regal archBOT
regal archBOT
regal archBOT
regal archBOT
#
[python-discord/bot] New branch created: mbaruh\-patch\-1
odd spireBOT
oak estuaryBOT
night lilyBOT
#
Sir Lancebot

Connected!

sullen whaleBOT
#
Thread Bot

Connected!

odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: mbaruh\-patch\-1
oak estuaryBOT
odd spireBOT
regal archBOT
oak estuaryBOT
regal archBOT
regal archBOT
regal archBOT
#

To ensure the code conforms to mypy

Of course, that's what adding mypy to the CI does. But why do we want the code to strictly conform to mypy? That was my question

How do you use mypy? Is there some middle ground between not using it at all and enforcing it in CI? Or are you instead asking why we should be using mypy in any capacity?

regal archBOT
regal archBOT
#
[python-discord/bot] New branch created: update\-remind\-help
odd spireBOT
regal archBOT
#

This is a good suggestion as it will really improve the usability of the command for the masses. A few points which are open to discussion:

  1. In cases where it's not sending it to the same channel, is it feasible to first try to DM before resorting to sending it in #bot-commands? This might get complicated when multiple roles/users are mentioned in the reminder, but note that the feature is limited to Helpers+.
  2. It should never send a reminder in a help channel, even if invok...
regal archBOT
regal archBOT
regal archBOT
#
[python-discord/bot] New branch created: experiments/akarys/check\-licenses
#

Since our project is licensed under the MIT License, we can't be using any dependencies in our project. This PR adds a step to the CI lint phase that will use pip-licenses to verify that all the installed packages are part of an ALLOWED_LICENSE variable. This variable is currently set to be every license we currently use. We opted to use an allowlist instead of a denylist to make sure that new licenses are reviewed by hand and added to that variable.

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

I'd guess it's because of the Optional, not exactly sure what the neatest thing to do here would be. Returning some object indicating an error and then handling that in the function would probably work but in that case there's no point in using a converter. I feel there should be a better way though...

I've simply gone with the approach of doing = None instead of using Optional, which seems to fix things.

odd spireBOT
regal archBOT
#

Due to the role hierarchy, the bot cannot infract mods or higher. Currently, this error is caught and handled by the infraction system, but it still logs the exception, causing it to show up on Sentry. A discussion on Discord came to the conclusion that the exception should only be logged if the target user is lower than a mod. The idea is that mods+ is an expected failure, but anything else would be unexpected. The implementation would require hard-coding a condition that the user is not a m...

odd spireBOT
regal archBOT
#

@wookie184 I moved the final scores to a new message sent when the game is over, but left the claimed and missed flights in the initial embed. So as it stands the UI is split into 3 parts:

initial embed: the board and flights that use labels that reference the board
message reactions: solely for incorrect guesses since reactions bury the initial embed faster but these ones are necessary
final message: indicates how the game ends (time/goose/mod) and shows the final scores

Are you good...

regal archBOT
#
jb3
[python-discord/site] New branch created: jb3/collectstatic\-build
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#

Docker image fails to build locally

You have requested to collect static files at the destination
location as specified in your settings:

    /app/staticfiles

This will overwrite existing files!
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: Traceback (most recent call last):
  File "/app/manage.py", line 198, in <module>
    main()
  File "/app/manage.py", line 194, in main
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/py...
odd spireBOT
regal archBOT
regal archBOT
#

Right now, due to the verbosity of this command, reloading the server generates about 200 log lines, saying the existing assets have been deleted. I think it is causing more harm than good, so I propose to reduce the verbosity by one.

            call_command("collectstatic", interactive=False, clear=True, verbosity=self.verbosity - 1)

With this suggestion applied, it only generates one log line, Collecting static files..

regal archBOT
#
[python-discord/bot] New branch created: user\-message\-link\-support
odd spireBOT