#dev-log

1 messages ยท Page 7 of 1

odd spireBOT
regal archBOT
regal archBOT
regal archBOT
regal archBOT
#

This isn't possible as Discord only allows users to edit their own messages, not the messages of others.

We are working on a new filters system, which will include the ability to DM users with the content of the message that was deleted.

So that actual problem of not being able to access the message you pasted will be solved by https://github.com/python-discord/bot/issues/1530

regal archBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
#

Hi, this seems like an issue with Docker on your system that is not specific to snekbox. Thus, this is not an appropriate place to get support for that issue. You're welcome to join Python Discord and get support there, or another community like the Docker forums or StackOverflow.

regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
thin oysterBOT
#
Sir Robin

Connected!

regal archBOT
#
[python-discord/bot-core] branch deleted: sync\-tree\-on\-startup
#
[python-discord/sir-robin] branch deleted: aoc\-join\-slash
thin oysterBOT
#
Sir Robin

Connected!

odd spireBOT
thin oysterBOT
#
Sir Robin

Connected!

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

Connected!

odd spireBOT
odd spireBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
odd spireBOT
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: allow\-passing\-channel\-objets\-when\-checking\-ignore
odd spireBOT
oak estuaryBOT
odd spireBOT
regal archBOT
odd spireBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
regal archBOT
#

Since this message is ephemeral, I don't think there's a need for the button that says "Click this to get your very own bookmark" or whatever it was. The whole point of the button was that multiple people wouldn't be running the .bookmark command in succession to the same message and flooding the channel - but with ephemeral messages, that's not an issue. So I think this button would just lead to more confusion and is unnecessary.

regal archBOT
#
[python-discord/snekbox] New branch created: dep\-add\-einspect
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#

This proposes to add to our deployment venv.

I think it would be quite useful in discussions in #internals-and-peps as well as showing implementation details of python object structure to beginners who are curious.

from einspect import view

a = [*range(18)]
print(view(a).allocated)  # 18

b = list(i for i in range(18))
print(view(b).allocated)  # 24

For example many have asked how python ints are actually implemented with base-30 arrays:

from einspect ...
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] New branch created: trim\-help\-command\-error\-title
odd spireBOT
regal archBOT
#

See PR description :P

I also didn't use textwrap.shorten as that only breaks on words, so if the input had no spaces you would just get something like Query "..." not found.

Basically textwrap always ended up just deleting the input, since there aren't any spaces because the command only shows the first invalid bit (e.g. !abcd hwdhe just shows query "abcd" not found

>>> textwrap.shorten("helloworld", width=5)
'[...]'
#
[python-discord/site] New branch created: enable\-dependabot\-github\-actions\-updates
odd spireBOT
odd spireBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
#

What would happen when the issue invokes the command in a non-whitelisted channel? I suppose it'd have to still send a new message that pings in bot-commands?

Also would the reply be ephemeral? We presumably don't want that, since a lot of the time the eval command is used to showcase something, meaning other people need to see the outcome.

And I believe @bj0key, the user who raised this, said they'd like to implement this fwiw @Robin5605/

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

This sounds like a nice idea, some thoughts:

Some events (e.g. Hanukkah) happen at different dates on different years. Is the idea that we pick a rough range that is fixed for these e.g. the whole of december? (I think that would probably be the best option)

flake8 is excluded in the snowflake trigger regex (but this can be changed)

I'm sure this is what you meant anyway, but to confirm, we should match words exactly using \b word boundary markers in the regex (how it already wor...

regal archBOT
odd spireBOT
odd spireBOT
regal archBOT
#
[python-discord/site] New branch created: ignore\-to\-extend\-ignore
odd spireBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#
[site] Branch dependabot/github\_actions/HassanAbouelela/actions\-setup\-python\_v1\.4\.0 was force-pushed to `3fb0d96`
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/site] New branch created: poetry\-groups
odd spireBOT
regal archBOT
#
[python-discord/site] branch deleted: ignore\-to\-extend\-ignore
odd spireBOT
regal archBOT
#

Relevant Issues

Closes #1165

Description

This change adds the ability for Sir Lancebot to react to regex-based seasonal comment triggers outside of Halloween. Total reaction triggers increase from 8 to 19, with 13 of these in two months: Halloween (where the original 8 are kept) and Christmas.

A graphical list of reaction emojis, along with a demo screenshot during Christmas, is available in the linked issue. (Although the emoji rendering in Github differs from Discord)

An e...

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

Connected!

odd spireBOT
regal archBOT
regal archBOT
#
[python-discord/site] New branch created: improve\-actions\-workflows
odd spireBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
regal archBOT
#
[python-discord/site] branch deleted: improve\-actions\-workflows
odd spireBOT
regal archBOT
#

Looks good. We should migrate to reusable flows soon though, see https://github.com/python-discord/black-knight/tree/main/.github/workflows for reference

Ah, yeah, that does seems nice.

Also, I wonder if it would be worth having a repo of workflows we can reuse across the org. The build/deploy/status_embed workflows seem very similar wherever they're used. Not sure if the differences are enough that in practice it would be difficult though.

regal archBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
#

3686f60 add the roles channel to the config - shtlrs
5795140 add the AllSelfAssignableRolesView and its corr... - shtlrs
6ab9f9c add the logic for attaching the persistent view - shtlrs
b25ad80 add assignable_roles as a property to the Claim... - shtlrs
1d60403 add implementation of the button's callback tha... - shtlrs

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

The block_duplicate_invocations decorator prevents commands from running in a single channel if they were used previously recently with the same arguments. This can be applied to commands like resources or docs that are often used with responses to prevent being unnecessarily invoked multiple times.

It should also be able to replace the similar functionalit...

odd spireBOT
odd spireBOT
regal archBOT
regal archBOT
#
[python-discord/branding] New branch created: zzz\-icon
#
[python-discord/branding] branch deleted: lemoji/holding\-back\-tears
odd spireBOT
regal archBOT
odd spireBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] New branch created: Update\-help\-post\-messages
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
odd spireBOT
odd spireBOT
odd spireBOT
regal archBOT
#
[python-discord/site] New branch created: official\-tutorial\-resource
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
#
[python-discord/site] branch deleted: official\-tutorial\-resource
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
regal archBOT
#
[python-discord/snekbox] New branch created: dep\-version\-update
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] New branch created: shenanigansd\-patch\-1
odd spireBOT
regal archBOT
#
[python-discord/snekbox] branch deleted: dep\-version\-update
#
[python-discord/bot] branch deleted: Update\-help\-post\-messages
oak estuaryBOT
odd spireBOT
regal archBOT
#
[python-discord/bot] branch deleted: shenanigansd\-patch\-1
odd spireBOT
oak estuaryBOT
odd spireBOT
odd spireBOT
regal archBOT
odd spireBOT
odd spireBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
#

I'm not sure how I like "it is required" here, as well as the focus on lists. My proposal here would something along the lines of:

To avoid these errors and unexpected results, you should either use an in-place operation (sorted(...)) and assign it to a variable or use an out-of-place operation (list.sort()) without assignment.

The wording can obviously vary, but I'd prefer to see something general like that.

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

I think variable names here should be more in-line with what the person was trying to do, so I would call them unsorted_list and sorted_list for the first example and list_to_sort in the second one.

I also think the way you show the unexpected behavior (with indexing) is overcomplicated, something like

print(a_new_list)  # Outputs None. Where did the list go?

and

print(outofplace_list)  # The list still isn't sorted. Why?

would make it easier to understand...

odd spireBOT
regal archBOT
regal archBOT
#

I have noticed that sir lancebot only allows us to add bookmarks, but not deleting them.

I figured that this could be useful for whatever reasons people would have w be that the DM channel is too cluttered, or they have bookmarked some message explaining Middlewares for example but then have read a better one which they'd like to replace with the old one.

This should be a pretty easy change considering we'd use add another button to the view we already send in the DMs.

Would you like...

regal archBOT
regal archBOT
regal archBOT
#

This can already be done using the .bm delete command in DMs, although I wouldn't be against adding a button (possibly replacing the command).

I guess it'll be more intuitive through a button, no need to search or even know about the command (Just like I didn't) because it'll be available '' out of box'' now.

And, if for some reason, the interaction fails, then the command will serve as a fallback.

regal archBOT
#

This pull request implements the new filtering system as described in #1530.

For more information about the database and API changes made to support this, check out the site PR.

Warning This PR must be merged at the same time as the site PR.

closes #1530.

Overview

The main idea is that there is a list of filters each deciding whether they apply to the given content.
For example, there can be a filter that decides it will trigger when the content contains the string "lem...

#

This pull request applies the necessary changes to the database and API to support the new filtering system on the bot.

For more information on how the information in these tables will be used, check out the bot PR.

Warning This PR must be merged at the same time as the bot PR.

closes #479.

Scheme

image

  • There is a unique constraint on combinations of name, list_...
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
night lilyBOT
#
Sir Lancebot

Connected!

regal archBOT
odd spireBOT
regal archBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
night lilyBOT
#
Sir Lancebot

Connected!

regal archBOT
odd spireBOT
night lilyBOT
#
Sir Lancebot

Connected!

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

Yeah a context command is better, but that's 2 more clicks for this to be achievable.
I think they can both co-live together, as a button jumps straight at you when you see it and I personally think it's a better option for the new bookmarks.

And for the old ones, we can still use either the text command or the context one, WDYT ?

regal archBOT
#

Sentry Issue: BOT-3CR

HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In content: Must be 2000 or fewer in length.
  File "discord/ext/tasks/__init__.py", line 239, in _loop
    await self.coro(*args, **kwargs)
  File "bot/exts/filters/filter_lists.py", line 308, in weekly_autoban_report_task
    await self.send_weekly_autoban_report()
  File "bot/exts/filters/filter_lis...
regal archBOT
odd spireBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
#

The bot guide now mentions that site is required if the user isn't using docker https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/bot/#with-more-things-running-locally

I can't identify anything else that needs to be done here so i'll close this. In general we do recommend using docker as it's much simpler though, so our documentation of how to set up bot on host isn't as good.

regal archBOT
#
[python-discord/bot] New branch created: use\-paste\-service\-for\-long\-autoban\-filters
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT
odd spireBOT
regal archBOT
odd spireBOT
odd spireBOT
regal archBOT
odd spireBOT
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#

Buttons are great for quick access, but there is the trade off with it taking up the a large amount of screen height, which is very prevalent on mobile devices.

SO while I'd agree having buttons for common actions, I just don't see deleting a bookmark to be common enough of an action to warrant a dedicated button with that trade off.

To help with discoverability, I'd also suggest ripping out the current bookmark delete command's functionality, and replacing it with a guide on how to u...

regal archBOT
#

Buttons are great for quick access, but there is the trade off with it taking up the a large amount of screen height, which is very prevalent on mobile devices.

SO while I'd agree having buttons for common actions, I just don't see deleting a bookmark to be common enough of an action to warrant a dedicated button with that trade off.

Do we have statistics on the usage of this command ? To be able to determine how "common" it is ?
I understand your point regarding the previous boo...

regal archBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
odd spireBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
#
[python-discord/sir-robin] New branch created: janine9vn\-patch\-1
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/sir-robin] branch deleted: janine9vn\-patch\-1
thin oysterBOT
#
Sir Robin

Connected!

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

Relevant Issues

None. I asked in python-general whether I should make this an issue first, but godlygeek and zig suggested its size (+3 characters) makes that unnecessary.

Description

I accidentally told Sir Lancebot that Earth Day was in February, meaning that it is currently (during February) reacting on earth. This PR moves it to April, where Earth Day resides on the 22nd.

Did you:

odd spireBOT
odd spireBOT
odd spireBOT
night lilyBOT
#
Sir Lancebot

Connected!

odd spireBOT
regal archBOT
regal archBOT
#
def get_field_value(data: dict, field_name: str) -> Any:
    """Get the value directly from the key, or from the filter list if it's missing or is None."""
    if data.get(field_name) is None:
        return data[field_name]
    return getattr(data["filter_list"], field_name)

This should be checked to be None, to avoid a value being falsy or even False. Take the example of a filter with the value enabled=False. in this case, the filter_list's enabled field...

regal archBOT
#
[python-discord/snekbox] New branch created: deployment\-update
#
[python-discord/snekbox] branch deleted: deployment\-update
regal archBOT
#

Description

Rather than using the usernames, the command should first try nicknames, then fall back to usernames if necessary. Alternatively, according to Nicky, "Love is deep. Love is about the true you". The .love command will use the id of the user rather than the nickname.

Reasoning

This would allow users to change their nicknames in order to get a score of 100% compatibility.

Proposed Implementation

Change https://github.com/python-discord/sir-lancebot/blob/main/bot/e...

regal archBOT
regal archBOT
regal archBOT
#

While I agree most of our commands could work as slash commands, I do not believe one mega-issue is the best approach for migrating.

Instead I'd suggest raiding raising an issue on a per-command basis, describing the benefit of migrating it to a slash command, and a proposed implementation. Each issue can then be separately approved by a core dev when appropriate.

#

I believe this is a duplicate of #2362

I suggested splitting out the issue in this way, see my recent comment in the issue for context.

and a subcommand /tag help or /tags listing all tags. That list could also be ephemeral, so the user can see all the tags.

We could make the tag name argument optional, so if not given it lists all the tags in a paginated embed, like it does currently.

Also, if possible, make the main command /tag, and the param would be autocomplete.

I a...

regal archBOT
#

Currently, the only Python implementation supported is the default CPython. Additional support should be added for executing Python code in other Python implementations like PyPy, RustPython, IronPython, etc. To support this, these implementations would simply have to be installed in the NSJail environment and alternate functions would have to be provided in the NsJail class for executing with alternate implementations.

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

Description

A user asked in PyGen if it would be possible to enable the .latex command in the help threads. After discussing it with Stelercus, we were wondering if it would be possible to either enable the .latex command everywhere except PyGen, or at least in the help threads.

Reasoning

It can be helpful to nicely typeset some maths when asking and answering questions.

Proposed Implementation

The .latex command here https://github.com/python-discord/sir-lancebot/blob/m...

odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
#
[python-discord/infra] branch deleted: Add\-sudo\-lecture
#
[python-discord/infra] branch deleted: unify\-inventory
regal archBOT
#
[python-discord/king-arthur] branch deleted: rule\-refresh\-command
odd spireBOT
thin oysterBOT
#
Sir Robin

Connected!

night lilyBOT
#
Sir Lancebot

Connected!

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

Connected!

odd spireBOT
regal archBOT
odd spireBOT
night lilyBOT
#
Sir Lancebot

Connected!

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

Connected!

odd spireBOT
regal archBOT
odd spireBOT
thin oysterBOT
#
Sir Robin

Connected!

night lilyBOT
#
Sir Lancebot

Connected!

thin oysterBOT
#
Sir Robin

Connected!

oak estuaryBOT
night lilyBOT
#
Sir Lancebot

Connected!

thin oysterBOT
#
Sir Robin

Connected!

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

Connected!

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

2870959 Use latest bot-core version and bump all deps - ChrisLovering
3c24f33 Bump to Python 3.10 and mark version as breaking - ChrisLovering
e3cc00e Update botcore module name throughout repo - ChrisLovering
39ece5a BotBase.load_extensions no longer needs to be r... - ChrisLovering
29104f2 Merge pull request #27 from python-discord/stab... - ChrisLovering

#
[python-discord/metricity] branch deleted: stable\-d\.py\-and\-python\-3\.10
#
[python-discord/sir-robin] branch deleted: bump\-dpy
thin oysterBOT
#
Sir Robin

Connected!

regal archBOT
regal archBOT
#
[python-discord/infra] New branch created: GDWR/local\-testing
regal archBOT
regal archBOT
regal archBOT
#
[python-discord/site] New branch created: ichard26\-patch\-1
odd spireBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
odd spireBOT
odd spireBOT
regal archBOT
regal archBOT
odd spireBOT
odd spireBOT
odd spireBOT
odd spireBOT
regal archBOT
odd spireBOT
odd spireBOT
regal archBOT
regal archBOT
regal archBOT
regal archBOT
#

import openai
import discord
from discord.ext import commands

Initialize OpenAI API key

openai.api_key = "YOUR_OPENAI_API_KEY"

Initialize Discord client

client = commands.Bot(command_prefix='!')

Define a command for the bot to generate an image

@client.command()
async def generate_image(ctx, *, prompt: str):
# Use OpenAI's GPT-3 API to generate an image based on the prompt
response = openai.Image.create(
prompt=prompt,
n=1,
size="1024x1024"
)

...
#

The config-default.yml might be confusing at first and would more than likely turn away new contributers(it almost did it for me). While the config is a essentialy part of the discord bot, I think it can be easily automated for people running it on there own servers/local dev.

I am thinking first to implement a auto-config from the server temeplate. Then Auto Creating channels in the proper categories as well as adding emotes and roles If needed.

regal archBOT
regal archBOT
regal archBOT
#

I see a lot of people join the server and go to #python-general and not #how-to-get-help and instead of just asking the question they ask people if they are familiar with xyz module or can anyone help me?

I propose we add a auto-reply to redirect the person to either ask the question directly or to read the #how-to-get-help. (ghost ping them inside #how-to-get-help) then delete there original message on general and the bot message.

regal archBOT
#
[python-discord/bot] New branch created: reusable\-status\-embed\-workflow
#

The purpose of this PR is to make the status_embed workflow reusable.

Problem
We currently have the same status_embed workflow file scattered & duplicated across our bot, site, sir-robin, pixels, king-arthur and sir-lancebot repositories.
A solution is to make the workflow reusable, and port it over as part of the organization's workflows, from where it can be accessed & invoked by all of our repos.

Note

  • This is currently just a test, and the workflow file w...
odd spireBOT
regal archBOT
#

I don't know we should necessarily do this. A lot of our actions have a very linear flow of steps that depend on each other:
Install dependencies -> setup requirements and environment -> do something

In theory it doesn't matter if one step fails and causes the next to fail instead of be skipped, but it doesn't seem appropriate for some of the more critical actions such as deployments and uploading images.

I believe you can force a certain step to always run without forcing the entire workfl...

regal archBOT
regal archBOT
odd spireBOT
regal archBOT
odd spireBOT