#dev-contrib
1 messages · Page 14 of 1
We run the same command in prod, so it should work https://github.com/python-discord/snekbox/blob/main/deployment.yaml#L30-L34
deployment.yaml lines 30 to 34
- "/bin/sh"
- "-c"
- >-
PYTHONUSERBASE=/snekbox/user_base
pip install --user --upgrade```
actually, I guess you could try adding --user
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?
no, it can be in any other way, open to suggestions
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
tbh after this we really should just make snekbox support multiple python versions
no reason to have 2 containers and endpoints when we can just install multiple python versions in nsjail
yeah, from a user's perspective this might be a bit difficult if they have to know they need to put it inside a specific folder
other than that, I only found one small bug
How you got the helpers role?
see #roles
Bro I know that but I have some personal questions
Personal??
Not sure what "personal" means in this context... though #ot0-psvm’s-eternal-disapproval would be the appropriate place
Lmao like how much did he actually contributed and in which channels was he most active and like that
I was being kinda sus ngl
this is still not the right channel for that though #dev-contrib channel is here for developers to contribute to the python-disocrd organization on github
I know I am sorry
@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
that might be kind of weird since the cwd won't be in the same place as the python file
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
This pr has been open a while, any thoughts on it? https://github.com/python-discord/sir-lancebot/pull/1148
alright I think I have that working now in snekbox
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
I'm ok with that
@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)
how's this
- By default, your code is run on Python's 3.11 beta release, to assist with testing. If you run into issues related to this Python version, you can request the bot to use Python 3.10 by specifying the `python_version` arg and setting it to `3.10`.
+ By default, your code is run on Python 3.11. A `python_version` arg of `3.10` can also be specified.
(not ignoring, just can't address every pr. I'll let someone else reply if they're available)
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.
voiceverify
This is not the right channel for that, please refer to #voice-verification to do it
thinks
Anyone wanna work on some project?(I don't have an idea in mind but we can think of one)
This channel is for discussions related to our open source projects only,
Ohh ok so which channel would be perfect?
There isn’t such a channel on this server
You might be able to share your projects on Reddit (r/python) but they usually are finished projects
If you wish to contribute to one of our projects, you can refer to this
!contribute
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
- Read our contribution guide
- Chat with us in #dev-contrib if you're ready to jump in or have any questions
- Open an issue or ask to be assigned to an issue to work on
Alright
hello im new to open source how should i start? i know some languages and git.
You can refer to the following if you want to contribute to our open source projects here in this Discord:
!contributw
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
- Read our contribution guide
- Chat with us in #dev-contrib if you're ready to jump in or have any questions
- Open an issue or ask to be assigned to an issue to work on
Oh haha it understood my typo
@timid sentinel this is the conversation I mentioned in the review comments
for bot#2403
My proposal is just one command, but the one chris replied to involved three. We can wait to see what others think though, the disadvantage with one command that I can think of is that the behaviour is a bit less intuitive, although I think the conciseness is quite nice.
@cold island @tawdry vapor what should we do if an uploaded file changes? https://github.com/python-discord/snekbox/pull/159#discussion_r1117886974
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
Hmm.. user provided files aren't handled in the bot PR so I haven't considered it
technically we just have main.py as the sole user providable file
currently at least
out of ignorance, how difficult would it be to track the last modified date of the files?
someone could technically write to main.py
maybe os.stat("file").st_mtime?
not sure if that is still there from nsjail
Seems to work
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
Oh I meant bot#2372 not 2327
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?
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
Okay, makes sense. Thanks
what do you think guys? to have 2 separate commands like
/tag get <name>returns the embed containing the tag info/tag getreturns paginated embed with all tags/tag listreturns paginated embed with all tags.
Or wookie's suggestion
/tag <name>returns the embed containing the tag/tagreturns paginated embed containing all the tags
I like the latter one
Yeah, using the timestamp is good enough if you have access to it. I think for snekbox in general it would be good to include modified inputs in the response.
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.
wookie's suggestion is simpler (less nesting) and avoids issues such as having a conflict if a tag is named get or list
the conflict with tag named get or list seems reasonable enough to avoid sub grouping the tag command 👍. Will implement wookie's suggestion then.
can someone help with setting up environment variables... i dont understand this thing
you are setting up which project(bot, sir-lancebot or site)?
sir lancebot
are you reading this page https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/sir-lancebot/#environment-variables
A guide to setting up and configuring Sir Lancebot.
yes, it gives a command to run but idk what to do next
have you created the .env file?
i just have to create manually right?
yes
no, you have to add all the variables present in the table in the link that I gave
those 7
Yeah
BOT_TOKEN, BOT_GUILD, BOT_ADMIN_ROLE_ID, ROLE_HELPERS, CHANNEL_ANNOUNCEMENTS, CHANNEL_DEVLOG and CHANNEL_COMMUNITY_BOT_COMMANDS
ok
CHANNEL_ANNOUNCEMENTS=12345 this is the format how each variable is to be added in the .env file
@clever wraith I committed again, If you can review/approve it because it still shows you are requesting changes
you can press the icon on the left of it to request a re-review
apparently I can I only request review from one person like that either be it wookie or shtlrs, if I click on both of them it prompts 'requested review from wookie and removed shtlrs'. Thats why I manually pinged on discord.
Sure, I'm reviewing it now
I see
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
cool PR ngl
would look even better with one more approval on it though
@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
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.
Sure sure, my comment should just be ignored
then plz do the needful
he is the author
banned.
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
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
instead of deprecate the text, you could make it a slash command that allows selecting a message
How would that work exactly ?
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
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 ?
Oh okay, I imagine sthg else
then upon receival
We already have a subcommand for that. Not easily discoverable though.
you can delete any of lance's DMs using bm delete matter of fact 😄
so the .bm command is deprecated, but .bm delete is the only way to delete bookmarks
intuitive ;-;
totally!
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
and if it is being removed, replacing it with slash is probably better
the app_commands don't disappear completely like they won't show in the autocomplete bar but if you type the whole name of command it reappears in the autocomplete list, I was also having this problem when I was migrating tags and decided to explicitly sync the bot however sometimes it would still happen
the issue I'm talking about is some clients not showing apps in the context menu when they right click a message
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)
any clients
any channels
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
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
so when will bot#2403 be merged it has satisfied the requirements?
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
ah okay
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
@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
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
@vale ibex Should we deprecate the text command ?
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
nice
Thoughts on including the tag name in the embed title now that the slash command doesn't give context?
like setting the title? or editing the markdown file itself?
yeah that sounds sensible. There are some still with a title as bolded text at the start instead of the tag metadata so we should probably make them all metadata too
Settings the title to the name of the tag
meta data seems fine, or just .replace('-', ' ') the file name
what should be the casing? I assume title casing?
if you look at dashmpip.md it actually shows you how to set the embed title with meta data already
sentence casing imo
but yea, as wookie said, there are a few that have pseudo heading using bold text, so that should be replaced
Good Example
It’s a string method, therefore it is completely and entirely valid
They wouldn’t add something invalid to the spec
No sir
I'm going to add random_case as a string method
Trying to normalize randomization smh
Everything must be well defined and repeatable
!e print("the title of a thing".title())
doesn't even make "of" and "a" lowercase 😔
@timid sentinel :white_check_mark: Your 3.11 eval job has completed with return code 0.
The Title Of A Thing
That wouldn’t be title case, it’s title case for people with commitment issues
Even made the function titlecase for you
Do you just have that on the ready
lmao
fast typer
preparations are made
Lol
so we are going with sentence casing right?
Yea
@vale ibex what about already title cased headings? shall I change it to sentence casing?
!contributing
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
- Read our contribution guide
- Chat with us in #dev-contrib if you're ready to jump in or have any questions
- Open an issue or ask to be assigned to an issue to work on
for example this
Yea, and make it a title, rather than a bolded part of the tag
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.
exciting
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.
That's pretty cool
bot#2419
@fading galleon such nice work on /tag, thank you!
and they have titles now!
Nice one
BeautifulWork @fading galleon !
I kept BeautifulRequest as my alias because BeautifulSoup and requests library as it was my first practical use of python i.e web scrapping
Ahahah, I just wanted to match my praising to your alias :p
yea 😄
#changelog message
Would've been cool if you mentioned the slash command: </tag:1079848585027399791>
which one?
thank
fixed
thank
@vocal wolf a wa
a wa
a wa
a qwa!
@desert imp did you mention you were no longer able to work on bot#2402 or am i misremembering?
wait we can mention slash commands? mind telling me how?
yes they did #dev-contrib message
#bot-commands message
interesting
What happens when someone tries to invoke it tho ? Will the bot take it to #bot-commands and mention the invoker ?
invoke what?
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
oh cool
U are not misremembering
Does anyone get this error, when running the bot in local https://paste.pythondiscord.com/negobaqotu ? I think its because the api is returning a list instead of dict
The api is supposed to return a list of tuple for the rules
!source pydis_site.apps.api.views
Unable to convert 'pydis_site.apps.api.views' to valid command, tag, or Cog.
!source [source_item=None]
Can also use: src
Display information and a GitHub link to the source code of a command, tag, or cog.
I thought it returns a dict because of this https://github.com/python-discord/bot-core/blob/69e52d3b68787789b8dc8a21d7ed5a2d8e527e12/pydis_core/site_api.py#L121
pydis_core/site_api.py line 121
async def get(self, endpoint: str, *, raise_for_status: bool = True, **kwargs) -> dict:```
pydis_site/apps/api/views.py line 133
return Response([```
You can have a look at the response starting from that line
Is your site image up to date ?
but it doesn't uses views.py If I understand correctly
how to check that?
What doesn't ?
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```
Which version did you build ?
the error occurred in this function
I don't remember the version but I did build it around July-September 2022
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
checkout main for bot?
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
once you'd done this docker compose down and then docker compose up
cool now the errors gone
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.
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
The button on the left of the test name allows you to quickly run a test (or class, or file, or suite, etc)
You just need to configure the proper working dir in the template and the button will work
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
Nah please don’t do that
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
template = run config ?
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
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
You might wanna do it for autodetect and pytest as well
Yep, it works
Sounds like you're trying to run as a file not module (equievalnt cli option: -m)
Very nice
Make sure your config looks like this
oh wow i didnt see there was a dropdown
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>
my bad thanks a lot🙈
nw
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
How would toggling multiple roles with select menus work? Buttons make it easy to select a bunch at once or deselect a bunch
Select menus let you pick anywhere from 1-n options where n is the number of total present options
Sort of like checkboxes rather than radio buttons
But how would they show you at a glance what you have applied? You need to click on it to expand the selection, no?
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
Does the select menu already come pre-expanded showing the selection without needing to click an additional element and scroll?
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
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
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
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
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
BTW do we want to put this to a vote or just nip it in the bud?
Trying to update to the latest botcore version, I get this error: https://paste.pythondiscord.com/ebudiquqom
Anything familiar?
When do you get that ? When running bot ?
Did you run config change ? Maybe the root dir ?

Have you updated your dependencies?
yeah I removed the whole env, installed anew
yes when running the bot
How are you running it ? From pycharm's native run buttons, or using poetry ?
pycharm
This usually happens due to the run config, at least that's when it happened to me
What are the overall maximums?
What is the total possible number of buttons and the total possible number of items in the multi-select?
Can you try running it with poetry ?
possible, I just merged a chunky amount of commits from main
25 total buttons, 125 total select items (25 items per select menu, 5 select menus total)
It's more linear
ah yeah, using a terminal worked
Yep, defo the run config

I don't see anything that would cause issues
Make sure to edit so that it runs the bot module from the root dir as the working directory
Screenshot?
Basically we fit 25 items in one neat row, which would otherwise require us to have a mess of 5x5 buttons that takes up the whole thing
I like buttons

That's why we love coding 😄
ok, thanks
nope.
Sadge
and now I somehow have a shadow instance of the bot running
Ah, does it automatically use all the roles in the server or?
... why?
found it
yes
The rest of my message broadly states why
there's no additional interaction being sent so I'm afraid I don't understand
Not discord interaction, an additional thing the user needs to do
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)
Oh rip
It's fine if you disagree with me. I was just stating my opinion and preferences
That kinda sucks, wish you could customize which roles you show
It's OK right now but I'm worried what happens if we add more
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)
Do select menus have a nice way to clear all?
[item.remove() for item in items]?
I mean, a discord UI feature that deselects all options in the select menu
Oh
don't think so
You're the bot bird
Why don't you know?
they support searching tho
Yup, scales well once again
well, on PC
What is this?
well once you click them the bot tells you the reason but i agree, i was confused as well at first
Yeah the mobile experience is a bit meh
which is ironic tbh
it requires an additional thing the user needs to do
So to get up to speed is there a push to change the way self-assigned roles are displayed and selected?
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)
Idk about "push" - I was just putting out an idea originally. Just felt like drop-down menus were more intuitive or "idiomatic"
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
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
or even just let them be assignable lol i still don't understand what the purpose is to not let them be assigned
But man, it'd be cool if role selects didn't auto populate
i understand why they don't but yeah
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
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
Can I be assigned to sir-lancebot#1219 ?
i think this would be really nice if/when discord allows restriction on which roles appear. it sounds like one of those things that they'll do eventually
Done sir-lancebot#1223
Do do the do 🥺
How about just regular strings for role names? The extra role metadata seems more like a QoL feature rather than a necessity (at least, for our usecase)
We could also just wait till more improvements to the select menus in general (such as restricting which roles appear, like you mentioned)
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
that was fast, did you test it?
ye i had it done yesterday
always test 
oh, lance
yup. not a fan of that either. What do you think about the original idea of just a regular string select menu?
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
pretty much just this. This is without the role metadata btw, so it's probably how our select menu will end up looking if we go for it
source: random google image
The buttons with their functionality are good but visually its just looks meh
Select menus pretty much have the same functionality
can you select multiple at a time? i don't see checkboxes
Just extra click downside, like kat mentioned
yeah, this one just happens to be select one
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)
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
I can implement the role select menu in one of the testing servers, and if we want to go forward with it, we can easily just commit to github & PR it
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
though yeah you're right, that should probably be a button rather than select
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
third time's a charm
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
write what?
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
ah I got confused by you saying sir-lancebot
Oh haha, that's for the bookmark command
I'm confused, you're already assigned to the bookmark command
Yeah, I have a PR for that atm
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
Oh sorry, that was in reference to role assignment via select menus
The bookmarking is a seperate thing, that's mostly sorted out
So you mean a fork of the bot
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
Could be nice, up to you of course
Okay, thanks. I'll do that 😁
Need some feedback on bot#2420 and bot#439
There's one for .kata
Or .challenge I think is the main name
oh right
I still sort of don't see the benefit for role selection tho, buttons seem perfect here for toggling.
not multi select tho
Oh I didn't realise there are different ones
checkbox (if it works well) is nice for toggling. the green/red signaling and wording always confused me
i'm getting a bunch of interactions failed in #sir-lancebot-playground even though the interactions appear to be working 
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
7 kyu
oh yeah, that's pretty cool
Yeah, sir-lancebot#1218 fixes that
nice i'll review this too
disnake
</notifications:958232691814334466>
lmfao nice job discord
nice, i quite like it
i stepped away from my computer so may not get to it (today)
@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.
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
We encourage them to edit the message with hastebin link so the long code becomes just a link, like its done with codeblock
and I have seen the codeblock embed being actually effective in the help channels for people to edit their message and include codeblock
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
Well if that's that then we can probably close the 3 year old issue.
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
@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."
there's probably a reason for that then I guess, seems wrong to store that in a db though
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
I guess it's a moot point if we're using url field though?
urlfield is like charfield + validation right?

https://stackoverflow.com/a/10052385
"If you see the URLField source code you will find it's actually a CharField with URL validator."
reading up that reason, it sounds very odd to me. It's basically saying having both "" and None isn't needed, so we just use ""
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
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

I think that comes only when setting blank=True for both the CharField and TextField classes, which in that case it defaults to an empty string instead of None (like for the rest)
bot#2001 and bot#2021 doesn't seems possible now as the head repo is private/deleted
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.
hi
Hello
@fossil veldt just so we're on the same page (do it in your own time ofc), https://github.com/python-discord/snekbox/pull/159 currently needs the file editing part addressed
@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
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
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
I think bot does that and puts a warning, although it's sort of easy to miss
yea, quite a few logs at startup 😅
:)
@timid sentinel for bot#2022, can't seem to reproduce it
yeah I'll probably get to it today, been busier this last week
no worries! just checking we're on the same page about what's left
tags were rewritten
its probably no longer an issue or something
check the diff
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
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
Yeah
Although I don't get why it works sometimes but not others
Even when reloading
initial load order iirc
there's no set repeatable order for cogs to load
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
are you on the most up to date branch becuz that could be it
Yeah I am
/shrug
I would try to break it on my bot and see what is the actual problem then
always love to solve bugs like these😋
Alright these should be ready now snekbox#159 bot#2326
output folder now defaults to the same as home, and files with existing names are uploaded if last modified != original
noice
I'll let @tawdry vapor and @timid sentinel verify their approvals on the snekbox pr
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?
yeah it has no effect on the bot atm, but the snekbox feature should be complete
though the .py file, after upload, would get a disallowed extension anyways
so if we were to allow file sending through the bot, it wouldn't be editable?
Path().stat()!!
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
I chmoded it to 0o777 like we do for home and it works now
though normally it would be
yeah, it's probably not a normal use case anyway though lol
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?
don't really see why users need to modify .ignore so it might be safer to have it as a config level thing instead
added these as default ignores https://github.com/python-discord/snekbox/blob/bytes-output/config/.ignore#L1-L4
config/.ignore lines 1 to 4
__pycache__/
*.py[cod]
*$py.class
*.so```
feel free to yoink
or rather
https://github.com/onerandomusername/monty-python/blob/9362625e8b3239c0e1f9959bc501d55bf1923288/monty/exts/info/codesnippets.py#LL30C5-L31C150
https://github.dev/onerandomusername/monty-python/blob/9362625e8b3239c0e1f9959bc501d55bf1923288/monty/exts/info/codesnippets.py#LL30C5-L31C150
sooo, should I change the default value?
Keep in mind the infraction field in the infra log may display a jump url, "Infraction issued in a ModMail channel." or "N/A" (if the infraction was issued before jump url field was added).
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
django/core/validators.py line 69
class URLValidator(RegexValidator):```
looks like it doesnt
at least the regex on line 95 doesn't
and I'm not sure if blank=True will affect it
I'll test with django orm later, I've got some other stuff to finish
Is this distinction useful for users? It'd be easier if we could just show N/A for both cases.
I don't like placing implicit meanings on values like null and empty strings, especially in a caae like this where both are allowed and both have different meanings.
Granted we're stuck with having to allow null since it's a new field in a table with existing records.
Good point.
If the infraction was issued in a modmail channel, it is most likely that the link to the modmail thread would've been appended to the infraction message. And I agree about the implicit meaning thing too, especially because I don't think I did a good job about documenting it.
Django ORM convention suggests using blank strings, but I'm guessing the project convention is to use null ( I haven't checked similar examples in the codebase yet)
( I'm not hung up on conventions 😛 - it's just that I haven't really used django ORM outside of pydis projects)
@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.
bot/exts/info/source.py line 86
elif isinstance(source_object, TagIdentifier):```
Hi @fading galleon, I sent you a DM yesterday, though I might be trapped in message requests 😄
It's not easy to tell which links are modmail threads once the links have been stored, right?
Oh I misread. Are you saying it would manually be appended by a mod?
yes, we usually add the thread link for context
Could the bot do that automatically as with other infractions not in mod mail?
it can, but it needs access to mongo
Why?
because that's where the thread link is stored
I'm talking about the logviewer, not a discord link
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
If you invoke an infraction inside a modmail thread, there's no meaning to storing the message link because the channel will soon be deleted. If we want to store anything it should be a link to the logviewer
So what's the point of manually linking to a thread currently?
Ok makes more sense. Sounds like it's fine to just show N/A for the link field in this case too
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
If a link is often manually included a attempt to extract it could be made
That comes back to connecting the bot to mongo
Sorry, how is the link being manually included?
I thought it's added as part of the infraction reason
Appended to what?
the infraction
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
it is
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
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
If it's still eventually ending up in the reason then it can be parsed upon retrieving infraction history
true
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
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
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
yeah unfortunately it generates some hash for the link
We could create a proxy service which has access to mongo and redirects us to the log link 🤔
Not a serious suggestion
But can we change the way it generates (new) links?
Is the log viewer a part of modmail?
it's a separate repo https://github.com/python-discord/logviewer
not sure it's what generates the links 🤔
core/clients.py line 603
return f"{self.bot.config['log_url'].strip('/')}{'/' + prefix if prefix else ''}/{key}"```
Not sure how I feel about making the log link resolvable
Why? Is this unauthenticated?
!help infraction append
!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.
we have some issues with the amount of CF seats we have, I'd rather not corner ourselves
What would CF have to do with this change
you asked about authentication
Oh so the answer was yes
yes it's authenticated
@ mark
but I'd rather keep the random string I think
Whats the advantage
Ty
that it may or may not be authenticated in the future
I think this might be the least intrusive/annoying solution
maybe even include it in the channel description
That does not sound like a great idea. We could implement another auth solution like Discord oauth. But I recognise that feature won't manifest itself out of thin air
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
yeah it's not a good idea 😄
yeah I like incremental improvements. Learned it the hard way with the filtering PR
Hi @sharp crag, can you address the comments and issues in https://github.com/python-discord/bot/pull/2316 ?
Can do, sorry that got stale. Got caught up with other stuff 😛
nw
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'
🤔
its pydis_core
Ah, yeah. Not sure why it's still on botcore for me
old branch? or you could have updated it locally, check git blame for that hunk.
As it is pydis_core on latest here https://github.com/python-discord/bot/blob/main/bot/exts/moderation/infraction/_utils.py#L6
bot/exts/moderation/infraction/_utils.py line 6
from pydis_core.site_api import ResponseCodeError```
Yeah, it's a really old branch 😛
Had to fix some merge conflicts, could've come from there
that might be it
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)
I did some cleaning. We have 25 seats free
Also put on a 2 month inactivity timer, so anyone that doesn't use their seat for 2 months gives it up
Awesome
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
@cold island actually, wookie was the first with that template
that's the joke 🙃
ah
@thorny obsidian What do you think about my last comment on bot#2423?
Let me take a look~
currently waiting for a core dev
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
Could a core dev please take a look at bot#2424 and give their thoughts? Thanks!
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."""```
bot#2423 is waiting for a core dev's response
@timid sentinel I have resolved bot#2022 with a different method while migrating source to app_commands bot#2446
@cold island while setting up my local bot, I found at least one minor bug with updated wordings.. can probably be marked "beginner".
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)
@grim prairie if you're working on the bot please open an issue about what you're planning
Right now I'm just going to be toying with the holiday idea from earlier. If It's all the same to you I plan to you first see if it's feasible and then open an issue
1.25.0
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
Yeah that did the trick
@cold island for bot#2450, do we never want to allow any slash command in DMs ?
It doesn't seem like we have exceptions for that for the text commands in the Security cog anyway
So i'm guessing not
Is the bm delete command a slash command or will it be a slash command?
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
That counts as an app command though, right?
I think so, the main difference is in the UX
So setting all app commands to guild only would prevent that from working
That's a good point, let me check it
bm is in lance not Python
But if it's moved to botcore won't it affect lance?
IT would, since we use bot core
Didn't see we were talking about moving it to botcore
let's keep it Python specific for now
I was asking the question of whether we'd want to do that
I see
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
We also need to add an error handler for slash commands in error_handler.py
this should be done with issue 2450 itself
I am interested in doing these after we find an absolute way for running global checks for app commands
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
I mean this person suggested the same too https://github.com/Rapptz/discord.py/discussions/9293, also its the only way too (can't remove embed currently on phone)
That would be nasty, either we should use @guild_only or subclass the CommandTree
Why can't we just use guild_only?
That makes sure the slash command isn't registered in DMs
guild_only doesn't responds if it fails unlike check failures
it won't even appear in DMs if it's marked as guild only
oh right
Indeed
So we can either do
- The subclassing as mentionned here
- In the bot class itself, override the method that loads the extensions and syncs the commands to make it walk those commands once synced and make them guild only
And for the subclassing one, we won't be overriding the interaction check method
Why not just mark the slash command as guild_only?
We want to centralize it I guess
as in only sync guild slash commands?
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
we might want to have global slash commands some times
like sir-lance the bm delete app command wants to be global
we should decorate IMO
so using the guild_only decorator where needed is likely better
Agreed
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?
Some directions will be helpful 🙂
Sure thing!
If it's a consequence of that change, I think that particular case should be handled in the same PR
If we ever were to opt for a more broad error handler, i guess we'll make it an issue
ok 👍
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
alright thanks
Anyone around currently to deal with a potential issue causing one of the filter rules to trigger frequently?
We are having a new filtering system bot#2390
@clever wraith https://github.com/python-discord/bot/pull/2446#discussion_r1130164681 how did you get that ouput from the bot it seems fine for me?
also the footer missing the bot directory is intentional https://github.com/python-discord/bot/blob/main/bot/exts/info/source.py#L65-L70
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()```
wait I think its that thing again with isinstance failing to detect TagIdentifier due to getting regiestered in sys.modules with some other namespace
It works
it was this thing again
fixed it nevertheless
Oki
Pushed
what does the embed content show?
it's missing the bot/ prefix
yep
hmm wait that doesn't seem right
which part?
The link returning incorrect and footer with \
its because of this
should be fixed
Also I think the pr should be shifted to high priority because of
!source return
Sorry, an unexpected error occurred. Please let us know!
AttributeError: 'TagIdentifier' object has no attribute 'qualified_name'
I will add the error handler in 30mins and it should be ready for merge
It's not really that important, i'm not sure if people use source on tags that frequently
Its still a big bug though which can be triggered easily
Sure, but not a high priority bug
I mean it can be triggered easily
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
try removing the conditional, and just always using file_location = Path(filename).relative_to(Path.cwd()).as_posix()
The conditional was added a long time ago, and might not be relevant anymore, looking at the PR is was added in
I earlier tried that only, it prompted this error https://paste.pythondiscord.com/ohedemijad
I found the problem with my code
Ahh right, so it needs to be relative too.
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
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__```
This also works, also we are changing the variable names either way https://github.com/python-discord/bot/pull/2446#discussion_r1130156445 so what should I go with?
Why do we think source_item isn't a good fit?
it would be like this /source <source_item:>
kind of verbose
do you agree or is it fine?
here we should change the parameter name to source_object
or cog?
Unable to convert 'help_channels' to valid command, tag, or Cog.
!source [source_item=None]
Can also use: src
Display information and a GitHub link to the source code of a command, tag, or cog.
!src HelpChannels
Unable to convert 'HelpChannels' to valid command, tag, or Cog.
!src BotSource
Displays information about the bot's source code.
it does but it has to be properly cased and we have to use the class name
yea thanks
should be fixed now @clever wraith https://github.com/python-discord/bot/pull/2446/commits/da7494664f94538847e3ec432065b5d36c905dde
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 🙂
@clever wraith I am getting error when running the bot with new configuration
Error: https://paste.pythondiscord.com/ravimosapi .env.server: https://paste.pythondiscord.com/resoxadagi
Ah, the .id here will need to be changed to _id
https://github.com/python-discord/bot/blob/main/botstrap.py#L162
botstrap.py line 162
config_str += f"webhooks_{webhook_name}.id={webhook_id}\n"```
for now you can fix it by changing all the .id in your .env.server webhooks to _id
It fixed incidents but
pydantic.error_wrappers.ValidationError: 5 validation errors for _Webhooks
big_brother -> id
field required (type=value_error.missing)
dev_log -> id
field required (type=value_error.missing)
duck_pond -> id
field required (type=value_error.missing)
incidents_archive -> id
field required (type=value_error.missing)
python_news -> id
all of the webhooks
shall I just change it for incidents?
you need to do this
ok and can you restart the bot and show me the error?
shall I restart docker too?
that shouldn't affect it
I'm not sure why you're getting that error, since this line suggests you need to use an _ https://github.com/python-discord/bot/blob/main/bot/constants.py#L265
bot/constants.py line 265
EnvConfig.Config.env_nested_delimiter = '_'```
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
I did heres my .env.server https://paste.pythondiscord.com/resoxadagi
A guide to setting up and configuring Bot.
and I have included API_KEYS_SITE_API=badbot13m0n8f570f942013fc818f234916ca531 in .env
you're running the bot locally though right?
yess
Site_api
it's supposed to be URLS_SITE_API
Yeah we have a few things we need to update
mhmmm
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
bot#2457 should do that
Could you update the site PR
Yes yes, I'm catching up on what's happening
👍
ahh now I have to change again lol
well I am back with another error https://paste.pythondiscord.com/ajifuqubuw
add /api to the end of the site api url
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
A guide to setting up and configuring Bot.
@clever wraith after bot#2457 because its giving me error
ah cool
I did install httpx manually while the pr gets merged, I am still get the same error
so how will that be fixed?
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
hmmm add backslashes where you used_
in the message
thanks discord for making me look like a fool
lol
not working same error
only this works
Can you try checking out to bot#2459 & test it ?
the dot here will have to be changed to a dunder
. --> __
sure
everything works
~~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
will add the error handler tomorrow or day after tommorrow(after my exam)
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
@fossil veldt I'd fix the merge conflicts on https://github.com/python-discord/bot/pull/2326 but I don't want it to discount my review lol
If I push to your branch it won't count me as a reviewer
yeah
oh okay lemme take a look
if you need help with the new setup check out #dev-announcements
is our server config not committed now then?
how would I go about adding the emoji id
I'm not sure i understand the first question.
If you added an emoji, you basically just need to add it to the _Emojis class
oh ok
I think previously we only had the name in the constants.py and the id was in the config
this makes sense 👍
Yes, and they were mapped thanks to the YAMLGetter metaclass
Pydantic kinda does the same
It's just that providing defaults is easier
@cold island merge conflicts should be fixed now. Just need to remove the do-no-merge tag after merging snekbox#159
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
@fossil veldt did you accidentally push your local docker-compose?
huh weird
(just force push if you did)
yeah you also have a weird blank commit
wait how do I just fix this one file again?
if I pull again won't it pull all the previous conflicts as well
git commit --amend
I'm guessing it was added in the merge commit


