#dev-contrib

1 messages · Page 14 of 1

vale ibex
#

just to double check, did you make sure you replaced the container name with the correct snekbox container name?

stable mountainBOT
#

deployment.yaml lines 30 to 34

- "/bin/sh"
- "-c"
- >-
  PYTHONUSERBASE=/snekbox/user_base
  pip install --user --upgrade```
vale ibex
#

actually, I guess you could try adding --user

cold island
#

yeah I ran it in the container that was started for the bot. But actually maybe I did it for the wrong one? since I launched both 3.11 and 3.10 🤔

#

that might have been it

#

oh lol yeah, the import worked when I switched to 3.10

#

@fossil veldt just checking, is there a specific reason for requiring the output files to be under an output directory?

fossil veldt
#

originally it parsed files starting with output*

#

I suppose we could glob all files that the user didn't upload as well, might be less verbose

fossil veldt
#

no reason to have 2 containers and endpoints when we can just install multiple python versions in nsjail

cold island
#

other than that, I only found one small bug

main patrol
#

How you got the helpers role?

wind ruin
main patrol
outer oasis
#

Personal??

sharp crag
main patrol
#

I was being kinda sus ngl

fading galleon
main patrol
#

I know I am sorry

cold island
#

@fossil veldt about what I asked yesterday.. would it be possible to change to the output directory at the beginning of each run? that way people won't need to know files need to be created there

#

or does snekbox need the current working directory for something else

fossil veldt
#

we could just make the home folder = the output directory

#

and then keep a list of user uploaded file paths to exclude

#

not sure how intuitive it is for user uploaded files to not be uploaded by name

plush birch
fossil veldt
#

should we exclude files with leading underscores as well perhaps?

#

I feel like there should at least be some way to write a file and not have it uploaded

cold island
#

@fossil veldt And one last thing (sorry lol), can you change the eval command docstring to reflect the new feature?

#

(and remove " beta release, to assist with testing" from it while you're at it)

fossil veldt
cold island
fossil veldt
#

think I'll add

The starting working directory `/home`, is a writeable temporary file system.
Files created, excluding names with leading underscores, will be uploaded in the response.
warm apex
#

voiceverify

clever wraith
warm apex
#

thinks

main patrol
#

Anyone wanna work on some project?(I don't have an idea in mind but we can think of one)

clever wraith
main patrol
#

Ohh ok so which channel would be perfect?

gritty wind
#

There isn’t such a channel on this server

main patrol
#

So what should I do?@gritty wind

#

I also wanna contribute

gritty wind
#

You might be able to share your projects on Reddit (r/python) but they usually are finished projects

clever wraith
#

!contribute

stable mountainBOT
#

Contribute to Python Discord's Open Source Projects
Looking to contribute to Open Source Projects for the first time? Want to add a feature or fix a bug on the bots on this server? We have on-going projects that people can contribute to, even if you've never contributed to open source before!

Projects to Contribute to
Sir Lancebot - our fun, beginner-friendly bot
Python - our utility & moderation bot
Site - resources, guides, and more

Where to start

  1. Read our contribution guide
  2. Chat with us in #dev-contrib if you're ready to jump in or have any questions
  3. Open an issue or ask to be assigned to an issue to work on
main patrol
#

Alright

#

Where can I ask to be assigned to an issue?

clever wraith
#

On the github issue itself

#

If no one responds there, you can ask for it here

main patrol
#

Alright

shadow birch
#

hello im new to open source how should i start? i know some languages and git.

austere hornet
#

!contributw

stable mountainBOT
#

Contribute to Python Discord's Open Source Projects
Looking to contribute to Open Source Projects for the first time? Want to add a feature or fix a bug on the bots on this server? We have on-going projects that people can contribute to, even if you've never contributed to open source before!

Projects to Contribute to
Sir Lancebot - our fun, beginner-friendly bot
Python - our utility & moderation bot
Site - resources, guides, and more

Where to start

  1. Read our contribution guide
  2. Chat with us in #dev-contrib if you're ready to jump in or have any questions
  3. Open an issue or ask to be assigned to an issue to work on
austere hornet
#

Oh haha it understood my typo

fading galleon
#

@timid sentinel this is the conversation I mentioned in the review comments

#

for bot#2403

dusky shoreBOT
timid sentinel
fossil veldt
#

currently it will just not upload it by path name

#

I suppose we could hash it and upload if it mismatches, but I'm not sure if that behavior is clearer

cold island
#

Hmm.. user provided files aren't handled in the bot PR so I haven't considered it

fossil veldt
#

technically we just have main.py as the sole user providable file

#

currently at least

cold island
fossil veldt
#

someone could technically write to main.py

fossil veldt
#

not sure if that is still there from nsjail

cold island
timid sentinel
#

If anyone is looking for something to do, here are some small PRs waiting for a second approval:
sir-lancebot#1217
bot#2415
bot#2380
bot#2305
bot#2327 and site#824
site#847

timid sentinel
#

Oh I meant bot#2372 not 2327

dense citrus
#

Hello,
I am new to open source and got a quick question regarding reviews of PRs.
The guide mentions that it would be best practice to test the functionality of the edited code. How strict are you with that, especially when it comes to smaller PRs such as [bot] #2380 Trim query in command not found error to avoid embed limits?

gritty wind
#

The suggestion is good practice to help you spot errors (much easier to catch them at run time than when reading the code)

#

But it isn’t enforced

#

You’re welcome to give your feedback even if you haven’t run the code

dense citrus
#

Okay, makes sense. Thanks

fading galleon
tawdry vapor
#

An alternative would be to put it behind an option (which would also allow implementing this feature to be deferred), but I'd prefer not to have a bunch of options.

#

Sometimes it's good for software to be opinionated

#

Well that's not mutually exclusive. I don't know how to express what I meant I guess.

cold island
fading galleon
shadow birch
#

can someone help with setting up environment variables... i dont understand this thing

fading galleon
shadow birch
#

sir lancebot

fading galleon
shadow birch
#

yes, it gives a command to run but idk what to do next

fading galleon
shadow birch
#

i just have to create manually right?

fading galleon
shadow birch
#

yes i did that

#

i just have to add the given 2 variables is that it?

fading galleon
shadow birch
#

those 7

fading galleon
# shadow birch those 7

Yeah

BOT_TOKEN, BOT_GUILD, BOT_ADMIN_ROLE_ID, ROLE_HELPERS, CHANNEL_ANNOUNCEMENTS, CHANNEL_DEVLOG and CHANNEL_COMMUNITY_BOT_COMMANDS

shadow birch
#

ok

fading galleon
# shadow birch ok

CHANNEL_ANNOUNCEMENTS=12345 this is the format how each variable is to be added in the .env file

fading galleon
#

@clever wraith I committed again, If you can review/approve it because it still shows you are requesting changes

cold island
fading galleon
clever wraith
#

Yeah it's not something you can do when you're not a member, I used to struggle with that as well when more than one person has requested a change

rapid swallow
#

would look even better with one more approval on it though

clever wraith
#

@timid sentinel I thought the default value of the getattr would evaluate once it can't find the one we're initially targetting, that's why

#

But yes, you're correct

timid sentinel
#

yeah, I think you could probably do something like getattr(ctx, "user", None) or ctx.author, although I think the current way is a bit cleaner as it makes it obvious why it can't just use one of them.

clever wraith
#

Sure sure, my comment should just be ignored

outer oasis
fading galleon
outer oasis
rapid swallow
#

banned.

fallen patrol
#

any plans to ever implement deleting bookmarks?

#

its pretty simple to implement now, just add a button that deletes the message its clicked on.
happens in dms so it doesn't even need to check the user

hoary haven
#

can we put the original .bm text command back?

#

it seems the app commands sometimes just disappear from clients

#

i also don't think it necessarily has to replace the existing text command. and existing text command would allow users to bookmark posts from channels that are read-only

#

sir-lancebot#1219

dusky shoreBOT
fallen patrol
#

instead of deprecate the text, you could make it a slash command that allows selecting a message

clever wraith
fallen patrol
#

wdym?

#

I don't use discord.py so if you're asking for implementation details, I can't provide those

#

but I have a slash command that does that on my own bot

clever wraith
#

I'm not a dpy expert, so idk how would that work in a slash command

#

You mean just like the old text command, but instead make it a slash one ?

fallen patrol
#

or a link

clever wraith
#

Oh okay, I imagine sthg else

fallen patrol
#

then upon receival

full fractal
#

you can delete any of lance's DMs using bm delete matter of fact 😄

fallen patrol
#

intuitive ;-;

full fractal
#

totally!

sharp crag
#

honestly we really didn't have to even remove it in the first place

#

not like theres a prefix command limit

#

minimal overhead

#

though for bookmark delete i think either a delete button or a delete reaction would be nice

fallen patrol
#

and if it is being removed, replacing it with slash is probably better

fading galleon
hoary haven
#

the issue I'm talking about is some clients not showing apps in the context menu when they right click a message

fallen patrol
#

which clients

#

and which channels

#

because there could be some permissions in some channels, and depending on when or how the command sync is working, the clients could be on commands v1 (i think it still exists for backwards compat but could be wrong)

subtle kraken
subtle kraken
#

the app context menu comes and goes every few hours

#

tested on multiple different clients ranging from stable to canary to stable mobile to beta mobile

#

it shouldn't be a thing to begin with

subtle kraken
# subtle kraken any channels

well ofc and biggest blocker being that you cant bookmark a message unless you have write perm in the channel aside from the buggy UX as a whole

fading galleon
#

so when will bot#2403 be merged it has satisfied the requirements?

dusky shoreBOT
clever wraith
#

Core devs usually do this.
You just need to wait until someone checks the issues and the PRs that are ready to be Merged, and they'll merge them

fading galleon
#

ah okay

desert imp
#

hey guys got pretty busy if you want to take on the reply to eval and timeit issue go ahead. I did the majority of it just need to add a safe check

vale ibex
#

@clever wraith whats the actual behaviour of that context menu if you run the bot and you're not an admin?

#

does it not appear by default?

#

What we want to happen is for it to appear in DMs, but then in-guild have it so no one has access to it by default

#

So whatever configuration we need to do that

clever wraith
#

The last time i tested i, it doesn't appear

#

I'm going to re-verify now

#

and when I gave the admin role to someone

#

they see it

clever wraith
#

@vale ibex Should we deprecate the text command ?

hoary haven
# subtle kraken any clients

fwiw i had only heard second-hand reports originally (linux and windows) but yesterday i had the apps menu disappear on me for the first time (macOS ptb). though a client refresh seemed to fix it for me for now

stable mountainBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

timid sentinel
#

nice

vale ibex
#

Thoughts on including the tag name in the embed title now that the slash command doesn't give context?

fading galleon
#

like setting the title? or editing the markdown file itself?

timid sentinel
vale ibex
#

meta data seems fine, or just .replace('-', ' ') the file name

fading galleon
vale ibex
#

if you look at dashmpip.md it actually shows you how to set the embed title with meta data already

vale ibex
#

but yea, as wookie said, there are a few that have pseudo heading using bold text, so that should be replaced

gritty wind
#

I Thjnk Title Case May Draw Attention Better

#

Kinda Joking

fading galleon
#

Good Example

vale ibex
#

title case is a mistake and should never be used

#

thanks

#

mr John Lemon

gritty wind
#

It’s a string method, therefore it is completely and entirely valid

#

They wouldn’t add something invalid to the spec

#

No sir

vale ibex
#

I'm going to add random_case as a string method

gritty wind
#

Trying to normalize randomization smh

#

Everything must be well defined and repeatable

timid sentinel
#

!e print("the title of a thing".title())
doesn't even make "of" and "a" lowercase 😔

stable mountainBOT
#

@timid sentinel :white_check_mark: Your 3.11 eval job has completed with return code 0.

The Title Of A Thing
gritty wind
gritty wind
#

Do you just have that on the ready

timid sentinel
#

lmao

timid sentinel
vale ibex
gritty wind
#

Lol

fading galleon
#

so we are going with sentence casing right?

vale ibex
#

Yea

fading galleon
#

@vale ibex what about already title cased headings? shall I change it to sentence casing?

#

!contributing

stable mountainBOT
#

Contribute to Python Discord's Open Source Projects
Looking to contribute to Open Source Projects for the first time? Want to add a feature or fix a bug on the bots on this server? We have on-going projects that people can contribute to, even if you've never contributed to open source before!

Projects to Contribute to
Sir Lancebot - our fun, beginner-friendly bot
Python - our utility & moderation bot
Site - resources, guides, and more

Where to start

  1. Read our contribution guide
  2. Chat with us in #dev-contrib if you're ready to jump in or have any questions
  3. Open an issue or ask to be assigned to an issue to work on
fading galleon
#

for example this

vale ibex
#

Yea, and make it a title, rather than a bolded part of the tag

stable mountainBOT
#

Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.

>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."

Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.

cold island
#

exciting

stable mountainBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. Various features of discord.py rely on having particular intents enabled, further detailed in its documentation. Since discord.py v2.0.0, it has become mandatory for developers to explicitly define the values of these intents in their code.

There are standard and privileged intents. To use privileged intents like Presences, Server Members, and Message Content, you have to first enable them in the Discord Developer Portal. In there, go to the Bot page of your application, scroll down to the Privileged Gateway Intents section, and enable the privileged intents that you need. Standard intents can be used without any changes in the developer portal.

Afterwards in your code, you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

# Enable all standard intents and message content
# (prefix commands generally require message content)
intents = Intents.default()
intents.message_content = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see discord.py's related guide, and for general information about them, see the Discord developer documentation on intents.

sharp crag
#

That's pretty cool

dusky shoreBOT
hoary haven
#

@fading galleon such nice work on /tag, thank you!

vale ibex
#

Nice one

clever wraith
#

BeautifulWork @fading galleon !

fading galleon
clever wraith
#

Ahahah, I just wanted to match my praising to your alias :p

fading galleon
#

yea 😄

vocal wolf
#

@vale ibex my apologies I broke your site PR

#

merged too many dependencies

sharp crag
#

#changelog message
Would've been cool if you mentioned the slash command: </tag:1079848585027399791>

vocal wolf
#

poetry groups

#

site#847

dusky shoreBOT
vale ibex
#

ah cool, easy solve

#

will fix

vocal wolf
#

thank

vale ibex
vocal wolf
#

thank

trim cradle
#

@vocal wolf a wa

sharp crag
#

a wa

vocal wolf
trim cradle
sharp crag
#

@desert imp did you mention you were no longer able to work on bot#2402 or am i misremembering?

fading galleon
clever wraith
#

interesting

#

What happens when someone tries to invoke it tho ? Will the bot take it to #bot-commands and mention the invoker ?

clever wraith
#

If you click on the mentioned command, it will appear where you type text & ask you for a tag name

#

Well, people can't do that there since it's read-only

clever wraith
fading galleon
clever wraith
#

The api is supposed to return a list of tuple for the rules

#

!source pydis_site.apps.api.views

stable mountainBOT
#
Bad argument

Unable to convert 'pydis_site.apps.api.views' to valid command, tag, or Cog.

#
Command Help

!source [source_item=None]
Can also use: src

Display information and a GitHub link to the source code of a command, tag, or cog.

fading galleon
stable mountainBOT
#

pydis_core/site_api.py line 121

async def get(self, endpoint: str, *, raise_for_status: bool = True, **kwargs) -> dict:```
stable mountainBOT
#

pydis_site/apps/api/views.py line 133

return Response([```
clever wraith
#

You can have a look at the response starting from that line

#

Is your site image up to date ?

fading galleon
#

but it doesn't uses views.py If I understand correctly

fading galleon
clever wraith
#

What doesn't ?

stable mountainBOT
#

bot/exts/info/information.py lines 534 to 543

async def _set_rules_command_help(self) -> None:
    help_string = f"{self.rules.help}\n\n"
    help_string += "__Available keywords per rule__:\n\n"

    full_rules = await self.bot.api_client.get("rules", params={"link_format": "md"})

    for index, (_, keywords) in enumerate(full_rules, start=1):
        help_string += f"**Rule {index}**: {', '.join(keywords)}\n\r"

    self.rules.help = help_string```
clever wraith
fading galleon
fading galleon
clever wraith
#

Ah

#

It needs to be updated

#

So checkout main, pull, then run docker compose up again

#

The view has been updated to return a list of tuples

fading galleon
clever wraith
#

for site

#

The rules are fetched from the site project

vale ibex
#

you can do docker compose pull in the bot dir to pul the latest site image

#

this the bot's compose file doesn't use your local image

vale ibex
fading galleon
#

cool now the errors gone

clever wraith
#

For those who use Pycharm when running specific tests in bot (If you ever do that):

Do you have to edit the run config each time you want to run a particular test ? That is if you want to hit breakpoints, etc.

dense citrus
#

There are a few open issues about supporting more time formats for !remind or changing the way to add a reminder.
What do you think about creating a / command for the reminder and then having multiple optional parameters such as day month hour or sth like that. Not sure though if this is actually easier or nicer to use than the current format of !remind

gritty wind
#

You just need to configure the proper working dir in the template and the button will work

clever wraith
#

I know that, it's just that it always fails for me

#

Exactly !

#

This can easily be solved once and for all

#

By updating the paths to the .yaml files

#

and having them take the absolute one

gritty wind
#

Nah please don’t do that

clever wraith
#

I'm not going to

#

I'm just wondering what do people do to solve it

gritty wind
#

You can configure pycharm to use the pwd you want when instantiating the run (by editing the template)

#

That fixes the buttons

#

So you don’t have to edit it every time

clever wraith
#

template = run config ?

gritty wind
#

When creating a run config there’s a small button at the bottom called edit config templates

#

Pycharm uses those templates when creating new configs to set the defaults

#

I’ll share mine

dense citrus
#

Since you are talking about pycharm. When running the bot through the normal run function i ran into an import problem because both the package and the file were named bot. How did you solve this? I just renamed the file bot.py but this doesnt seem right haha

clever wraith
#

Yeah I see what you're talking about

#

I've edited it for unittest

#

Let me test it

gritty wind
#

You might wanna do it for autodetect and pytest as well

clever wraith
#

Yep, it works

gritty wind
clever wraith
#

Very nice

gritty wind
#

Make sure your config looks like this

dense citrus
#

oh wow i didnt see there was a dropdown

gritty wind
#

Or if you just want a file to copy, here's mine:

<component name="ProjectRunConfigurationManager">
  <configuration default="false" name="bot" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
    <module name="PyDis Bot" />
    <option name="INTERPRETER_OPTIONS" value="" />
    <option name="PARENT_ENVS" value="true" />
    <envs>
      <env name="PYTHONUNBUFFERED" value="1" />
    </envs>
    <option name="SDK_HOME" value="" />
    <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
    <option name="IS_MODULE_SDK" value="true" />
    <option name="ADD_CONTENT_ROOTS" value="true" />
    <option name="ADD_SOURCE_ROOTS" value="true" />
    <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
    </EXTENSION>
    <option name="SCRIPT_NAME" value="bot" />
    <option name="PARAMETERS" value="" />
    <option name="SHOW_COMMAND_LINE" value="false" />
    <option name="EMULATE_TERMINAL" value="false" />
    <option name="MODULE_MODE" value="true" />
    <option name="REDIRECT_INPUT" value="false" />
    <option name="INPUT_FILE" value="" />
    <method v="2" />
  </configuration>
</component>
dense citrus
#

my bad thanks a lot🙈

gritty wind
#

nw

sharp crag
#

What do we think about using a select menu in #roles ? I personally think it'd make more sense.
Though we only recently switched to buttons so I want to ask for opinions here before I even take it to the GitHub issues

thorny obsidian
#

How would toggling multiple roles with select menus work? Buttons make it easy to select a bunch at once or deselect a bunch

sharp crag
#

Sort of like checkboxes rather than radio buttons

thorny obsidian
#

But how would they show you at a glance what you have applied? You need to click on it to expand the selection, no?

sharp crag
#

We can send the select menu with the roles a user has already pre-selected

#

From there they can deselect those roles if they want to remove it

#

Or select other roles if they want them added

#

Quite similar to how we already have it, just feels a bit more intuitive IMO

thorny obsidian
#

Does the select menu already come pre-expanded showing the selection without needing to click an additional element and scroll?

sharp crag
#

Sure. Select menus support "default" options, so when the view is initially sent, those "default" options will be pre-selected

#

And since it's ephemeral, we can customize how it looks for each user

thorny obsidian
#

I guess I'm struggling to picture how it looks. Select menus for me are dropdowns, as in you need to click, view the dropdown, and then select from there. The buttons for me make sense as a toggle and they're nicely compact

sharp crag
#

Ah, I get what you're saying.You do have to click on the select menu for it to expand, from where you can see all your roles. I feel like currently it's a bit chaotic:

#

Different colors, different lengths, and if we end up adding more roles here it just gets a lot more chaotic IMO

thorny obsidian
#

Yeah, having the roles thing be a dropdown would be a step back imo. An additional interaction to just view what roles you can apply. A toggle for a checkbox doesn't quite work as well as toggling buttons

sharp crag
#

Hm. I can see that. But I think the extra click scales better in the long term. We're already at the max 5 action row limit. On mobile the menu takes up half the screen. If we add more buttons, we have to fit them into the existing rows and it will start button wrapping on mobile.
Also, role menus are a common enough use case that discord has native support for menus with roles:

#

That's pretty much how it'll look like but with whatever roles we want it to show

sharp crag
#

BTW do we want to put this to a vote or just nip it in the bud?

cold island
clever wraith
#

When do you get that ? When running bot ?

#

Did you run config change ? Maybe the root dir ?

outer oasis
#

firHmm
Have you updated your dependencies?

cold island
#

yeah I removed the whole env, installed anew

cold island
clever wraith
#

How are you running it ? From pycharm's native run buttons, or using poetry ?

clever wraith
#

This usually happens due to the run config, at least that's when it happened to me

outer oasis
clever wraith
#

Can you try running it with poetry ?

cold island
#

possible, I just merged a chunky amount of commits from main

sharp crag
#

It's more linear

cold island
#

ah yeah, using a terminal worked

clever wraith
#

Yep, defo the run config

outer oasis
cold island
clever wraith
#

Make sure to edit so that it runs the bot module from the root dir as the working directory

outer oasis
sharp crag
cold island
#

It worked before the merge

outer oasis
cold island
#

wait

#

it stopped being broken

#

but I didn't do anything

clever wraith
#

It must've felt ganged up upon

#

Well, great !

dense citrus
#

That's why we love coding 😄

cold island
#

ok, thanks

sharp crag
cold island
#

and now I somehow have a shadow instance of the bot running

sharp crag
thorny obsidian
fallen patrol
#

there's no additional interaction being sent so I'm afraid I don't understand

thorny obsidian
#

Not discord interaction, an additional thing the user needs to do

fallen patrol
#

hmmm, imo the existing solution is not that readable. this is the implementation for disnake's roles. (though we've deprecated this in favour of community 2.0)

sharp crag
thorny obsidian
#

It's fine if you disagree with me. I was just stating my opinion and preferences

sharp crag
#

That kinda sucks, wish you could customize which roles you show

fallen patrol
sharp crag
#

It's OK right now but I'm worried what happens if we add more

fallen patrol
#

all different lengths, have to click them four times to remove all of the roles, some roles are locked out for an unexplainable reason (the command does not share the reason)

sharp crag
#

Do select menus have a nice way to clear all?

outer oasis
sharp crag
#

I mean, a discord UI feature that deselects all options in the select menu

outer oasis
#

Oh

fallen patrol
outer oasis
#

You're the bot bird
Why don't you know?

fallen patrol
#

they support searching tho

sharp crag
#

Yup, scales well once again

fallen patrol
cold island
#

What is this?

dense citrus
sharp crag
#

Yeah the mobile experience is a bit meh

fallen patrol
#

it requires an additional thing the user needs to do

dim pelican
#

So to get up to speed is there a push to change the way self-assigned roles are displayed and selected?

fallen patrol
#

I think so

#

I just came here to answer discord restrictions

#

i'd also like to know why there is a month lock on some roles (it doesn't make sense from a UI perspective)

sharp crag
fallen patrol
#

like, IMO don't show the roles if they can't be assigned rather than giving a clickable button that then says you can only get this during other months

sharp crag
#

Yup. You can just send the select menu without those options during certain months

#

I don't believe there is an option to show disabled UI for only certain options

fallen patrol
#

or even just let them be assignable lol i still don't understand what the purpose is to not let them be assigned

sharp crag
#

But man, it'd be cool if role selects didn't auto populate

fallen patrol
#

i understand why they don't but yeah

timid sentinel
# cold island What is this?

We have a CI check to check that licenses of dependencies are compatible with our MIT license. It seems that in the most recent update of filelock (a subdependency of ours) they updated their package to make their license detectable to our CI check. The Unlicense is a bit of a dodgy licence afaik but it should be fine to add to allowed licenses

cold island
#

I doubt my PR will be merged in a relevant time frame, so I'll merge the change when it's added to main later

sharp crag
#

Can I be assigned to sir-lancebot#1219 ?

dusky shoreBOT
clever wraith
#

Sure, I'll assign you

#

Done

hoary haven
sharp crag
dusky shoreBOT
sharp crag
#

Do do the do 🥺

sharp crag
hoary haven
#

i think if at this moment it won't let us restrict, the native role selectability is no go for us. it would list a million roles that people can't assign

#

right?

#

and yes i'm going to call this the native role selectability

hoary haven
sharp crag
#

ye i had it done yesterday

hoary haven
#

loll

#

alright let me see if i remember how to run the bot

sharp crag
#

always test py_strong

hoary haven
#

oh, lance

sharp crag
# hoary haven right?

yup. not a fan of that either. What do you think about the original idea of just a regular string select menu?

hoary haven
#

idk, i haven't seen too many implementations of the dropdown select* so i'd want to try it out

#

actually idk if i've seen any

sharp crag
#

source: random google image

fading galleon
sharp crag
#

Select menus pretty much have the same functionality

hoary haven
sharp crag
#

Just extra click downside, like kat mentioned

sharp crag
#

looking for a multi select image right now

#

closest one i could find

#

we can also send the initial select menu with options enabled by default (these will be the roles the user already has)

#

from there they can deselect those existing roles (to remove them) or select other roles (to add them)

hoary haven
#

we had a pending issue for button/interaction-ifying the !voiceverify command. for that one idk if it would work well as part of a dropdown select. if someone has a public server i can join that implements this i'd want to try it though. DM me

sharp crag
#

so you can trial out the "real thing", i guess

#

As for the voice verify one, I believe it's bot#2271 which is being worked on by @gleaming jay

dusky shoreBOT
sharp crag
#

though yeah you're right, that should probably be a button rather than select

timid sentinel
#

I'm not sure I see the added benefit of the select menu for role selection, like kat said it's extra clicks and doesn't toggle as nicely.

#

If we add more roles in the selection and it becomes too much we can change it then, I don't think it's worth making it arguably worse for something we might not need

hoary haven
sharp crag
#

How about this:
I can write up the "PR" (won't actually be PRed) anyway sort of as a trial. Y'all can decide if it's really something we want as of now or not.
If we do, great. The code is already written and it's an easy PR
If not, also great. No harm done, it's all just a local copy. I can push it onto a seperate branch on my personal fork of sir-lancebot, and we can just PR from there if necessary somewhere down the line

cold island
#

write what?

sharp crag
#

Role assigning via select menus on a local copy of @stable mountain , in a test server

#

But that's up to yall if you want to do that

cold island
#

ah I got confused by you saying sir-lancebot

sharp crag
#

Oh haha, that's for the bookmark command

cold island
#

I'm confused, you're already assigned to the bookmark command

sharp crag
#

Yeah, I have a PR for that atm

cold island
#

Then I'm not sure what you mean by

If not, also great. No harm done, it's all just a local copy. I can push it onto a seperate branch on my personal fork of sir-lancebot

sharp crag
#

Oh sorry, that was in reference to role assignment via select menus

#

The bookmarking is a seperate thing, that's mostly sorted out

cold island
#

So you mean a fork of the bot

sharp crag
#

Right. I'll make the role menu on my own branch on my fork of python-discord/bot, from there it's easy to PR if we want to or just leave it be

cold island
#

Could be nice, up to you of course

sharp crag
#

Okay, thanks. I'll do that 😁

fading galleon
#

Need some feedback on bot#2420 and bot#439

timid sentinel
#

Or .challenge I think is the main name

hoary haven
#

oh right

timid sentinel
#

I still sort of don't see the benefit for role selection tho, buttons seem perfect here for toggling.

hoary haven
#

not multi select tho

timid sentinel
#

Oh I didn't realise there are different ones

hoary haven
#

checkbox (if it works well) is nice for toggling. the green/red signaling and wording always confused me

sharp crag
#

I'll get a demo going here soon, hopefully that'll clear up any confusion

#

.kata

dusky shoreBOT
#

Twelve cards with grades from 0 to 11 randomly divided among 3 players: Frank, Sam, and Tom, 4 cards each. The game consists of 4 rounds.
The goal of the round is to move by the card with the most points.<br>
In round 1, the first player who has a card with 0 points, takes the first turn, and he starts with that card.
Then the second player (queue - Frank -> Sam -> Tom -> Frank, etc.) can move with any of his cards (each card is used only once per game, and there are no rules that require players to make only the best moves).
The third player makes his move after the second player, and he sees the previous moves.<br>
The winner of the previous round then makes the first move in the next round with any remaining card.<br>
The player who wins 2 rounds first, wins the game.

Task

Return true if Frank has a chance of winning the game.<br>
Return false if Frank has no chance.

Input

... continue reading

Difficulty

7 kyu

sharp crag
#

oh yeah, that's pretty cool

timid sentinel
hoary haven
#

nice i'll review this too

fallen patrol
#

</notifications:958232691814334466>

#

lmfao nice job discord

hoary haven
#

nice, i quite like it

hoary haven
fading galleon
#

@timid sentinel for bot#439

I understand the original issue talked about deleting the user's message but thats not my suggestion, my suggestion is to detect some code(could use the same functions from exts/info/codeblock to detect if the user message contains python code) which is larger than somewhat 30-45 lines and send them a embed saying its better to post large codes in pastebin so it doesn't makes a chat wall amd attach our hastebin link.

I know the issue's original idea was to delete the message but we just tell them to edit the message and use hastebin. What do you think? Its a completely different approach than that of the issue so if you agree I can make a new issue because the old issue has lost relevancy.

timid sentinel
#

I'm not sure, I'd worry that it would mean that long code snippets become more disruptive because they're made even longer by the bot response afterwards. I don't have a very strong opinion on it so I'd be happy to leave it to others to decide though

fading galleon
#

and I have seen the codeblock embed being actually effective in the help channels for people to edit their message and include codeblock

cold island
#

Message length isn't as much of an issue in help channels though

#

The only place where it would really matter is python-general, but like wookie my worry is that it will just contribute to the noise

fading galleon
#

Well if that's that then we can probably close the 3 year old issue.

cold island
#

We could DM it maybe? Not sure

fading galleon
# cold island We could DM it maybe? Not sure

If we DM them then we probably also need to link the discord message that they posted, so that they don't get confused about the context of getting DMed if they don't check it right away. Overall this approach doesn't seems right to me.

#

Also bot#2422 is up for review

dusky shoreBOT
rapid swallow
#

@vale ibex

re: my comment https://github.com/python-discord/bot/pull/2372#discussion_r1118095635

https://docs.djangoproject.com/en/dev/ref/models/fields/#null
"[...]Avoid using null on string-based fields such as CharField and TextField.
[...] the Django convention is to use the empty string, not NULL."

GitHub

Closes #2329 .
Related site issue: python-discord/site#801
Related site PR: python-discord/site#824
screenshots:
Infraction log:

#mod-logs embed:

vale ibex
rapid swallow
#

sorry for taking time to reply, I have exams right now (2 more left)

#

and I thought it'd take me way longer to find the link

vale ibex
#

I guess it's a moot point if we're using url field though?

rapid swallow
#

urlfield is like charfield + validation right?

vale ibex
rapid swallow
vale ibex
#

empty-string and None can have two completely different meanings though

#

by all means follow the convention if that's what the docs say, I just disagree with the convention lol

rapid swallow
#

Agreed, empty is what I feel at night when I realize I'm lonely

#

and none is the hours of sleep I had last night

fading galleon
clever wraith
fading galleon
#

bot#2001 and bot#2021 doesn't seems possible now as the head repo is private/deleted

fading galleon
#

Either they should be merged as they are, because the requested changes are not that necessary except some, most of them are nitpicks and can be resolved by making another immediate pr to address the reviews. Or they should be closed and re-implemented from scratch.

tardy dagger
#

hi

tawdry vapor
cold island
vale ibex
#

@timid sentinel FWIW get_or_fetch_channel was made mostly just for threads, since they're not always going to be cached

#

normal channels should always be cached

#

not that it makes much of a difference if you want to use it anyway

timid sentinel
#

It has the benefit that it raises an error if the channel doesn't exist, so e.g. in dev you get a clearer error rather than one later on due to it being None

vale ibex
#

ahh right, yea we don't have the channel check that we do in lance in bot

#

in lance it iterates through the channels to ensure they exist at startup iirc

timid sentinel
#

I think bot does that and puts a warning, although it's sort of easy to miss

vale ibex
#

yea, quite a few logs at startup 😅

fallen patrol
fading galleon
#

@timid sentinel for bot#2022, can't seem to reproduce it

dusky shoreBOT
fossil veldt
cold island
#

no worries! just checking we're on the same page about what's left

fallen patrol
#

its probably no longer an issue or something

#

check the diff

timid sentinel
#

I managed to reproduce it today (on my bot)

#

I haven't looked into it so I don't know exactly what affects whether it appears

fallen patrol
#

its the import order then

#

and inter-cog dependencies which shouldn't exist

#

if you're using dependencies between cogs, don't import, make it dynamic

#

so if the cog is reloaded there won't be an old reference

#

because that's the issue here

timid sentinel
#

Yeah

#

Although I don't get why it works sometimes but not others

#

Even when reloading

fallen patrol
#

there's no set repeatable order for cogs to load

timid sentinel
#

I'd expect that reloading would break it regardless though

#

I don't think it was broken before the reload for me

#

Maybe it was though

fallen patrol
#

are you on the most up to date branch becuz that could be it

timid sentinel
#

Yeah I am

fallen patrol
#

/shrug

fading galleon
#

always love to solve bugs like these😋

fossil veldt
fossil veldt
#

output folder now defaults to the same as home, and files with existing names are uploaded if last modified != original

cold island
#

noice

#

I'll let @tawdry vapor and @timid sentinel verify their approvals on the snekbox pr

fossil veldt
#

though currently the only such file where this can happen is main.py

#

and it seems since it's written by the host, nsjail doesn't have permissions to write to it

#

do we want to change this?

cold island
fossil veldt
#

though the .py file, after upload, would get a disallowed extension anyways

cold island
fossil veldt
#

hm yeah

#

is there a way to view permission bits from python

cold island
#

something on os maybe

#

os.stat seems to have that too

outer oasis
#

Path().stat()!!

cold island
#

oh that's a thing ok. I was trying to get a pathlib specific result but I guess I should've looked at the docs

fossil veldt
#

I chmoded it to 0o777 like we do for home and it works now

#

though normally it would be

cold island
#

yeah, it's probably not a normal use case anyway though lol

fossil veldt
#

should we have a default ignore list or something

#

apparently creating a new python file and importing it does not respect the NOBYTECODE env var

#

we could have a user modifiable .ignore file in home I guess?

fossil veldt
#

don't really see why users need to modify .ignore so it might be safer to have it as a config level thing instead

fossil veldt
stable mountainBOT
#

config/.ignore lines 1 to 4

__pycache__/
*.py[cod]
*$py.class
*.so```
rapid swallow
#

So the way it is right now, we cant use URLField I think

#

because of the second case

#

are blank strings allowed by the URL validator?

#

I could have the default value be null (for infractions issued before thsi change) and store a blank string when the command was used in a modmail channel

stable mountainBOT
#

django/core/validators.py line 69

class URLValidator(RegexValidator):```
rapid swallow
#

at least the regex on line 95 doesn't

#

and I'm not sure if blank=True will affect it

rapid swallow
tawdry vapor
#

Granted we're stuck with having to allow null since it's a new field in a table with existing records.

rapid swallow
rapid swallow
rapid swallow
fading galleon
# fading galleon I would try to break it on my bot and see what is the actual problem then

@timid sentinel
https://github.com/python-discord/bot/blob/main/bot/exts/info/source.py#L86 line returns False although it should return True might be related to https://stackoverflow.com/questions/46708659/isinstance-fails-for-a-type-imported-via-package-and-from-the-same-module-direct
Not sure though, I tried printing sys.modules plenty times but I only saw one key containing bot.extx.info.tags or none containing TagIdentifier although reloading the tags cog increases the length of sys.modules from 1008 to 1016.

We could try to directly compare the names?

if type(source_object).__module__ + type(source_object).__name__ == TagIdentifier.__module__ + TagIdentifier.__name__:

I will try to dig further tomorrow if this solution doesn't seems plausible.

stable mountainBOT
#

bot/exts/info/source.py line 86

elif isinstance(source_object, TagIdentifier):```
cold island
#

Hi @fading galleon, I sent you a DM yesterday, though I might be trapped in message requests 😄

tawdry vapor
#

Oh I misread. Are you saying it would manually be appended by a mod?

cold island
tawdry vapor
#

Could the bot do that automatically as with other infractions not in mod mail?

cold island
tawdry vapor
#

Why?

cold island
#

because that's where the thread link is stored

#

I'm talking about the logviewer, not a discord link

tawdry vapor
#

I thought this was just adding the discord link to the infraction. The bot can just get that from the invocation context, can't it?

What's this have to do with the log viewer? I feel like I lack the full context on this feature

cold island
tawdry vapor
#

So what's the point of manually linking to a thread currently?

cold island
#

The manual linking is to the logviewer

#

I guess I used an ambiguous wording

tawdry vapor
#

Ok makes more sense. Sounds like it's fine to just show N/A for the link field in this case too

cold island
#

yeah I think as long as we don't address the modmail issue we don't need to send anything to the link field at all in that case

tawdry vapor
#

If a link is often manually included a attempt to extract it could be made

cold island
#

That comes back to connecting the bot to mongo

tawdry vapor
#

Sorry, how is the link being manually included?

#

I thought it's added as part of the infraction reason

cold island
#

it's being fetched from the modmail bot

#

and then appended

tawdry vapor
#

Appended to what?

cold island
#

I guess we could do something less pretty like making modmail spit out the link in the opening message, and then make the bot look for that message in case it's a modmail thread

#

Would save the extra dependency

tawdry vapor
#

I thought it was something like !mute .... "reason here.... Https://..." and then we can just parse the reason to extract the link, assuming that it's easy to distinguish it from other links. No need for mongo

cold island
#

the idea is to save that effort, and also we don't include the link in the public reason

#

We would apply the mute, and then append the link

tawdry vapor
#

If it's still eventually ending up in the reason then it can be parsed upon retrieving infraction history

cold island
#

true

tawdry vapor
#

And yeah it would still require manually adding it for mod mail infractions but in other cases it will still be automated so still an improvement

#

I said still a lot of times there

cold island
#

Well the other cases are not blocked by the modmail issue, the question is whether we want to address the modmail issue somehow

#

We could just ignore it for now and scratch our heads later

tawdry vapor
#

Would be great if there was a way to convert discord links to log links

#

Like, if log links just used the same path as discord

cold island
#

yeah unfortunately it generates some hash for the link

tawdry vapor
#

We could create a proxy service which has access to mongo and redirects us to the log link 🤔

#

Not a serious suggestion

tawdry vapor
#

Is the log viewer a part of modmail?

cold island
#

not sure it's what generates the links 🤔

stable mountainBOT
#

core/clients.py line 603

return f"{self.bot.config['log_url'].strip('/')}{'/' + prefix if prefix else ''}/{key}"```
cold island
#

Not sure how I feel about making the log link resolvable

tawdry vapor
#

Why? Is this unauthenticated?

rapid swallow
stable mountainBOT
#
Command Help

!infraction append <infraction> [duration] [reason=None]
Can also use: infraction a, infraction add, infraction amend

You cannot run this command.

Append text and/or edit the duration of an infraction.

Durations are relative to the time of updating and should be appended with a unit of time. Units (∗case-sensitive):
y - years
m - months∗
w - weeks
d - days
h - hours
M - minutes∗
s - seconds

Use "l", "last", or "recent" as the infraction ID to specify that the most recent infraction authored by the command invoker should be edited.

Use "p" or "permanent" to mark the infraction as permanent. Alternatively, an ISO 8601 timestamp can be provided for the duration.

If a previous infraction reason does not end with an ending punctuation mark, this automatically adds a period before the amended reason.

cold island
tawdry vapor
#

What would CF have to do with this change

cold island
#

you asked about authentication

tawdry vapor
#

Oh so the answer was yes

cold island
#

yes it's authenticated

rapid swallow
cold island
tawdry vapor
#

Whats the advantage

tawdry vapor
cold island
cold island
#

maybe even include it in the channel description

tawdry vapor
#

In any case for the issue at hand we can just have the link show N/A and later figure out how to deal with modmail. It leaves room for improvement in the future should we want it

cold island
sharp crag
#

Can do, sorry that got stale. Got caught up with other stuff 😛

cold island
#

nw

sharp crag
#
raceback (most recent call last):
  File "/home/robin/Desktop/Coding/pydis-bot/.venv/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 935, in _load_from_module_spec
    spec.loader.exec_module(lib)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/robin/Desktop/Coding/pydis-bot/bot/exts/moderation/infraction/management.py", line 16, in <module>
    from bot.exts.moderation.infraction import _utils
  File "/home/robin/Desktop/Coding/pydis-bot/bot/exts/moderation/infraction/_utils.py", line 5, in <module>
    from botcore.site_api import ResponseCodeError
ModuleNotFoundError: No module named 'botcore'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/robin/Desktop/Coding/pydis-bot/.venv/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1013, in load_extension
    await self._load_from_module_spec(spec, name)
  File "/home/robin/Desktop/Coding/pydis-bot/.venv/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 938, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'bot.exts.moderation.infraction.management' raised an error: ModuleNotFoundError: No module named 'botcore'
#

🤔

sharp crag
#

Ah, yeah. Not sure why it's still on botcore for me

fading galleon
stable mountainBOT
#

bot/exts/moderation/infraction/_utils.py line 6

from pydis_core.site_api import ResponseCodeError```
sharp crag
#

Yeah, it's a really old branch 😛

#

Had to fix some merge conflicts, could've come from there

fading galleon
#

that might be it

gritty wind
#

Shouldn’t need to go through CF gate for anything cluster local

#

CF would only be an issue if you’ve tried to contact the service through the general internet

#

Regardless it might be time to look for something that’s a bit less constrictive if we plan to continue expanding

#

I need 5 non-negotiable seats at least for devops

#

(Max on a free plan is 50, not sure how many we have)

vale ibex
#

Also put on a 2 month inactivity timer, so anyone that doesn't use their seat for 2 months gives it up

gritty wind
#

Awesome

vale ibex
#

obviously if you re-auth it'll give you a seat back

#

unless we chat up someone at CF, we're stuck at 50 available seats with where we are

#

the lowest paid tier is something like $5/user/month

fallen patrol
#

@cold island actually, wookie was the first with that template

fallen patrol
#

ah

fading galleon
#

@thorny obsidian What do you think about my last comment on bot#2423?

fading galleon
cold island
#

Well that's just a lie

#

Removing a second from the duration makes it work

#

oh wait no I removed 23 hours instead

#

seems to be doing ok with a minute less

austere hornet
#

Could a core dev please take a look at bot#2424 and give their thoughts? Thanks!

dusky shoreBOT
stable mountainBOT
#

monty/exts/info/source.py lines 110 to 119

@commands.Cog.listener("on_cog_load")
@commands.Cog.listener("on_cog_remove")
@commands.Cog.listener("on_command_add")
@commands.Cog.listener("on_command_remove")
@commands.Cog.listener("on_slash_command_add")
@commands.Cog.listener("on_slash_command_remove")
async def refresh_cache(
    self, obj: Optional[Union[commands.Command, commands.Cog, commands.InvokableSlashCommand]] = None
) -> None:
    """Refreshes the cache when a cog is added or removed."""```
fallen patrol
#

plus the rest of that cog

#

you can ignore the 'feature' oriented code

fading galleon
#

bot#2423 is waiting for a core dev's response

fading galleon
grim prairie
#

@cold island while setting up my local bot, I found at least one minor bug with updated wordings.. can probably be marked "beginner".

grim prairie
#

building a dev env of the python bot.. It threw me an error on the docker compose. It's complaining about services.meteicity containing an invalid type (should be array)

vale ibex
#

You might need to update docker compose

#

what does docker compose version output?

cold island
#

@grim prairie if you're working on the bot please open an issue about what you're planning

grim prairie
grim prairie
vale ibex
#

Yea, you'll need to update that

#

That's a few years out of date

grim prairie
#

I'm behind on OS updates. Running the last LTS of mint.

#

I'll catch up on those then I should get access to a more recent repo

#

If not I'll build it from source

grim prairie
#

Yeah that did the trick

clever wraith
#

@cold island for bot#2450, do we never want to allow any slash command in DMs ?

dusky shoreBOT
clever wraith
#

It doesn't seem like we have exceptions for that for the text commands in the Security cog anyway

#

So i'm guessing not

thorny obsidian
#

Is the bm delete command a slash command or will it be a slash command?

clever wraith
#

It's currently a text command.

There's a PR I made that turns it into a context menu command

#

Since you act directly on the message itself

#

sir-lancebot#1197

dusky shoreBOT
thorny obsidian
#

That counts as an app command though, right?

clever wraith
#

I think so, the main difference is in the UX

thorny obsidian
#

So setting all app commands to guild only would prevent that from working

clever wraith
#

That's a good point, let me check it

cold island
#

bm is in lance not Python

thorny obsidian
#

But if it's moved to botcore won't it affect lance?

clever wraith
#

IT would, since we use bot core

cold island
#

Didn't see we were talking about moving it to botcore

#

let's keep it Python specific for now

clever wraith
#

I was asking the question of whether we'd want to do that

cold island
#

I see

fading galleon
#

for bot#2450 currently we can use the @guild_only decorator in all the slash commands to stop with errors when invoked in DMs, while we figure out an absolute way to add global checks for app comamnds

dusky shoreBOT
fading galleon
#

We also need to add an error handler for slash commands in error_handler.py

fading galleon
#

I am interested in doing these after we find an absolute way for running global checks for app commands

clever wraith
#

Using the decorator is possible, we just want a centralized way to do it.

#

Subclassing the CommandTree is kinda the idea that I had suggested, it's just that I don't like it much because people won't jump to using it directly since it's not intuitive for them to know

#

I thought of just monkey patching interaction_check, which does it just fine.

However, with this approach the command still appears in DMs, which is what I'm still waiting for to hear from Zig

fading galleon
fading galleon
vale ibex
#

Why can't we just use guild_only?

#

That makes sure the slash command isn't registered in DMs

fading galleon
#

guild_only doesn't responds if it fails unlike check failures

vale ibex
#

it won't even appear in DMs if it's marked as guild only

fading galleon
#

oh right

clever wraith
#

Indeed

clever wraith
#

And for the subclassing one, we won't be overriding the interaction check method

vale ibex
#

Why not just mark the slash command as guild_only?

clever wraith
#

We want to centralize it I guess

vale ibex
#

as in only sync guild slash commands?

clever wraith
#

I meant as in we won't have to decorate every single slash command upon dev, instead make it '' automatic ''

#

Even though, decorating is also fine IMO

#

Which is why it's there

#

It's a a ready to go solution

vale ibex
#

we might want to have global slash commands some times

#

like sir-lance the bm delete app command wants to be global

fading galleon
#

we should decorate IMO

vale ibex
#

so using the guild_only decorator where needed is likely better

clever wraith
#

Agreed

fading galleon
#

Also we need an error handler for app_commands

#

shall I make an issue about it?

fading galleon
# fading galleon Also we need an error handler for app_commands

It is for bot#2424 the converter used to raise BadArgument error, now with slash commands it should raise TransformerError and for that I would need an error handler for slash commands, so shall I make another issue about it and with another pr for error handler or should I add the error handler in the pr I made for migrating source command?

dusky shoreBOT
fading galleon
#

Some directions will be helpful 🙂

clever wraith
clever wraith
#

If we ever were to opt for a more broad error handler, i guess we'll make it an issue

clever wraith
#

You can definitely post it now, and then discuss it there, but for the time being we only have one ( soon to be 2) slash command, so what you'll introduce is fine

fading galleon
#

alright thanks

slim widget
#

Anyone around currently to deal with a potential issue causing one of the filter rules to trigger frequently?

fading galleon
dusky shoreBOT
fading galleon
stable mountainBOT
#

bot/exts/info/source.py lines 65 to 70


# Handle tag file location differently than others to avoid errors in some cases
if not first_line_no:
    file_location = Path(filename).relative_to("bot/")
else:
    file_location = Path(filename).relative_to(Path.cwd()).as_posix()```
fading galleon
clever wraith
#

What I meant is that the jump url for tags doesn't work

#

Did you try that ?

fading galleon
#

fixed it nevertheless

clever wraith
#

Great, I'll test it later

#

Did you push the changes ?

fading galleon
#

Nope

#

Will do in 10mins

clever wraith
#

Oki

fading galleon
clever wraith
#

The link is still invalid

#

for /source return

#

Does that work for you ?

fading galleon
clever wraith
vale ibex
#

it's missing the bot/ prefix

clever wraith
#

yep

fading galleon
#

hmm wait that doesn't seem right

vale ibex
fading galleon
fading galleon
#

Also I think the pr should be shifted to high priority because of

#

!source return

stable mountainBOT
#

Sorry, an unexpected error occurred. Please let us know!

AttributeError: 'TagIdentifier' object has no attribute 'qualified_name'

fading galleon
#

I will add the error handler in 30mins and it should be ready for merge

clever wraith
fading galleon
clever wraith
#

Sure, but not a high priority bug

fading galleon
#

I mean it can be triggered easily

clever wraith
#

Bug priority relates to multiple things, like how frequent is it, but also to how critical it is to the user.
It doesn't menace the bot in this case, and does not hinder any other core functionalities.
The fact that it triggers easily will almost always be the case since we talk about commands (which render down to one step most of time) and not an entire workflow, so a single command will trigger a bug if there is one.

#

We still would like to reduce bugs as much as possible of course, especially when they're easy to fix

#

IT works great for tags & cogs, but not for commands

#

It's now giving me the path on my machine

#

The link is unfortunately broken, so it needs to be reverted

#

I can't look into this now as I need to run, but will have a look later

vale ibex
#

The conditional was added a long time ago, and might not be relevant anymore, looking at the PR is was added in

fading galleon
#

I found the problem with my code

vale ibex
#

Ahh right, so it needs to be relative too.

fading galleon
#

apparently command changed the original variable to some other thingy

vale ibex
#
if not first_line_no:
    file_location = Path(filename).relative_to(".")
else:
    file_location = Path(filename).relative_to(Path.cwd()).as_posix()
``` might do it then
stable mountainBOT
#

bot/exts/info/source.py lines 35 to 43

def get_source_link(self, source_item: SourceType) -> Tuple[str, str, Optional[int]]:
    """
    Build GitHub link of source item, return this link, file location and first line number.

    Raise BadArgument if `​source_item`​ is a dynamically-created object (e.g. via internal eval).
    """
    if isinstance(source_item, commands.Command):
        source_item = inspect.unwrap(source_item.callback)
        src = source_item.__code__```
fading galleon
vale ibex
#

Why do we think source_item isn't a good fit?

fading galleon
#

kind of verbose

#

do you agree or is it fine?

fading galleon
vale ibex
#

It's fine imo

#

could even be command_or_tag to be more descriptive to the user

vale ibex
#

Does it support cogs?

#

!src help_channels

stable mountainBOT
#
Bad argument

Unable to convert 'help_channels' to valid command, tag, or Cog.

#
Command Help

!source [source_item=None]
Can also use: src

Display information and a GitHub link to the source code of a command, tag, or cog.

fading galleon
#

!src HelpChannels

stable mountainBOT
#
Bad argument

Unable to convert 'HelpChannels' to valid command, tag, or Cog.

fading galleon
#

!src BotSource

stable mountainBOT
#
Cog: BotSource

Displays information about the bot's source code.

Source Code
fading galleon
#

it does but it has to be properly cased and we have to use the class name

vale ibex
#

Ah cool

#

cog_command_or_tag maybe?

fading galleon
#

yea thanks

static canyon
#

Reminder that bot-core#137 exists, and is blocking other issues & also fixes a bug in the re-run logic of !eval. Would appreciate reviews 🙂

dusky shoreBOT
fading galleon
vale ibex
stable mountainBOT
#

botstrap.py line 162

config_str += f"webhooks_{webhook_name}.id={webhook_id}\n"```
vale ibex
fading galleon
vale ibex
#

all of the webhooks

fading galleon
#

shall I just change it for incidents?

fading galleon
vale ibex
#

ok and can you restart the bot and show me the error?

vale ibex
#

that shouldn't affect it

stable mountainBOT
#

bot/constants.py line 265

EnvConfig.Config.env_nested_delimiter = '_'```
fading galleon
#

just chaning the incidents to _ fixed it lemon_thinking

#

but now get another error :(

vale ibex
#

I can't run my bot right now so can't investigate a fix. I can look later unless Bella/someone else gets there first

gritty wind
#

Please follow the getting started guide

#

You need to configure the site url still

fading galleon
fading galleon
#

and I have included API_KEYS_SITE_API=badbot13m0n8f570f942013fc818f234916ca531 in .env

vale ibex
#

you're running the bot locally though right?

fading galleon
#

yess

gritty wind
#

The env key for site is wrong

#

You’re setting site

#

It’s supposed to be

vale ibex
#

docs are wrong

gritty wind
#

Site_api

vale ibex
#

it's supposed to be URLS_SITE_API

gritty wind
#

Yeah we have a few things we need to update

fading galleon
#

mhmmm

gritty wind
#

Btw you can set those manual variables in a .env file

#

Idea being it’s easier to see the things you configured manually

#

And it doesn’t get overwritten in the future

clever wraith
#

bot#2457 should do that

gritty wind
#

Could you update the site PR

clever wraith
#

Yes yes, I'm catching up on what's happening

gritty wind
#

👍

fading galleon
vale ibex
#

add /api to the end of the site api url

fading galleon
#

Also the server template is wrong

#

it doesn't has help channel as forum channel, although can like forum channels be added in template server itself? Because I think they require to be community server

fading galleon
#

@clever wraith after bot#2457 because its giving me error

fading galleon
clever wraith
#

Yes yes

#

I'm making a PR for that right now

fading galleon
#

ah cool

fading galleon
clever wraith
#

It's not related to httpx

#

It's related to the way it's trying to pick up webhooks

fading galleon
#

so how will that be fixed?

clever wraith
#

If you want a temp fix for now, change the nested delimiter to "__" and in your .env.server, have it like this: wehooks_duck_pond__id

fading galleon
#

in the message

clever wraith
#

thanks discord for making me look like a fool

fading galleon
#

lol

fading galleon
#

only this works

clever wraith
#

Can you try checking out to bot#2459 & test it ?

dusky shoreBOT
clever wraith
#

. --> __

fading galleon
clever wraith
#

Sweet

#

Thanks for testing

fading galleon
#

~~Also I needed to manually add these

urls_site_api="localhost:8000/api"
urls_snekbox_eval_api="http://localhost:8060/eval"
urls_snekbox_311_eval_api="http://localhost:8060/eval"
redis_use_fakeredis=True
urls_site_schema="http://"
urls_site_api_schema="http://"

Can't we atleast automate redis_use_fakeredis, urls_site_schema and urls_site_api_schema?~~

#

oh wait it would be different on production right?

#

yea sorry

fading galleon
gritty wind
#

They’re automatically set in docker compose

#

Not fake redis, but site api and stuff

#

I think you’d only really need bot token to run in docker

cold island
fossil veldt
#

hm? how does that work

#

if I fix it is it okay then?

cold island
#

If I push to your branch it won't count me as a reviewer

cold island
fossil veldt
#

oh okay lemme take a look

cold island
fossil veldt
#

how would I go about adding the emoji id

clever wraith
fossil veldt
#

oh ok

#

I think previously we only had the name in the constants.py and the id was in the config

#

this makes sense 👍

clever wraith
#

Yes, and they were mapped thanks to the YAMLGetter metaclass

#

Pydantic kinda does the same

#

It's just that providing defaults is easier

fossil veldt
#

@cold island merge conflicts should be fixed now. Just need to remove the do-no-merge tag after merging snekbox#159

dusky shoreBOT
fossil veldt
#

the snekbox pr is backwards compatible with the current bot as well so it can be merged / deployed at any time

#

the bot PR is not compatible with current snekbox though, must be merged after snekbox

cold island
#

@fossil veldt did you accidentally push your local docker-compose?

fossil veldt
#

huh weird

cold island
#

(just force push if you did)

fossil veldt
#

I accepted upstream

#

but yes it appears so

cold island
#

yeah you also have a weird blank commit

fossil veldt
#

if I pull again won't it pull all the previous conflicts as well

cold island
#

I'm guessing it was added in the merge commit