#dev-log

1 messages ยท Page 87 of 1

regal archBOT
#
[python-discord/bot] branch deleted: bump\-licenses
oak estuaryBOT
odd spireBOT
regal archBOT
#
[python-discord/sir-lancebot] New branch created: bump\-licenses
#
[python-discord/sir-lancebot] New branch created: bump\-pip\-licenses
#

Description

pip licenses used to use an internal method of pip, which got removed and caused errors in any runs. The newer version, which this commit bumps it too, now uses another method.

Did you:

#
[python-discord/sir-lancebot] branch deleted: bump\-licenses
#
[python-discord/sir-lancebot] branch deleted: bump\-pip\-licenses
odd spireBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
regal archBOT
#

Every now and then, the help channel cog will desync (mostly due to unavoidable issues from the discord API). This desync takes many forms, most prominent being:

  • Decrease in number of help channels available
  • Desync of dynamic help message in #how-to-get-help
  • Pins not being removed after a channel is closed
  • Cooldown roles not being removed after a session ends

These happen often enough that I think we should spend some effort to get them to automatically figure themselves ou...

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

Connected!

odd spireBOT
odd spireBOT
regal archBOT
#

I think reloading a cog is a non trivial action that shouldn't be running 48 times a day. It does make the cog unresponsive for 5s and do a bunch of API calls. I am also scared about race conditions where we would write a value to Redis, reload and read it too fast, but I don't know how possible that is.

My opinion would be to do implement the three checks mentioned above as a background task, that runs every once in a while. As for the channel placement itself, I wouldn't mind having the ...

regal archBOT
regal archBOT
#
[python-discord/sir-lancebot] New branch created: tools/isort
odd spireBOT
regal archBOT
regal archBOT
#
[python-discord/bot] New branch created: modlog/explicit\-thread\-name
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
#
[python-discord/bot] New branch created: sql\-fstring
regal archBOT
odd spireBOT
regal archBOT
#

Hello! Thanks for the PR!

I don't think copy pasting is a good way of handling this. We won't ever think about modifying the other version when modifying one of them. I can think of ~two~ one solution~s~, feel free to also suggest your own: ~1. Create a symlink? I don't know if this is something Git will like, or at least that will be cross-platform, but I think it is worth a try~ after giving it more thoughts we decided that this was a bit too hacky, we would rather wait for #1663 2...

oak estuaryBOT
odd spireBOT
regal archBOT
#

e082596 Add handling for when message.author is a di... - TizzySaurus [3793035](https://github.com/python-discord/bot/commit/379303520b1cbb0d777d05a2362a9df4006e636d) Migrate to on_socket_event_type event - ChrisLovering [aec75bd](https://github.com/python-discord/bot/commit/aec75bda82037bc5e3e9071d5e882bb343ff59ed) Merge pull request #1890 from python-discord/Mi... - Akarys42 [b2e8bfd](https://github.com/python-discord/bot/commit/b2e8bfdc47339714ec014a13e2018e03c0931fe4) Invert isinstance check as per review - TizzySaurus [5b7d8c4](https://github.com/python-discord/bot/commit/5b7d8c41c88d3d0333f16dabd45efa770da87c82) Update log message for when author isn't disco... - TizzySaurus

#
[python-discord/bot] branch deleted: tz\_awareness
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
#

Sentry Issue: BOT-1P9

TypeError: can't compare offset-naive and offset-aware datetimes
(3 additional frame(s) were not displayed)
...
  File "bot/exts/moderation/infraction/management.py", line 250, in search_user
    await self.send_infraction_list(ctx, embed, infraction_list)
  File "bot/exts/moderation/infraction/management.py", line 279, in send_infraction_list
    lines = tuple(
  File "...
#
[python-discord/bot] New branch created: fix\-tzinfo\-issue
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] New branch created: fix\-tz\-issue
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
regal archBOT
#
[python-discord/site] New branch created: mbaruh\-patch\-1
odd spireBOT
regal archBOT
#
[python-discord/site] branch deleted: mbaruh\-patch\-1
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
odd spireBOT
odd spireBOT
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
regal archBOT
#
[python-discord/modmail-plugins] New branch created: send\-warning\-message\-on\-appeal
#
[python-discord/modmail-plugins] branch deleted: send\-warning\-message\-on\-appeal
regal archBOT
#
[python-discord/sir-lancebot] branch deleted: tools/isort
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
odd spireBOT
regal archBOT
#

I've done some more experimenting with the cog, and it seems the only thing that takes any time is the async_init task, which makes sense. During that time, the only thing affected is the close command, which gracefully errors out (albeit without explaining anything to the user). Claiming and all that fun non-sense is queued, so it's just a small delay for the user. The only concern would be with the race conditions. I've poked around a bit, and the chances of things going wrong is fairly low...

regal archBOT
odd spireBOT
regal archBOT
#
jb3

Again, not out of the box. We provide a fully functional Python interpreter, the actual limitations are at a system level (e.g. CPU time, memory usage, disk usage). We don't limit the capabilities of Python by design as it's easy to workaround, system level limitations are much harder to circumvent.

It is worth noting that aiohttp and requests will not work in Snekbox, nor will anything that depends on them. Snekbox has no network configurations and executed code snippets do not ge...

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

Description

Automatic issue linking currently uses a set to remove duplicates, which makes the list of found issues and PRs unordered.

https://github.com/python-discord/sir-lancebot/blob/ec536f76da89cda38592f800e92b9c4de99a9d53/bot/exts/utilities/issues.py#L247-L248

I would like to use an alternative method to remove duplicates that retains ordering.

Reasoning

Keeping the list of found issues/PRs in the same order as the message that triggered the search isn't a hug...

regal archBOT
regal archBOT
#
[python-discord/bot] New branch created: consider\-parent\-channels\-when\-checking\-mod\-channels
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
#

857468c create a helper function to get the redis key o... - Numerlor
48b1a7b Prevent erroneous symbols from always raising s... - Numerlor
727ef75 Delete stale item counters when clearing doc cache - Numerlor
23a3e5e Raise for status to prevent parsing of invalid ... - Numerlor
3846da7 Direct users to the appeals server when banned - ChrisLovering

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

78b00dc Remove WatchChannel parent of TalentPool and mi... - ks129
dda3490 Use more accurate command names and docstring f... - ks129
f144bac Migrate nominations history command to non-watc... - ks129
807a27e Migrate Talent Pool Reviewer class to non-watch... - ks129
2d47640 Migrate unnominate command to non-watchchannel - ks129

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
mint goblet
ashen phoenix
#

Relatable

regal archBOT
#
[python-discord/bot] branch deleted: filters/autoban
oak estuaryBOT
odd spireBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
#

NOTE

This issue is here because the work has already been done for my own project [here][commit], but enough changes have been made to the point where I think it may be useful for pydis to reap the benefits as well.

Description

Initially, I took the mocks for my own project, and added a few mocks that I needed, but while working through them, I noticed some shortcomings. Those shortcomings are addressed in the file change I made.

A short list of changes are as follows:
...

regal archBOT
#

This would also apply to the COLOR_MAPPING variable and the color.py file name. These should all be made consistent.

A suggestion on the embed side: it could be cool to use whatever spelling the invoking message used. i.e.

    async def send_colour_response(ctx: commands.Context, rgb: list[int]) -> None:
        """Function to create and send embed from color information."""
        colour_spelling = ctx.message.content.split(' ')[0][constants.Client.prefix:].lower()  # t...
regal archBOT
#
[python-discord/modmail-plugins] New branch created: closemessage
regal archBOT
#
[python-discord/modmail-plugins] New branch created: man\-close
#
[python-discord/bot] New branch created: fix\-no\-guild\-error
#
[python-discord/bot] New branch created: mbaruh\-patch\-1
odd spireBOT
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
odd spireBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
regal archBOT
#
[python-discord/sir-lancebot] New branch created: bookmarking\-enhancements
#

Relevant Issues

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

Description

The bot now tracks ids of messages that the user has bookmarked in Redis, so that a user can't unintentionally bookmark the same message more than once.

This also adds the ability for users to delete messages in DMs with the bot via the use of the bookmark delete command.

On top of this I have done some minor refactoring and fix...

odd spireBOT
odd spireBOT
regal archBOT
#

Here's a few coin prototypes. With the two designs on the left I was playing around with a "euro" style coin. The two on the right are later designs. We came to the conclusions in #dev-branding that the ducky is probably the best bet for the coin face, and that ducky designs seems to be the favorite anyway. Let me know if you have any suggestions.
Artboard 37w-29

odd spireBOT
odd spireBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
#

Relevant Issues

Closes #627

Description

This implements the global leaderboard command, it is basically a leaderboard for all the games together, if you win the coinflip, you get some points, the points you get in the trivia quiz gets added here, etc.

This feature makes use of Redis Caches (two per game) to store the game leaderboards, one being the overall leaderboard (total) and the second being the per day leaderboard which gets cleared every day at midnight UTC through a ...

odd spireBOT
regal archBOT
#

For a while now, I've been noticing that my longer reminders are usually removed from the database, without being sent, leading to many missing reminders. I've been digging into it for a while now, but there is nothing noteworthy as far as I could tell.

There is nothing in logs, and there is nothing in the bot behavior that should block reminders. The most recent example I have was scheduled for 1 minute after another reminder. The other reminder was delivered, mine wasn't. I won't be link...

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

Connected!

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

I'm not sure how much use a command that just posts a random GIF would be. From a mod perspective, we don't want to encourage people to just post random off-topic content, especially noisy media like GIFs.

From a user's perspective, I'm not sure what the utility would be. If I want to use a GIF for something, I most likely have something specific in mind, and would use the tenor search to find it.

regal archBOT
#

Closes #1765

First off, this is my first pull request so please give me general pull request feedback if you have any :-)

Some decisions have been made on discord. A search of bot#1765 should find you all the conversations.

Some changes to make to test:

  • Create 3 new roles, with clear different colours so you can see colours on embeds!
  • Put these in your config.yml

There are 2 new commands: !patrons and !patreon. These send the list of patrons and some patreon info...

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
#
[python-discord/bot] branch deleted: sql\-fstring
#
[python-discord/bot] New branch created: sql\-fstring
odd spireBOT
regal archBOT
odd spireBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
#

@Senjan21 managed to find in the logs that there are in fact errors being logged (and we accidentally took down the entire community's infra ๐Ÿ˜…). user appears to be none in ensure_valid_reminder (my guess is because it's called during bot startup, which most likely means the cache is unpopulated. Can no longer confirm, as the logs have been deleted).

I have a new solution in mind, and will be PRing that instead.

regal archBOT
#

I've only tested it quickly so this is mainly a code review (although it seems to work nicely, I like the embeds!)

Firstly, thanks for the PR! The structure of the code seems good and it's been written well.

My main comments here are about repetition, there are couple of places where I think using loops would neaten the code up a bit, making it a bit more concise and extensible. That said, these aren't required changes, i've only mentioned them as something to think about if you want to.

#

As these are discord.Members they have a guild attribute, so you shouldn't need to fetch the guild, you can access it through after.guild (or before.guild). This saves an api call.

It might also make the later logic easier and neater if these are in a list

patreon_roles = [
    after.guild.get_role(constants.Roles.patreon_tier_1),
    after.guild.get_role(...),
    after.guild.get_role(...),
]
#

I do think it would be nice to reduce the repitition a bit here. If patreon_roles was a list as I suggested above you could use do something with a for loop. I came up with this (not tested) which is arguably slightly esoteric but also I think it's beautiful :P .

for tier, role in reversed(enumerate(patreon_roles, 1)): # Reversed to check highest tier first
    if role in after.roles and role not in before.roles:
        break
else:
    return
    
# `tier` now contain...
#

An issue with this is that if the bot restarts on that day (and the bot does restart quite often) the message will send twice, which isn't ideal. I'd be interested to hear other people's thoughts on how we could solve this in this case.

Using redis cache to keep track of the time of the last send would be one way. I think the branding manager does something like that: https://github.com/python-discord/bot/blob/1ca6d5765d15c9f35e94a7069acd1acc85503e14/bot/exts/backend/branding/_cog.py

D...

odd spireBOT
regal archBOT
#

I've only tested it quickly so this is mainly a code review (although it seems to work nicely, I like the embeds!)

Firstly, thanks for the PR! The structure of the code seems good and it's been written well.

My main comments here are about repetition, there are couple of places where I think using loops would neaten the code up a bit, making it a bit more concise and extensible. That said, these aren't required changes, i've only mentioned them as something to think about if y...

odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
#
  1. Could we also add a command to get a set of distinct colours, like a set of visually distinct colours by maximizing the perceived colour difference between pairs of colours.
  2. Could we add a feature to simulate a colour under a certain colourblindness profile, like how it would look to a person with protanopia, deuteranopia, or tritanopia.
  3. Utility commands like lighten, darken, compliment, etc.
regal archBOT
#

So what I intended for this code to do was to iterate through all the "blanks" in random_template[value] (the story template chosen from the JSON file) and replace the "blanks" with the words entered by the user so that once the user has finished entering all the words, the bot prints out the entire story with the blanks filled in. Maybe there is a better implementation for this than what I have currently? @Bluenix2

regal archBOT
#

I'm not sure how much use a command that just posts a random GIF would be. From a mod perspective, we don't want to encourage people to just post random off-topic content, especially noisy media like GIFs.

From a user's perspective, I'm not sure what the utility would be. If I want to use a GIF for something, I most likely have something specific in mind, and would use the tenor search to find it.

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

This is why I use TypeError to handle when there is no match found:

sir-lancebot    | Traceback (most recent call last):
sir-lancebot    |   File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 167, in wrapped
sir-lancebot    |     ret = await coro(*args, **kwargs)
sir-lancebot    |   File "/bot/bot/exts/utilities/color.py", line 123, in name
sir-lancebot    |     _, hex_colour = self.match_colour_name(user_colour)
sir-lancebot    |   File "/bot/bot/ex...
regal archBOT
#
  1. Could we also add a command to get a set of distinct colours, like a set of visually distinct colours by maximizing the perceived colour difference between pairs of colours.
  2. Could we add a feature to simulate a colour under a certain colourblindness profile, like how it would look to a person with protanopia, deuteranopia, or tritanopia.
  3. Utility commands like lighten, darken, compliment, etc.

Is this something that should be included with the original command? To be ...

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
#

No, I wasn't talking about that. I am talking about the Colour in the embed. Currently, if you run .color or .colour, you get Colour. So, I wanted to ctx.command.name to decide whether to use color or colour.

And I know it doesn't return them, I said "This same thought can be used", so in a similar way we can implement this. Though I am not entirely correct here as above you use it to get the type. But yeah, this could be implemented to keep British English and American Engl...

#

Is this something that should be included with the original command? To be honest, I'm not sure how I would go about making those happen and what the command usage would look like.

Yeah, I would like to have it in the colour command, though this is completely optional and I would like to get inputs from other core devs part of this discussion. I feel like these commands are sometimes very helpful. I have implemented these on the quackstack repo (similar functionality), if approved I ca...

odd spireBOT
regal archBOT
odd spireBOT
odd spireBOT
regal archBOT
#

Thinking about this more, while this should work, this code might go the other way. If the bot is not running at 17:00 UTC on the 1st of the month, it will just miss it rather than trying again when the bot starts. Maybe I need to have a redis cache stating that it has been done, and then when the bot starts it can check this cache?

regal archBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
#
[python-discord/bot] branch deleted: pin\-consistency
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
#

I'm getting some weirdness in testing. It seems like when I pass the extra it skips the subcommands. This is what I have right now that works for calling .color rgb(100, 100, 100) but fails for .color rgb 100 100 100 (yes I know a bare except is bad):

    @commands.group(aliases=("color",))
    async def colour(self, ctx: commands.Context, *, extra:str) -> None:
        """User initiated command to create an embed that displays colour information."""
        try:
           ...
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#

Blocked by python-discord/site#618.
See #1916 for more info. This PR shouldn't close that issue.

I updated the reminders cog to try and get around the issue with missing users in the cache during startup. To try and resolve that issue, I switched to fetching as a fallback if the user wasn't found. To avoid accidentally hammering the discord API with fetch requests at startup, I removed the validity checks from the init function, instead opting to only run the check during the send functio...

odd spireBOT
regal archBOT
regal archBOT
regal archBOT
regal archBOT
#

Relevant Issues

<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
[Approved by core dev to PR without issue](#dev-contrib message)

Description

Check whether a reaction is for a bot message when adding candies upon reactions. Previously you could use bot's reaction buttons which would trigger on_reaction_add and have a high chance of getting candies (or skulls). It can e...

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

This gives me the same error, it doesn't recognize the subcommand is called.

    @commands.group(aliases=("color",))
    async def colour(self, ctx: commands.Context, *, extra: str) -> None:
        """User initiated command to create an embed that displays colour information."""
        if ctx.invoked_subcommand:
            return
        else:
            extra_color = ImageColor.getrgb(extra)
            if extra_color:
                await self.send_colour_response(ctx,...
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
#

Description

Right now, bookmarking messages as someone who is not the command invoker requires adding a reaction. I believe that the system can be made much more better using buttons as it greatly improves the UI and makes it a bit more simpler.

Reasoning

While using interactions, we now have an option to make any error only visible to the interaction author by making the error message ephemeral. This would mean that the error message will not be publicly visible and a confirmati...

regal archBOT
regal archBOT
#

Perhaps the error percentage of closeness could be listed as well?

I'm not even sure that rapidfuzz is needed here, or is the best tool for the job.

There's difflib, which is part of the stdlib.

In addition, there is a great deal of significance with the naming of these, and how they're matched.

As a quick review, because of how rgb and hex work, fff is very different from 000...
but run rapidfuzz.process.extractOne('f07070',['fefefe','010101']) and the result is 010101.

Th...

regal archBOT
#
[python-discord/bot] branch deleted: cleanrework
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
#

One way would be to have the colours as r b g integer tuples and find the one with the smallest euclidean distance using math.dist

colours = [(30, 30, 100), (25, 40, 25), (25, 25, 25)]
target_colour = (30, 30, 40)
closest = min(colours, key=lambda colour: math.dist(colour, target_colour))
# closest is (30, 30, 30)

Comparing colours is actually quite an interesting topic, and whilst this solution isn't perfect due to the way RGB works, I think it would be good enough fo...

regal archBOT
regal archBOT
#

In the current form this does not function the way I think it should. Two things that I see are:

  1. Default cowsay mode cannot be called - suggestion to fix that worked during testing is to start the SUPPORTED_COWS list with "default".
  2. Message content cannot be passed without defining a cowtype. If the user tries to do .cowsay the first word of the message is interpreted as the cowtype, and raises the BadArgument error. I think this can be handled by changing the function definition...
regal archBOT
odd spireBOT
odd spireBOT
oak estuaryBOT
regal archBOT
#

Hello! It's me!

I had a quick chat with VCO on the DMD last night, and this issue was suggested!


Basically, we're using Metricity with Metabase at QuiltMC, but it doesn't have any support for threads. Since we use thread extensively, it'd be outstanding if Metricity was able to track threads in the following capacity:

  • Whether a thread is archived or not
  • Whether a thread is locked or not
  • When the thread was created
  • The name of the thread
  • What channel a thread belo...
regal archBOT
regal archBOT
#

I was thinking of having another table for threads, something like this ```
class Thread(db.Model):
"""Database model representing a Thread channel."""

__tablename__ = "threads"

id = db.Column(
    db.String,
    primary_key=True
)
channel_id = db.Column(
    db.String,
    db.ForeignKey("channel.id", ondelete="CASCADE"),
    nullable=False
)
name = db.Column(db.String, nullable=False)
archived = db.Column(db.Boolean, nulla...
#

Yeah, it should be fine to just create the thread in the db at the time the event was received by the client notifying it about the thread's creation. It's not going to be 100% accurate to its creation time like a snowflake would be, but I'm not sure a matter of a couple of seconds is that important at the scale of data something like Metricity uses.

regal archBOT
#

Yeah, it does seem like there's some info lost here, I can't find a specific creation date either. For threads that already exist, it might be OK to assume that the ID is close enough, and then use creation date based on the event where possible.

It'd also be good to have the thread type in the table - so news, public or private

#
jb3

My original implementation was going to be much less advanced, it was just going to be a new flag on messages which said if a message was in the parent channel or a thread of the parent.

I'm not opposed to storing more though, I think Chris' model looks good.

How are you planning to store thread messages @ChrisLovering, we could tie them to the parent channel and add a nullable FK to the thread and enum for thread message or channel message maybe?

#

Can threads be news type? I was just gonna have a private boolean flag

Yep, all threads created in an announcement channel are news type. There's no real difference other than that the user list contains all the users that could see the announcement channel, so I'm not sure why there's a difference, honestly.

I was going to have a nullable thread_id column on messages. So the channel_id would always be the parent channel in the case of thread messages.

This is my preferred ap...

#
jb3

Do we plan on having Metricity try synchronise thread statuses on startup? I'm not sure how we'd do that in a nice way without iterating all channels, but if we don't then the data stored are possibly out of sync with true Discord state (something we avoid very well for channels)

#

Yep, all threads created in an announcement channel are news type. There's no real difference other than that the user list contains all the users that could see the announcement channel, so I'm not sure why there's a difference, honestly.
I'll just have a type column then that stores the enum returned by discord.

Do we plan on having Metricity try synchronise thread statuses on startup?
Yea, we already iter channels on startup, I was planning on itering threads too

#

Well, as I said:

knowing whether they're locked or not probably isn't too important

If you can avoid hitting the Discord API, you should - and there's no need to do so if you have a list of active threads, and a database state listing active and archived threads.

  • Get list of active threads from Discord
  • Get list of active threads from DB
  • For active threads in DB not in list from Discord, mark archived
  • Mark all threads from discord as not archived

Really doesn't have to...

regal archBOT
regal archBOT
#

As the title suggests, this issue proposes adding support for getting the last x infractions, most likely via !infraction last .

This is mostly useful when you're dealing with a situation involving multiple issues and need to quickly get information on your infractions for each of them (e.g. to add context or edit duration after investigating).

Implementation wise, would most likely be best to revert the changes to !infraction made in #1804 and instead make last a subcommand, with...

odd spireBOT
regal archBOT
#

This issue proposes allowing users to specify the end time of a reminder as the duration, instead of a relative time (e.g. !remind "01-11-2021 08:00" example instead of !remind 16h38M example).

This would mean the user doesn't have to do the maths of "how far away is the time I want", but would also mean we'd have to come up with some sort of parsing for the time, potentially with support for !remind 08:00 example (send reminder whenever the next occurrence of 8am is) and/or `!remind...

regal archBOT
#
[python-discord/metricity] New branch created: thread\-support
#

Closes #9

This adds support for discord threads. Threads now have their own table, threads. Each message sent in a thread will have a reference to the thread.

Due to the need to upgrade to d.py 2.0 to support threads, I have also done the following

  1. Store the hashes of both guild avatars and user avatars, when available
  2. Added a custom wrapper so that all datetimes being sent to and received from the DB are now tz-aware.
regal archBOT
oak estuaryBOT
odd spireBOT
regal archBOT
regal archBOT
#
[python-discord/bot] New branch created: infractions\-by\-command
odd spireBOT
regal archBOT
#

I have a question.
I find the project mega interesting and have not yet worked with others except for the little bit (I'm still learning).
Now some things have not worked out for me as far as Hacktoberfest is concerned and I'm not sure if I can still make it. You are not by any chance participating at Hacktoberfest this year or could add it for me?

Regardless of this, I will of course continue to look around here and see how I can support and learn.

regal archBOT
#
[python-discord/bot] branch deleted: consider\-parent\-channels\-when\-checking\-mod\-channels
odd spireBOT
oak estuaryBOT
odd spireBOT
odd spireBOT
odd spireBOT
odd spireBOT
regal archBOT
#

I have a question. I find the project mega interesting and have not yet worked with others except for the little bit (I'm still learning). Now some things have not worked out for me as far as Hacktoberfest is concerned and I'm not sure if I can still make it. You are not by any chance participating at Hacktoberfest this year or could add it for me?

Regardless of this, I will of course continue to look around here and see how I can support and learn.

added ๐Ÿ‘

regal archBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
#

@doublevcodes has said [on discord](#dev-contrib message) they let me take this one. Can I get assigned please? I've almost finished my implementation with a some improvements to the original and I'll open a PR after my exams are over.

I've added is_category to the context so that the button would only show up on articles (weird to say "edit on github" on categories). Not sure if there are already places in the existing con...

regal archBOT
#

Description

There might be a bug/error when reacting to .wiki commands trashcan, I was able to remove the message by clicking trashcan even when I was not the one running the command.

Steps to Reproduce

If this is not how it should act there might be a error in check. Maybe adding a check to function to .wiki command (if this is not how it should act). It would be nice to be limited, so it would not be clicked to annoy others or be pressed mistakenly to remove the message....

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

Yea I think it's a trade off between better multi-core support and better load balancing.

Do you know off the top of your head what the load difference would be? The reason I ask it afaik gunicorn has a management process on top of each of the worker processes, which wouldn't be needed with individual containers. So we do drop one of the resource sinks by doing this.

regal archBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] New branch created: kill\-sir\-threadevere
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
#
[python-discord/bot] branch deleted: og\_blurple\-migration
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#

This might seem a bit of a nitpick, but I think it's not necessary to create variables for the ID and the name+discrim.

You can have this condition at the beginning:

if actor in ("m", "me"):
    actor = ctx.author

And then have 'actor__id': str(actor.id), instead of 'actor__id': str(actor_id),, as it doesn't seem like you save anything with that variable.

Then below you can have

title=f"Infractions by `{actor}` (`{actor.id}`)",

Since as you've shown at ...

regal archBOT
#
[python-discord/modmail-plugins] branch deleted: closemessage
odd spireBOT
regal archBOT
#

Relevant Issues

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

Description

I added restrict_to_user=ctx.author to wikipedia.py. Limits user reactions to prevent non-author from removing message by adding user restriction to paginator.

Did you:

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

Description

Changes a users current profile picture into something more seasonal, similar to commands like .spookify

Reasoning

It would be fun and spread the holiday cheer

Proposed Implementation

Adding Christmas hats, snowflakes, etc etc

Would you like to implement this yourself?

  • [ ] I'd like to implement this feature myself
  • [x] Anyone can implement this feature

I would do it myself, but I'm rather busy and don't know how to use pillow, as I've never experimented with i...

odd spireBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
#

Description & Reasoning

the .wtf command is quite nice for finding the explanation for a specific python quirk from the WTF Python?! repo. I would like an easy way to link to the entire repo directly. It would be nice to be able to provide that link to people so they can read through the repo on their own time.

Proposed Implementation

If .wtf is called with no query, then an embed and/or nicely formatted link of the repo is provided instead. Currently, calling just .wtf pr...

regal archBOT
odd spireBOT
regal archBOT
regal archBOT
#

Using a mocked test database in the tests is a very huge stepback from the existing Django API and renders all of the added tests far less effective. Please re-add the test database and integrate it with our CI properly such that we can validate that the endpoints works with the database as wanted.

Alright, I was gonna do this initially however @HassanAbouelela [mentioned](#dev-contrib message) that it would make the possib...

#

@jchristgit My reasoning for not adding the test database is that we don't really need it for our tests. I've looked over a few of the current site tests, and for the api ones, it's mostly just "Put data in DB, pull data from DB, call functions with that data." If you notice there, that whole putting into DB, and taking out is completely redundant. In both cases you're creating a predetermined instance of a model, and injecting it into a route. We don't need a DB to do that.

On the other han...

regal archBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
#

@jchristgit My reasoning for not adding the test database is that we don't really need it for our tests. I've looked over a few of the current site tests, and for the api ones, it's mostly just "Put data in DB, pull data from DB, call functions with that data." If you notice there, that whole putting into DB, and taking out is completely redundant. In both cases you're creating a predetermined instance of a model, and injecting it into a route. We don't need a DB to do that.

I can unders...

regal archBOT
#

So I think that would make the tag a bit too lengthy, which is why I'm opting not to. In my ideal world I'd like to show how a the SQL statement would differ between the params and the f-strings, but at that point it's more appropriate for an article.

I'm hoping it's clear enough to get the point across with someone (in channel) explaining or to have enough of a starting point for them to investigate what's happening in more detail with better search terms.

odd spireBOT
regal archBOT
#

So! I will likely not comment on specific pieces of code because the changes I'm going to request will span a lot and likely require a fundamental change to some of the logic.

Also thank you in advance for working on this! Please don't be overwhelmed by my requested changes.

New Features

After playing with this for a bit and thinking on the event overall, I am going to ask for some changes that deviate from the original issue.

  • Adding a timer to questions. Each question will be on ...
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
#

-Added a default value to query, and if the value is None, send the
link to the repository in an embed.
-Modified the if / else statements to if / elif / else with the new
if statement to check if the value of query is None.

Relevant Issues

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

Description

-Added a default value to query, and if the value is None, send the
link to the repository in an embed.
-Modified...

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

Description

The .rp command currently gives 5 results by default but what if you wanted to get only 1-4? There should be a option to get amount you want by still keeping the max 5 as default. If no amount provided default value, 5, will be returned.

Reasoning

Getting only specific amount of results if you don't want to see more, and could possibly be good to limit results if wanted.

Proposed Implementation

Currently I don't have any in code implementations, but some so...

regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/.github] branch deleted: remove\-dorsan
regal archBOT
#

Description

One feature we'd like to have on the mod team right now is the ability to unfurl a shortened URL to apply further filters to it. There are multiple services we'd like to do this for, such as bit.ly.

We had discussed a similar idea in the past, but ultimately decided not to continue with it due to concerns with us making requests to untrusted destinations, or following a redirect too far causing an error. I believe I have a solution that'll help the mod team, while not introd...

night lilyBOT
#
Sir Lancebot

Connected!

regal archBOT
odd spireBOT
regal archBOT
#

Relevant Issues

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

Description

Now the .rp command has option to get specific amount of articles in between 1-5 (inclusive). I added new parameter to .rp which is amount. If no argument given when command is ran, the default value 5 will be used. If user tries to give negative, 0 or bigger than 5 , the bot will send a message saying "`amount must be between 1 and 5 (inclus...

odd spireBOT
odd spireBOT
odd spireBOT
odd spireBOT
regal archBOT
#

I'm not too fond of having annotated doc strings like this for commands, since this is the help that will be given to the user I think it should read as "proper" English. Maybe something more like this

        """
        Send some articles from RealPython that match the search terms.

        By default the top 5 matches are sent, this can be overwritten to
        a number between 1 and 5 by specifying an amount before the search query.
        """
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
#
[python-discord/modmail-plugins] New branch created: closemessage
odd spireBOT
odd spireBOT
regal archBOT
#

Lots of people wonder what at typehint is, so this tag addresses that.

Draftish:
A typehint indicates to users of a function what type it expects to be passed, as well as indicating what type the return value of the function should be.

def add(a: int, b: int) -> int:
    return a + b

Note that this has no actual effect on what is passed, for example, this is valid code

add("hey", ["yo", 2])
regal archBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
odd spireBOT
regal archBOT