#dev-contrib
1 messages Β· Page 179 of 1
yea not sure if it will change anything
fwiw ```
chris@mercury:~/src/pixels$ sudo docker version
[sudo] password for chris:
Client: Docker Engine - Community
Version: 20.10.17
API version: 1.41
Go version: go1.17.11
Git commit: 100c701
Built: Mon Jun 6 23:02:57 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.17.11
Git commit: a89b842
Built: Mon Jun 6 23:01:03 2022
OS/Arch: linux/amd64
Experimental: true
containerd:
Version: 1.6.6
GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
runc:
Version: 1.1.2
GitCommit: v1.1.2-0-ga916309
docker-init:
Version: 0.19.0
GitCommit: de40ad0
chris@mercury:~/src/pixels$ docker-compose version
docker-compose version 1.25.0, build unknown
docker-py version: 4.1.0
CPython version: 3.8.10
OpenSSL version: OpenSSL 1.1.1f 31 Mar 2020
yeah, it's getting stuck with experimental too
hm, my docker compose is 2.6.1
it also doesn't even show the other details, like docker-py version
with docker alone the versions do match exactly
sec, installing v2
yeah, the server is on 1.26
where it did work, so it might actually be docker-compose issue
chris@mercury:~/src/pixels$ ~/.docker/cli-plugins/docker-compose version
Docker Compose version v2.6.1
built it fine
that's so weird then
chris@mercury:~/src/pixels$ ~/.docker/cli-plugins/docker-compose version
Docker Compose version v2.6.1
chris@mercury:~/src/pixels$ ~/.docker/cli-plugins/docker-compose build
[+] Building 28.1s (12/12) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 921B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 176B 0.0s
=> [internal] load metadata for docker.io/library/python:3.9-slim 0.0s
=> [1/7] FROM docker.io/library/python:3.9-slim 0.1s
=> [internal] load build context 0.1s
=> => transferring context: 231.38kB 0.0s
=> [2/7] RUN pip install -U poetry 12.2s
=> [3/7] WORKDIR /pixels 0.0s
=> [4/7] COPY pyproject.toml poetry.lock ./ 0.0s
=> [5/7] RUN poetry install --no-dev 14.8s
=> [6/7] COPY ./gunicorn_conf.py /gunicorn_conf.py 0.0s
=> [7/7] COPY . . 0.0s
=> exporting to image 0.8s
=> => exporting layers 0.7s
=> => writing image sha256:e487c225216fc1a11379b3d924e7b0511e1e357f852752652ccc5e97b5a23e68 0.0s
=> => naming to docker.io/library/pixels_pixels 0.0s
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
this is the exact output for me, with --progress=plain: https://paste.pythondiscord.com/rolokicexe
there were some weird retry issues with pip install -U poetry
could you remove --no-dev from the dockerfile and try to build again?
what's the holdup of using forum channels here?
tried that before and it didn't help, but yeah sure
We have no way of testing it without testing in prod re: forum channels
you could use forum channels for #event-discussion tho
there's no difference between normal threads and forum threads
Admins and devops have a policy of not testing in prod. We don't have forum channels on any of our test servers
this is the output of that: https://paste.pythondiscord.com/gapunabaqu this time the retry prints weren't there, but it still got stuck at sniffio
ok
I'm just saying there's no difference between the two kinds of threads from an api perspective lol
code will work with both
We cannot test it with the exact same code because within the framework we're using it has to be different code. Although a lot of the code will be similar, it won't be exactly the same.
ok so, I managed to actually get past build when I did this: ```dockerfile
Install project dependencies
COPY pyproject.toml poetry.lock ./
RUN poetry export > requirements.txt
RUN pip install -r requirements.txt
when installing the dependencies through pip there are no problems, it only hangs when going through poetry install
machine/OS specs? which repo? (mostly just curious)
there are a few things that yeah, i'd just resort to pip installing
it's python-discord/pixels, and I run arch linux with 5.18.10-arch1-1 kernel
oh this is in the docker build process..?
which was supposed to forever alleviate our "it works on my machine!" problems haha
yeah lol
wild
@frozen galleon build without cache
I did
you need poetry 1.1.14
all versions before that version are now not really useable
the thing is, this should just pull in latest poetry
and it works on another machine with the same dockerfile
This is just a heads up to let everyone know we merged a backwards incompatible change to PyPIβs legacy JSON API today. This change makes it so that the JSON responses from pypi///json does not contain the releases key, which listed the files for every single version of that project on PyPI. Weβve been debugging intermittent crashing on PyPI (t...
FROM --platform=linux/amd64 python:3.9-slim
# Set pip to have no saved cache
ENV PIP_NO_CACHE_DIR=false \
POETRY_VIRTUALENVS_CREATE=false \
MAX_WORKERS=10
# Install poetry
RUN pip install -U poetry
# Create the working directory
WORKDIR /pixels
# Install project dependencies
...
the dockerfile just installs poetry with pip install -U poetry that should pull in the newest version
here I even print out the poetry version which got installed, it's 1.1.14
and yet it still hangs on sniffio
create a program and inform if the number is in the alphabet, is alpha, is numeric or is alphanumeric
Im trying
But that progr is hard to create
program
help me
im learning phyton from youtube
ask in #python-discussion or an available help channel ( #βο½how-to-get-help )
@outer oasis um, should bot/exts/fun/fun.py -> _get_text_and_embed not have an underscore / be private?
because it's being used publicly in uwu
https://github.com/python-discord/sir-lancebot/blob/main/bot/exts/fun/uwu.py#L130
bot/exts/fun/uwu.py line 130
text, embed = await fun_cog._get_text_and_embed(ctx, text)```
also, is there a reason these aren't static methods? https://github.com/python-discord/sir-lancebot/blob/main/bot/exts/fun/uwu.py#L63
bot/exts/fun/uwu.py line 63
def _word_replace(self, input_string: str) -> str:```
So...
A guy that had never used Python decided he didn't like the way this command worked, so he learned just enough Python to rewrite it.
And... then he quit.... so I finished the review comments, and then we merged it.
_get_text_and_embed was already there, from the original implementation
I don't even know where it's from. I tried searching both python-discord/sir-lancebot and Rapptz/discord.py and I didn't get any results
yeah the whole ctx.bot.get_cog sort of breaks IDE suggestions after that 
is there a reason for that at all? Can't fun.Fun(Cog) be directly imported and referenced?
like I don't know how much refactoring I'm allowed to do here π
I personally don't quite understand the repo at that scale yet
But I think that'll break it because it's loading the actual object in runtime [or something like that]
Hi Chris
The red names are here to save us
import typing as t
if t.TYPE_CHECKING:
from bot.ext.fun import Fun
...
fun_cog: t.Optional[Fun] = bot.get_cog("Fun")
that fixes type hints
yup I was thinking of exactly that
can I add that in my fix?
bot/exts/fun/fun.py line 154
async def _get_text_and_embed(ctx: Context, text: str) -> tuple[str, Optional[Embed]]:```
nah, you need to get the instance of the cog, not just a static reference to the func
I was right!
I love it when that happens
be warned I have no idea what the correct name for the cog you're talking about is, so don't trust this to just work
You got the right one
Ah, so it would be from bot.ext.fun.fun import Fun
thrice the fun
looks like exts
yea that's right
the original usage was in a walrus, so added it here
fun_cog: t.Optional[Fun]
if fun_cog := ctx.bot.get_cog("Fun"):
is that fine? Or should it just be assigned on the first line, and if fun_cog: after
if you're doing that, then you might as well remove the walrus
Yea, just assign it on the line above
the lines
[137] fun_cog._get_text_and_embed
[141] fun_cog._convert_embed
are still accessing protected members though
should the fun_cog functions be renamed? or...
probably shouldn't be marked as local like that if they're being used in other places
Hmm
According to my search, the function is only being used by the one command
Could it just be moved inside the uwu cog?

well the function body actually calls static methods within Fun
Can I please get approval for bot-core#100
Thanks π
Would you like to take a PR or two back from up for grabs?
https://github.com/python-discord/bot/pull/2089 such as this one
Yes
Yep, I'll take back my PRs if they're up for grabs. I'm currently on holiday (get back home on Saturday) so may not get done for a bit though
That's alright, I hope you enjoy your holiday!
so the ones that you've re-obtained are bot#2031, bot#2089
Cool, thanks
and also if you really want to go back in time, sir-lancebot#919 still exists
Could you reassign me so that I'll get an email for reference (if you haven't already)
We were gonna close that one. Had a brief discussion with someone about that ages ago
I've assigned you to the issue/PRs (in bot) previously mentioned
Nvm, was thinking of the wrong PR
Feel free to reassign me to this one too
it is done
Thanks
To-Do: bot#2031 bot#2089 sir-lancebot#919 sir-lancebot#1074 bot-core#100
Edit: also bot#2168
.bm
there's only 2 PRs that you have on bot rn
Like I had an issue which I was helping on for being able to specify end time in reminders on @stable mountain
...why aren't these in the same order as @static canyon' original message?
They never have been π€·
y
Because they get put in a set to ensure there's no duplicates
Fair enough
If we really wanted there are other way to check duplicates π€·
Could be nice I guess
Feel free to write an issue if you'd like to @outer oasis
list(dict.fromkeys(some_list))
!remind 4d12h write an issue if no one else has
Your reminder will arrive on <t:1658052532:F>!
sir-lancebot#1076
Perfect, thanks
Do we need approvals for bug fixes too?
I believe so
RE bot-core#100: Is there a preference as to whether the new converters.py file in bot-core should be at botcore/converters.py (following structure of bot) or botcore/utils/converters.py (following structure of sir-lancebot)?
Personally, I prefer the utls sub-package, if only for organizational purposes - I dislike having things in the roots of projects
Yeah, I prefer /utils too
I'll go for that then π
It's been a while since I did dpy and can't quite remember how the signature of converters works. I know it's async def convert(self, ctx: Context, argument: str): but would argument here actually be Optional[str] since the idea is that you do one thing or another depending on whether argument is actually provided?
Or would I need to do the logic in the command's argument typestring i.e. text: Union[str, RepliedMessageContent]?
sir-lancebot#1077
thanks
I actually forgot that existed
I've only had someone mention it to me once... it might actually have been you
Nice! Does it work with animated emojis too? (and still work with default) @fossil veldt

so um, I had to use a class method
I wasn't sure if I should use futures annotations or a string representation?
you need it on 3.10, and the bot doesn't run on 3.10
Lance made it to 3.10?
no but delayed evaluation is still optional in 3.10
if it's a file with commands future annotations can potentially break things, but I usually use those
Dockerfile line 1
FROM --platform=linux/amd64 python:3.9-slim```
Yeah, 3.9 still
like if you wanted to reference that class itself in a classmethod return result, even in 3.10 you need the future import
I guess I'll just use strings for now, since I don't see any other module use future.annotations
Hey, I'd appreciate reviews on sir-robin#50 it's not top priority, but would be a nice to have feature.
re: https://github.com/python-discord/sir-lancebot/pull/1077#issuecomment-1182558632
What does it take to get a new dependency added?
You just add it to the dependencies, via poetry add
For reference see: https://github.com/python-discord/sir-lancebot/pull/988
The emojis package was added.
Sorry - What's the review process like?*
Nothing special, I just add it to the same PR?
Hey, so I've forked and cloned lancebot, and when I try to run the bot with docker, I get ```
sir-lancebot | /usr/local/bin/python: No module named bot
I think you have to launch it with the directory set in the project?
the python -m bot is failing I assume, somehow
so um, sir-lancebot#1078 should be ready for review. Not sure if there's anything else I have to do 
also was there a reason we have this version of discord.py pinned?
https://github.com/python-discord/sir-lancebot/blob/main/pyproject.toml#L10
pyproject.toml line 10
"discord.py" = {url = "https://github.com/Rapptz/discord.py/archive/45d498c1b76deaf3b394d17ccf56112fa691d160.zip"}```
Dpy 2.0 is not stable yet. We use a specific commit of 2.0 alpha since following commits might have breaking changes
okay, I was just wondering since our pinned version strongly requires aiohttp < 3.8.0 which has known security vulnerabilities which are fixed since 3.8.0
specifically HTTP header injection https://github.com/aio-libs/aiohttp/issues/4818
could we possibly upgrade aiohttp without changing our pinned discord.py version?
Does a newer version of dpy use aiohttp >= 3.8.0?
requirements.txt line 1
aiohttp>=3.7.4,<4```
Then we should upgrade the dpy version. We don't use slash commands yet so I don't think it'll be too bad
what version of dpy is that archived version?
It's a specific commit, you can find it if you use the hash
Ah okay. Should I create an issue for the dpy upgrade?
Actually it seems the Python bot is already on the a newer verison of dpy that allows aiohttp < 4,
so it's just sir lancebot that's on the older version
https://github.com/python-discord/bot/blob/main/pyproject.toml#L11
pyproject.toml line 11
"discord.py" = {url = "https://github.com/Rapptz/discord.py/archive/0eb3d26343969a25ffc43ba72eca42538d2e7e7a.zip"}```
yea there's a lot of moving parts to bumping the d.py version
I've got a branch open and slowly chipping away at it
ah okay cool, I understand π
bot#2168 is available @static canyon if you want, though I think I saw you already picked up some other work
Idm adding it to my list. It seems easy enough; just a case of removing the embed and adding the timestamp, right?
yup i think so
Yeah, that's fine. Please reassign me. Thanks for following up on this π
@vale ibex I was looking into your PR. Currently compose up would start all the containers, including cloning the behemoth 3.11 image. Instead, I found this https://docs.docker.com/compose/profiles/, which allows you to specify that the 3.11 shouldn't be enabled by default. That way people will only clone it if they want the 3.11 eval
I've asked the owners to reinvite you to github, I'm guessing that's still pending. please write a comment on the issue then someone should be able to assign you (right now it doesn't let me)
er how?
heyo i know some react and was an unlucky user that got bit by a form submission bug which i fixed by going incognito but i would like to take a stab at fixing it or getting some context around it?
Heyo
So the issue lies with our refresh logic. Right now we're using stateless JWTs, which are refreshed in certain scenarios (when a user submits a form, or every 7 days). Since this token is saved as a cookie on the backend, the frontend bases it's state on a cookie that's saved on the frontend. The bug is caused by the frontend token not being refreshed when the backend one is removed, so we end up in a state where the frontend thinks it's logged in, but the backend does not
To address this, there's a fix, and a rewrite. The fix is to update the frontend token whenever we update the backend one. Since the update on submit is done by the backend and is invisible to the frontend, the backend has to do this. The rewrite is to ditch the stateless tokens, and use an opaque auth system
If you want to work on this, let me know. I'll create a GitHub issue, and can help you get set up
let me try i have done a few react apps but havent really messed with auth in detail like this but if i get more acquainted with the process and make some headway i'll give it a good try
Right yeah, I have to either comment or be part of the org to get assigned. I'll try and doing one of the two asap but it may not be until Sunday as I'm on hols
what if the frontend could react when its invalid and actually prompt for re-signin
It does react by throwing up an error page
If you'd like to handle the case when the error is a login issue and prompt the user to log in, you're welcome to
I'm working on other issues atm
very cool, added that
@outer oasis um, do you know if I need to request a review for sir-lancebot#1078 or is it just good to leave there? I don't think I have permission to request reviews or assign myself to the PR 
You generally ask for reviews here
I can assign you
who can I ask π³
We generally donβt assign PRs, but itβs not a big deal
Do the bots run on 3.10?
yep
pyproject.toml line 9
python = "^3.9"```
oh. not all bots
Are you sure?
Just the eval

bot#1879
I'm sure that I am wrong lol
snekbox is 3.10
Just waiting for that final project to become active again then π
which one
delaying the evaluation of an annotation complicates things as it has to go through the globals
hiredis-py
is it possible to alias the inventories in the docs command?
as in, !d numpy.save may be aliased as !d np.save
I guess we'd just need to add the docs again but under the name of np
If that works
RE bot-core#100: It's been a while since I did dpy and can't quite remember how the signature of converters works.
I know it's async def convert(self, ctx: Context, argument: str): but would argument here actually be Optional[str] since the idea is that you do one thing or another depending on whether argument is actually provided?
Or would I need to do the logic in the command's argument typestring i.e. text: Union[str, RepliedMessageContent]? And if this, what would argument be?
The converter takes a string and returns something else. If it can't be converted to that thing (e.g the converter raises an exception), and the argument is optional it'll skip it, otherwise the command will fail
You can't use Union[str, <anything>] though. An argument will always successfully convert to a string, since it's already is
You can switch around the order
The idea here though is you do something when the argument isn't provided. So there's nothing to pass to the converter
Adding duplicate docs won't achieve aliases, and has already been done erroneously
Some kind of replacement of np to numpy on missing symbols would probably work
The only thing I can think of that works is defaulting to None and then inside the command have an if arg is None: get_replied_message_content()
But then that doesn't use a converter, and means bot-core#100 is actually redundant
I think I'm missing context here
.uwu
i think i'm missing c-context hewe
.randomcase
Your input was invalid: text is a required argument that is missing.
Usage:```
.randomcase <text>
uwu allows you to reply to messages instead of providing an argument
randomcase does not, but I'm writing a PR so that it does
In the issue for randomcase, @serene flare said about using a converter to save repeated code inside the commands that have this logic
mmm
lol
But from what I can tell, a converter actually doesn't work here? So we need to instead have a util function?
Almost* - Owner Chris when?
yeah I'm trying to figure it out
did i ever mention my name is Chris?
close enough
I thought it was...
Are you memeing or are you serious?
i will submit the proper documentation after being made owner
I'm 80% sure I know your GitHub and it starts with a "C"
Since you're both here @wild prism @cold island is there any moderation concerns regarding this, or should I just make it ephemeral? https://github.com/python-discord/bot/pull/2089#discussion_r811486432
I think ephemeral should be fine?
But you seem like a good person, so why not
πͺ§ @wild prism for <@&267627879762755584>
Unless @vale ibex can find a way I think this is the way to go
We can just rebrand bot-core#100 to be a util function then
Instead of a converter
Since it'd still be useful for both bots to have access to this in my opinion
I don't mind either way
Is the clean_content we have now a converter or a utility function?
It's from discord.ext.utils
Or from dpy and a function (not a converter)
Correct
hmmm are you sure it's not a converter?
I think it is
functions can serve as converters
probably not thinking about it, since we stil want the converter to run if the arg isn't given, which doesn't happen
could make it a convertor and call it manually, but at that point you might as well just make it a helper func
yeah
hmm. I'll raise an issue and see if aliases is something we actually want
You're absolutely right, it is
discord/ext/commands/converter.py line 891
class clean_content(Converter[str]):```
But I don't suppose that really matters?
ah so it's a class with snake case, of course lol
yeah lmao
doesn't too much, it just can be used in function signatures
I'm assuming we want this new function to go in the /utils dir, but what should be the name of the file? messages.py, commands.py?
I think commands is more fitting personally
Should this util function raise a BadArgument directly? Or is there some reason to leave that within the command itself?
Raising within the util function makes typing cleaner since it'll always be -> str
I suppose that's not a good idea actually
def convert_to_cleaned_text_or_reply(ctx: Context, text: Optional[str]=None) -> Optional[str]:
"""
Attempts to retrieve a string argument from a command invocation runs `clean_content` on it.
Returns cleaned content of `text` if given, otherwise content of referenced message.
If neither are applicable, returns `None`.
"""
clean_content_converter = clean_content(fix_channel_mentions=True)
if text:
return await clean_content_converter.convert(ctx, text)
if (
(replied_message := getattr(ctx.message.reference, "resolved", None))
and
isinstance(replied_message, Message)
):
# `text` wasn't provided, but we have a referenced message with content we can access,
# so return `clean_content` of it
return await clean_content_converter.convert(ctx, ctx.message.reference.resolved.content)
# No text provided, and either no message was referenced or we can't access the content, so return `None`
return None
```Can anyone think of a better docstring / function name? I'm struggling a bit 
clean_text_or_reply?
since we aren't really following a format for docstrings, the two sentences seem redundant
It's just been really explicit as to what happens
as in, they both more or less say the same thing
Yeah, I suppose
Attempts to retrieve a string argument from a command invocation
Not sure this is quite accurate to what's happening
Returns cleaned content of `text`, if given, or the content of the referenced message, or None otherwise
perhaps this?
Yeah, that seems better
wait. is this lancebot? isn't that on 3.9?
Yeah, it is
IDR if walrus works on 3.9
If you're thinking walrus that's 3.8
Yeah, 3.8
Returns cleaned version of
text, if given, else referenced message, if found, elseNone.
Does this seem good?
sounds good
Cool, thanks π
Do you have an opinion on this?
It's a util that's only ever gonna be used inside commands, so I think commands.py works
hmm. not sure. I've yet to go through sir-lancebot's directory structure, but in general, yeah. commands.py sounds alright
For what it's worth this is strictly speaking for bot-core
I.e. can end up being used in both sir-lancebot and bot
I usually decide if a name is good from an import perspective
bot-core#100
Can someone help me with all the failing checks on bot-core#101? I don't really understand them 
it looks like netlify exceeded a github api rate limit in fetching the build artifact? 
dont worry about it, rate limits causing failed netlify previews are a known problem and not your fault
is netlify not making an authenticated call to the github api?
site#728
the github build fail though I will take a look at later
oh, I think you have to add to botcore/utils/__init__.py
I think that already exists?
Oh, do you mean add the commands.py file to it?
I'll do that tomorrow if I get round to it, thanks
!remind 20h
Your reminder will arrive on <t:1657909375:F>!
!remind 20h bot-core#100 impact on !remind
Your reminder will arrive on <t:1657909444:F>!
stringified annotations is the same as delaying the evaluations lol
I'm so confused. I'm trying to merge main into an old branch on site, the pyproject.toml and poetry.lock contain httpx, I run the site through Docker
Did you rebuild the image? docker compose build / docker compose up --build
hah yea the dev volume gets me like that too
you get so used to your changes just appearing that you forget it doesn't cover deps
I started searching the start up sequence of the container looking where it's installing the deps π₯΄
:P
I never said it wasn't. If you apply the future import to a file, every annotation will need to be evaluated if the contents are needed at runtime, if that file has commands it needs to be taken into consideration
would it be possible to add me to the page, or send me a copy or something?
for some reason my backend assumes pydis is the guild it is configured for
so yeah, that doesn't really work out
okay I just read the source code lmao
although I do not remember how you get an admin token
does it check for a specific role on the server
self.admin = await database.admins.find_one(
{"_id": self.payload["id"]}
) is not None```
hmmmm
Mongo π
that needs staff perms for access
weren't you staff?
some time ago, yeah
okay, it was a POST to http://localhost:8000/admin_dev/
but still forbbiden
auth is still done through the token cookie?
π
Scaleios can probably help
that seems like you do need it
gah, that was it
admin should bypass that ngl
it would make testing much easier
hmm, snekbox is refusing to run, which is sadge
forms-backend-snekbox-1 | 2022-07-15 13:58:50,071 | 8 | snekbox.api.resources.eval | ERROR | An exception occurred while trying to process the request
forms-backend-snekbox-1 | Traceback (most recent call last):
forms-backend-snekbox-1 | File "/snekbox/snekbox/api/resources/eval.py", line 87, in on_post
forms-backend-snekbox-1 | result = self.nsjail.python3(code, py_args=args)
forms-backend-snekbox-1 | File "/snekbox/snekbox/nsjail.py", line 190, in python3
forms-backend-snekbox-1 | cgroup = self._create_dynamic_cgroups()
forms-backend-snekbox-1 | File "/snekbox/snekbox/nsjail.py", line 96, in _create_dynamic_cgroups
forms-backend-snekbox-1 | (mem / "memory.limit_in_bytes").write_text(mem_max, encoding="utf-8")
forms-backend-snekbox-1 | File "/usr/local/lib/python3.10/pathlib.py", line 1152, in write_text
forms-backend-snekbox-1 | with self.open(mode='w', encoding=encoding, errors=errors, newline=newline) as f:
forms-backend-snekbox-1 | File "/usr/local/lib/python3.10/pathlib.py", line 1117, in open
forms-backend-snekbox-1 | return self._accessor.open(self, mode, buffering, encoding, errors,
forms-backend-snekbox-1 | PermissionError: [Errno 13] Permission denied: '/sys/fs/cgroup/memory/snekbox-7280839d-efd8-419f-af5c-12e999653e06/memory.limit_in_bytes'
okay
the unittest behavior doesn't match what I would expect though
did the schema change
soooooooooooo
I bypassed the unittest again? 
open a modmail for it
I'm not overly concerned because we are doing a manual review of submissions, and any bypass does stick out like a sore thumb
but hey if we can protect against it why not
but yeah it's not critical
I don't think it can be fixed, but hey, sure
It should, but I didnβt think of a clean way to do it because of starlette scopes
Coincidentally I did come up with something this morning
Is there a reason the Python bot does github snippet embed and Sir Lancebot does issue/PR embed? those seem like very similar features and having 2 different bots respond seems kinda wierd.
Wasn't done intentionally, someone PRd the github embed snippet and we didn't really remember about the Lancebot issue/PR feature, so they got split even though they're related. @vocal wolf is this something we want to unite?
for uniting
now for the hard question, which bot do they get united under?
let's do a poll!
@dusky shore
Utility functions not required for the server don't go in @stable mountain
Ask me a hard question
!poll "This poll may not matter, because Xith is our overlord, but let's vote anyway! Which should the github related stuff belong?" "Sir Lancebot" "Python" "other???"
π¦ - Sir Lancebot
π§ - Python
π¨ - other???
I'd also vote for !charinfo being on @dusky shore
Except we keep tangential functionality like !remind in Python because it's so ubiquitously used by staff for server-running operations
who's the contrarian π
mmmmm, good point good point
I'd be okay with everything needing a connection to site staying in @stable mountain
charinfo occasionally comes up in moderation
Keep the contributor friendly @dusky shore away from our datas
datas 
C, we make a new bot, call it Sir Git
thanks
We can't make an entire bot for two functions
What else should he do?
sounds like a plan
Elixir and you've got a deal
Microservices for days
How many days?
about 2 or 3
What do we rewrite into after that?
cobol, then it lasts forever
do you even have to ask? π¦
and I'm not sure why it needs to be taken into consideration because the library handles stringified annotations
the globals at definition time and when it's called may differ, it has already caused problems on the bot
Yes, do the unite. Into the sir lance it goes.
the blessing has arrived!
sir-lancebot#1079
thanks
Here's your reminder: oh, I think you have to add to botcore/utils/__init__.py
[Jump back to when you created the reminder](#dev-contrib message)
Here's your reminder: bot-core#100 impact on !remind
[Jump back to when you created the reminder](#dev-contrib message)
bot#2031, bot#2220 and bot-core#101 are all needing reviews if anyone is free π
There's also sir-lancebot#1077 and sir-lancebot#1078 that were done by other members.
Does this block the PR from being merged? The netlify checks are still failing.
Have added the file to the __init__.py and it fixed it; thanks π
A teeny-tiny PR, sir-lancebot#1060 requires review, if anyone is willing 
it does not, the only downside (not for this but for site) is that any frontend changes have to be ran locally to review
Right, I see. So doesn't impact other than reviewing site PRs
@outer oasis were you wanting to implement sir-lancebot#1079? If not I'd like to claim it
Hey Tizzy, if you don't want the PR to be merged then maybe consider keeping it as a draft instead. I'd consider code untested by the author as not ready for review.
I am not
Please go ahead and claim it
Ah yes, completely forgot that was a thing, I'll go ahead and make them drafts π
I'll just hover around it for now to see how you do it; I'm still learning about these bots
Hmm, not sure I can actually since I've already created the PR. Is there a way to change? @cold island
@outer oasis showed me π
I imagine it'll pretty much be copy-paste, with the odd extra bit. I won't be implementing it tonight, but will do so over next few days hopefully
Ah yes
Thanks
Fyi I think only core-devs are supposed to assign people to issues @outer oasis
That could be wrong though
I don't think it matters in this case, but certain issues require certain access etc. to properly implement
right, right
Just to be safe, can a core-dev please confirm I can work on sir-lancebot#1079?
you can't just put up signs everywhere :P
Um... I'll take them down as soon as you promote me?
you gotta get your contributions beyond lancebot for that core dev nom =P
do you want to clear some of your pending PRs before getting assigned to more?
could you start by bringing your draft ones to be ready for review?
Hmm, I should do some contribs again
Unless there is still a large review backlog?
Reviews are a nice change of pace
Anything worth looking at in priority?
If youβd like, Iβve got a PR up on site to fix the static preview issues
Itβs pretty chonky
I have a simple-ish Sir Robin PR as well, it's mostly components and API reqs..
I just need to test them, which I can't do until I'm back home (later today)
But they should all be okay since there wasn't any big changes
I'll get that done tonight/tomorrow hopefully
3 of my assigned ones just need testing and reviews, 1 I'm needing some help (someone requested something I'm not sure how to do), and another one I'm working on in the background
the !paste command says "... typing ctrl + S ...", i think it should say "... pressing ctrl + S ..." instead since you dont "type" key combos. i know this is an extremely minute issue but i thought id bring it up anyway
Could anyone assign/confirm that I can work on bot#2222?
(also, let me know if I should add anything else to the issue description)
Ideally please add content to the body so itβs clear whatβs going to be happening. Something like:
Allow adding embedable media to tags as per meta#β¦
Iβm not sure what it is youβre going to be doing here
of the two approaches to make meta#187 possible, I thought adding support to embed media in the tag responses would be good idea.
But i donβt know what youβre actually suggesting here π
For instance, how will a tag with a video look like?
Look like in the code base*
I get that youβre trying to add videos and images to tags, but how are we actually going to go about doing that
Will the tags have text and videos, or will it be the tag system with just videos
If itβs the former, will the code read the MD tag, find links, and embed them, or is this going to be a meta field
ah. okay
tbh I actually haven't thought about that π
I'll explore the possibilities and add them in the issue
Please do, Iβll happily go over what you come up with when itβs ready
Hey @tawdry vapor, or anyone else familiar with our bot locks. I'm trying to refactor this check:
https://github.com/python-discord/bot/blob/main/bot/exts/utils/snekbox.py#L371-L376
To a lock instead, as per Mark's comment https://github.com/python-discord/bot/pull/2218/files#r920551227
I added @lock_arg("snekbox.run_job", "ctx", attrgetter("author.id"), raise_error=True) to run_job() but it isn't raising an error if the same author tries to run multiple jobs. Am I using the deco wrong?
bot/exts/utils/snekbox.py lines 371 to 376
if ctx.author.id in self.jobs:
await ctx.send(
f"{ctx.author.mention} You've already got a job running - "
"please wait for it to finish!"
)
return```
That should work fine, but I'm not sure if the command is a good fit for the decorator, at least with its current structure where it waits for the job to be reevaluated
That's a good point, only the send_job should have a lock really
hmmmm, even the logs within the lock module aren't being output to console
tried it locally and it seems to work fine here
bot muted me but there were evals between those https://i.imgur.com/6jQoNgK.png
unfortunately bots embeds can't have videos (https://github.com/discord/discord-api-docs/issues/1253#issuecomment-564794170)
would it be a good idea to rework the tags command to send a media link instead of an Embed for tags with, say, media: true in their metadata?
perhaps, an embed with the content as description plus a media link?
I think this sounds fine
Do you know who created the gif?
I vaguely remember first seeing it from fix
not really. it's also an mp4
also, which one do you prefer a link instead of an embed or an embed + link?
Iβm trying to figure out the logistics of sending it. If we just have it as media, with no copyright and no info, I donβt think I can recommend using it in good conscience
hsp & laundmo
Alright, in that case I think we should ask them for input on the matter before making a decision on ^. If they allow us to just send it as is, I think itβs best to just send the video directly. If they ask us to credit them in some form, I think we should add an authors meta field, and have the bot send the video as well as text under it saying By: β¦
I donβt think we should send just a link. That would it make it pretty easy for this to break
sounds good
we could also just convert the mp4 to a gif
I'm actually trying just that, but IM is taking some time with it
but the attribution issue still remains
@placid ermine @whole forge (sorry for the pings)
could you confirm on this?
im like, severely lacking context. whats the topic?
The gif/video that illustrates functions and returns that you helped with, we want to embed it into a tag
ahhh, okay
We just want an ok from both of you, since it's your content :)
im 100% fine with sending as-is. the code to generate it is actually MIT https://github.com/laundmo/manim-code (yes ik crappy repo) if you want to change/regenerate it
im fine too
Cool, cool. The approaches mentioned so far sound fine, Iβll leave the approach and media format up to you. The more I think about it, itβs probably good to add the authors field either way, if we end up using it for future media, but you donβt have to add it in this PR
How does @stable mountain generate a command for each tag?
It doesnβt necessarily generate a command
But the error handler for CommandNotFound
Checks if any tag names match
btw is there a faster way to test changes than reloading the cog everytime you make a change?
not really, but !c r tags is about the shortest you can do
cool cool cool
Itβs how we power the !shhh and !e''' commands as well. Pretty cool
!int e the tag in, should just take a path
Like how the src command displays bot source, is it possible for a command that shows the python source code of input be made?
The reason we can show our source code is because itβs, a. all in python, and b. its location at run time is itβs actual location. This means that we can easily convert a class or variable or function to a location
That isnβt easy to do with python. We might be able to get some of the symbols that are implemented in python to work, which would include most of the stdlib, but a lot of python is C. The version of python we run is also not going to match the latest python version on GitHub, because we arenβt building from source, so weβd realistically only be able to link things we currently can see
https://github.com/python-discord/bot/pull/2218/files#diff-e9a79ed03c460ed1cf9b0b5c6a7f2e322c84808392b452b5aa31b03189ba0d43 this should probably live in bot-core come to think of it
Ultimately I think youβre better off just searching the python code base
GitHub has a new tool for searching code. Iβve tried it with cpython and itβs pretty good. That still in beta though
Warning, treated as error:
C:\Users\chris\src\bot-core\botcore\utils\interactions.py:docstring of botcore.utils.interactions.DeleteMessageButton:7:py:class reference target not found: discord.enums.ButtonStyle
this is annoying
I'm guessing this isn't part of their objects.inv
I forget, was there a way to manually link to docs?
Since ideally I could just link to https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ButtonStyle
Ah style (:literal-url:`ButtonStyle <https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ButtonStyle>`): The style of the button. seems to have done it
does just discord.ButtonStyle not work? instead of discord.enums.ButtonStyle
Nope, sphinx always auto resolves to the verbose name
oh
at least with the setup we currently have
not sure if that can be changeed
bot-core#103
Included screenshot of changelog and docs in PR, in case netlify doesn't build
Will review later today.
Itβs not, no. Conversely, when generating your docs it generates to the verbose location by default
welp. the GIF is > 2 MB even when optimized with gifsicle π¬
122KB version
actually, use this one, it has the first 2s skipped
ffmpeg -i .\printreturn.mp4 -ss 2 -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif fwiw
ffmpeg π
The ancient magicks
@gritty wind Did I mess up the changelog? π
I'm missing the joke here I think lol
Lol just meant that if the review was 30 minutes later it would be out of date
nah dude we use UTC around these parts
well, we use whatever tz is the most convenient to back up our points
This is true too
We are in all time zones
Hah
!!!!!!!!!
nono, the fix is to update everywhere else to be consistent with this
As long as we agree itβs volcyβs problem
agree agree
@tawdry vapor await interaction.response.defer() is a thing that means we don't need to use a task for run_job
very cool
indeed
Found another fun error if the user edits code, click the re-run emoji and then very quickly clicks the Run in X button before the message is deleted
solved with a suppress on the interaction.message.delete()
The lock arg covers stops actual job from running
Why do you need to defer?
because there are wait_fors listening for message_edits to re-run code
and those block the run_job call from returning until the timeout
So the callback on the button doesn't return until the timeouts on those are finished
the interaction is only ACKd by d.py after the callback returns
mmm the view should be a separate task no?
it doesn't break anything, it just means user's get the interaction failed error since d.py didn't responsne in time
not sure what you mean
I think I'm not following you
when you click the button to Run in X version the button callback calls Snekbox.run_job
which starts a new job "session"
that session doesn't end until all the wait_fors are done
why not?
because bot.wait_for blocks that thread
so the run_job call doesn't return until those are done
Oh the callback leads to a call that does wait_for because of the option to edit, and that means the interaction doesn't end so it doesn't show the result or something?
The interaction never "ends" until all those wait_fors finish yea
of course it outputs the actual code output etc
so the code is output and the timers start for editing code
but we never ack to discord, since the run_job call doesn't return
so discord thinks the interaction failed
i see
So everything still "works" regardless, there's just an "Interaction failed" error shown to the user under the button
We initially got around that by putting the run_job call in a task
but by using defer we don't need to
what is the actual interaction result though? sending a new message?
Yea
And it still fails despite there being a result because it takes too long?
that's done via the original context though, rather than through interaction.response
because it was easier to make the interaction pass the context than change all the output to use ctx.send or interaction.response
depending on the source of the call
ok. I won't nit pick because it's only until 3.11 becomes stable, but it sounds like it deserves some refactoring
yea, the issue atm is that a "sessions" can be started via a command, an edit or an interaction
and after a session is started, a new job can be spawned from both and edit or an interaction
an it can swap between them
so the interaction would still need to pass the context, otherwise it wouldn't be able to listen for edits, at least afaik
I guess we could pass the whole Interaction object from the interaction to run_job
then it has access to original_message()
but yea it needs refactoring to support that, or else it'll be messy
Ya know, we could keep this for future versions we add too
Yea, it would be nice to do this each release
If you want to make it clean, I donβt see why we couldnβt even make it a permanent thing
so it likely could do with a nice refactor
Carry some prominent versions
"Run in 2.7"
3.7,3.9,latest
lol
The way the code works right now with the re-eval is pretty neat, but if you're doing something like that I would dismantle it.
Thinking about it, even in the refactor we likely still want to defer, since we can't respond until after the code is eval'd, which could take long enough for the interaction to timeout
How long does it take an interaction to timeout?
Not sure exactly, all I can see in the api docs is it said you should respond "promptly"
dunno how feasible this is, but can't you respond right away but lock the interaction until after the eval is done?
that's essentially what defer does
it tells Discord "I acknowledge your interaction and will followup later"
ah. okay
Yea, so not long enough for snekbox then
guess I missed that part :P
It's no big deal though, we can still to interaction.followup.send
It doesn't really matter in that case
yea, it's just an extra api call to defer
Then your current solution is the simplest probably
jsyk: webm compresses better than gif and at a better quality. might be worth doing that instead of gif.
pretty cool, down to 63KB
just depends on whether it goes nicely into an embed like gifs
aye webm is how people are able to post full length movies within discords 50mb limit
lol
gifs have the (dis?)advantage of being auto play
Ah yea true, I always forget that since I have autoplay off
suprising you havent run into that actually, its a issue on other servers since obviously copyright
I think we had 1 or 2 people post morbius when that was going around, but nothing since
!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
I feel like the the eval job response should indicate with which version it was run.
rn it's not a big deal because there's just 3.11b4 and 3.10 as the choices, but if we want this for testing newer versions later, it will be needed anyway.
The version can be deduced from the button text
I don't foresee it supporting more than 2 versions
(fwiw my first guess was that it was run in 3.9, before i tested w sys.version)
maybe the "Your eval job has completed..." message could be changed to "Your Python 3.10 job has completed..."
I had the same suggestion
We should also delete the buttons when the interaction times out
(we can extend the timeout too)
does not seem so. webms don't work in embeds π₯²
the compressed GIF works just fine though
Since it reposts the result instead of editing it, after some time the conversation will flow better if the user just runs the command again
We can also make the result reply to the invocation though
Yea, the timeout of the view will be shared between the delete and the rerun too
bot#2224 ended up being a tiny PR, but I learned stuff about d.py
I think the tag's focus should be on the animation itself, since !tags return already explains the difference between print and return, but lemme know if the tag description needs more elaboration.
@vale ibex, re: https://github.com/python-discord/bot/pull/2224#issuecomment-1186534116
during testing, I deleted the original message containing the GIF, and the CDN link still worked.
i think it might eventually stop working
And I don't think discord makes any assurances with its urls
As long as the original message exists I don't think it will
If it's uploaded somewhere reliable, discord should still be handling it with its cdn, but in the way it was designed to
Yea the CDN keeps it around for a while
fair points. I'll create a subdirectory under the resources directory named media and add it there
@vale ibex did you want to do an announcement for the "hey, we're running 3.11 beta to help test this beta version!" thing?
Yea I think we should, maybe after bot#2225 is merged
We're planning a larger announcement around 3.11 in admins
2022-07-17 22:28:34
2022-07-17 22:28:34 | botcore.utils.scheduling.HelpChannels | WARNING | Failed to unschedule 776184661902491678 (no task found).
2022-07-17 22:28:33
2022-07-17 22:28:33 | bot.exts.help_channels._cog | INFO | Moving #help-lemon (776184661902491678) to the Dormant category.
2022-07-17 16:22:16
2022-07-17 16:22:16 | botcore.utils.scheduling.HelpChannels | ERROR | Error in task #776184661902491678 140677048063888!
Log labels
app bot
container bot
filename /var/log/pods/default_bot-85b7fb85cb-4mrpn_0b988acf-6b05-45ad-a863-b23eea8b8371/bot/0.log
job default/bot
namespace default
pod bot-85b7fb85cb-4mrpn
pod_template_hash 85b7fb85cb
stream stdout
Detected fields
ts 2022-07-17T16:22:16.718Z
tsNs 1658074936718796669
i don't know if this helps but i pulled the logs@brazen charm
Howβd you even get kube logs lol
prob through grafana
the bottom of that code block is the loki metadata
Right
is the error traceback there?
uhh not that i know of, i've only see tracebacks in sentry errors
We do get tracebacks in grafana too, but Iβm pretty sure the help channel issues donβt have tracebacks most of the time
Part of why itβs so damn difficult to debug
ah right
i know we probably don't want to drop the logging level bc then our current service logs will be hard to sift thru, but is there a way to send lower level logging to.. a separate log?
We can already set logging level per cog, but I donβt think thereβs anything interesting
herm was looking to test bot#2225 but hitting errors when running !eval
so far i've tried docker-compose pull which worked fine, and
β€ docker-compose up --build
ERROR: Service "snekbox" was pulled in as a dependency of service "bot" but is not enabled by the active profiles. You may fix this by adding a common profile to "snekbox" and "bot".```
the error i got on my test server before attempting this:
Sorry, an unexpected error occurred. Please let us know!
ClientConnectorError: Cannot connect to host snekbox-311.default.svc.cluster.local:80 ssl:default [nodename nor servname provided, or not known]
i'm just gonna delete it all and restart
You gotta change that config URL to the service name if the bot itself runs in Docker, or to localhost:8065 otherwise
I think 8065 is the port. You can check docker compose yaml for the exact value
i typically just run site in docker and run bot locally, but atm running the whole thing in docker gives me the above
Then use the docker compose service's name as the host for the url
it's probably called snekbox-311 or something
And then add the port at the end
mk idk if i'm doing this right
in my config.yaml
snekbox_eval_api: "http://localhost:8060/eval"
snekbox_311_eval_api: "http://localhost:8065/eval"
then docker-compose up web snekbox snekbox-311 and python -m bot
Yeah that looks right
the snekbox container would have more logs on what the error is
probably going to bed soon but this is what i pulled from docker desktop https://paste.pythondiscord.com/quhileqeja
Does that error mean the clone syscall was given an invalid argument? That would be weird.
Maybe your image is out of date? Try docker compose down and then docker compose pull
Only reason I could think of that happening is the host's kernel being out of date. But given you're using Docker Desktop you're probably not on Linux so I didn't think that could be an issue.
i'm on mac
is that intentionally with no hyphen?
The newer version of docker compose lacks a hyphen for the command
if you don't have it available then you can use the hyphen for the old version it shouldnt really matter in this case
same error, same logs
Do both 3.11 and 3.10 have the same problem
yes
Thats identical to your previous screenshot
Do you know how to open a shell in a running container
I want you to run uname -a to figure out what kernel version is being used
yeah i would have to look it up
docker compose exec -it snekbox /bin/bash
β€ docker compose exec -it snekbox /bin/bash
root@95648ad171ec:/snekbox# uname -a
Linux 95648ad171ec 5.10.104-linuxkit #1 SMP PREEMPT Thu Mar 17 17:05:54 UTC 2022 x86_64 GNU/Linux
All the flags being passed seem to be supported by clone on that version
Maybe some other arg is invalid
i can try again tomorrow on a windows machine. you suspect it could have something to do with my machine?
It's a weird error so I'm not sure. Would be nice if someone else on a mac could test
Yeah I think so. It worked for me on Windows, and of course works in prod and CI tests on Linux. You could try updating Docker Desktop if it isn't already.
There are a whole bunch of possible reasons for errors here actually. The error in the log indicates it was EINVAL https://www.man7.org/linux/man-pages/man2/clone.2.html#ERRORS
Most of them don't seem relevant given the flags being passed, but it could be one of these ```
EINVAL CLONE_NEWIPC was specified in the flags mask, but the
kernel was not configured with the CONFIG_SYSVIPC and
CONFIG_IPC_NS options.
EINVAL CLONE_NEWNET was specified in the flags mask, but the
kernel was not configured with the CONFIG_NET_NS option.
EINVAL CLONE_NEWPID was specified in the flags mask, but the
kernel was not configured with the CONFIG_PID_NS option.
EINVAL CLONE_NEWUSER was specified in the flags mask, but the
kernel was not configured with the CONFIG_USER_NS option.
EINVAL CLONE_NEWUTS was specified in the flags mask, but the
kernel was not configured with the CONFIG_UTS_NS option.
tested on windows machine and it works perfectly
I see. So it could be one of those errors above. But I don't know of a way to check kernel flags within a container, nor how to check it when using Docker Desktop.
that satisfies my curiosities for the night lol. i imagine not being able to test this on mac shouldn't be a blocker though right?
Correct.
i've also just tried again after updating to Docker Desktop 4.10.1 (82475), same behavior
We can actually control which flags are used but since these flags work in production we shouldn't disable them I think.
However it does mean if you really wanted to know you could do a bisect to figure out which flag is the culprit
sure i can try that
tomorrow (for real tomorrow)
edit: maybe tomorrow tomorrow 
Developers not having macs, and broken Mac apps. Name a more iconic duo
#community-meta message
Question from #community-meta - Why did we switch from GitLab to GitHub?
answered there π
FWIW snekbox eval errors with this in debug mode
2022-07-19 06:41:13,508 | 9 | snekbox.nsjail | WARNING | [1] bool mnt::mountPt(mount_t*, const char*, const char*)():209 mount(''/lib64' -> '/lib64' flags:MS_RDONLY|MS_BIND|MS_REC|MS_PRIVATE type:'' options:'' dir:false') src:'/lib64' dstpath:'/tmp/nsjail.0.root//lib64' failed: No such file or directory
2022-07-19 06:41:13,508 | 9 | snekbox.nsjail | ERROR | [1] pid_t subproc::runChild(nsjconf_t*, int, int, int, int)():466 Launching child process failed
2022-07-19 06:41:13,508 | 9 | snekbox.nsjail | WARNING | [11] pid_t subproc::runChild(nsjconf_t*, int, int, int, int)():486 Received error message from the child process before it has been executed
2022-07-19 06:41:13,508 | 9 | snekbox.nsjail | ERROR | [11] int nsjail::standaloneMode(nsjconf_t*)():272 Couldn't launch the child process
2022-07-19 06:41:13,508 | 9 | snekbox.nsjail | INFO | nsjail return code: 255
Looks like an unrelated error
Why would lib64 not exist
Are you on a 32 bit system
what's the compat flag 
--platform linux/amd64 alongside your docker run
I just did docker-compose up -d
and it doesn't look like that has a platform specified
you can edit the compose to add it as well
under the service add platform: linux/amd64
interesting
btw this was just to confirm that it breaks in Docker for Mac. it works just fine on my Linux box
yea doesn't surprise me, it'll definitely be something ARM related, not super sure what we can do about it
without the platform option, it does build a linux/arm64/v8 image
hello! small PR adding a tag. no blockers AFAIK π¬. bot#2224
(for context: <#bot-commands message>)
it looks like the .challenge Lancebot command is not working.
the command uses bs4 to scrape codewars's search results, so a change to the website may have broken it
should we at least disable it for now?
Itβs fine to keep it loaded for now (itβll load again when lance restarts anyways)
If someone wants to raise an issue, we can start working on a fix
I think the default config cannot accommodate for different host OS so we just have to set it to what works for us in prod. Thankfully it's configurable if someone wants to run it on something else. But there will still be some casualties for people wanting to test things, and besides keeping around instructions for how to tweak the config, I also think we cannot do anything.
Can I get a review on code-jam-template#6
Do you actually need to update it? Isn't it the year of first publication?
I thought it was always supposed to be the current year
We generally donβt update our licenses no
License law is vague, but our in house lawyer has said we shouldnβt
I don't have any actual specifics
That being joe
Either way, Top Notch PR, thank you.
It passes linting, merge β
There is no linting, merge β
Yea, the date in a license is generally the date of publication
In the case of work which is continually updated, (for example a web site), the year of publication may be shown as a period from first publication until the most recent update, (i.e. 2000-2020)
we just choose not to, as that's a lot of things to update each year
Some people go for 2000- but as with all things licensing YMMV
What's the review policy on repos without a review policy?
For example https://github.com/python-discord/code-jam-template
cc @patent pivot
For the CJ template, since we had two events team members work on it, I took a look and joe reviewed, that should be fine. This isn't a high stakes thing so it's fine
wellll
We do need to be careful since people will be using it in their project
iirc we had to announce to people how to fix something that didn't work last year
Yeah, I'm not saying we don't need to be. We just don't need to go hunt down core dev reviews or things like that.
Since joe already reviewed it doesn't matter either way, but maybe we should have some policy if we're gonna use it in future jams
So
do we maybe want to make the poll command use buttons
we'll be able to let everyone use it then
Yea, we could move it to a channel lock, rather than a role lock in that case
Why does reactions vs buttons affect who can use it?
Will need to engineer it a bit to make it have the same level of freedom as with reactions, but it should be possible
reactions are added one by one and are rate limited
Yea, I'd see a button on there that can only be use by the invocker/mods to end the poll
which will remove the buttons and tally the score
That same rate limit is shared with other commands that use reactions such as anything with pagination
So.... if too many people make polls at once, @stable mountain will get stuck?
Yes
I see
I recall @thorny obsidian wanted to make it a slash command
I pretty sure Kat had a PoC for it
But making it use buttons should be relatively simple
Yea
the only non-trivial part will be having separate interaction checks for the end poll button to the option buttons
I imagine it will just be getting the button being pressed in the interaction check
We want an end poll button?
imo yea
how were you seeing the votes being totalled?
Not directly related, but can the buttons be made not so huge compared to reactions? I've though that it'd be better for the ux to have buttons everywhere for things like deletion, but they also take quite a bit of space
no :(
buttons are chunky and there's nothing we can do about it
The embed could show the result in real time like we can see now with reactions
Or is that not something we want
that would require a message edit call for every press though
I've disabled reactions a while back and the bot became a bit more difficult to use. A command for the reaction interactions also came to mind, but that's not very discoverable and takes up even more space when actually used
They're pretty cheap
But yeah we could have a button to end it and then display the result
I do also wonder if we'd get into a problem with idempotency if we were to edit on every button press
if many came in quickly
depending on how the coros fall
it would be correct eventually though IG
since the internal total would be atomically incremented
yeah we can just not do that if there's worry
But it should just be slower
Do edits and sends share the same rate limit?
But you're right, there's no need replace one rate limited set up with another
we could implement some debouncing on updating the message
shouldn't be to difficult
if we really wanted a live update
yea, not sending an edit for every press, but delaying if there are many at a time
Yea
yeah that's possible
I'm not sure how great it is for responsiveness though
and the timeout on the view would control how long the poll stays up for
Might not be the best UX if you press the button and it takes a bit to update
I was thinking like 0.5s debouncing
it doesn't need to be crazy
just a standard timing on when the message updates, rather than updating based on presses
to avoid two triggers conflicting
The downside is that it has an end time. If you want to have a poll that's open for a day you can't do that because the bot will restart
It could be a persistent view
the timeout could be a command arg
Reactions have the advantage of the user being easily able to see their current vote(s), imo they're better than buttons for our current internal use.
oh boy the architecture keeps getting fatter by the minute π
persistent views don't add any code :D
it's just a case of setting the timeout to be high
d.py abstracts it
Could just make an ephemeral message that says it
just need to give a good customID on the button
You've got to register it apart from setting the timeout to None, which could add additional complexity.
Do we not need to store it in the db?
nah
it's just 1 LoC on bot startup to add a listener
ok I guess I don't know how they work at all
That still feels more messy than the current solution.
&src cj announce
A command to send an announcement embed to the CJ announcement channel.
the only thing I can see causing a problem with not persisting is as wookie said we'd lose what each user voted for across bot reboots
which could cause double votes for long-standing polls
It seems like custom ids are not compulsory.
bot/bot.py line 59
self.add_view(JamTeamInfoView(self))```
That still feels more messy than how it works currently. I don't see any advantage to buttons other than making the command available to more people, which I haven't seen a use case for other than now for code jams.
So I'm not really feeling it's worth the change currently
it does allow for anonymous voting, I'm not sure if that's a use case we have atm though
In the examples it is recommended to set one, whilst in the docs it says: It is recommended not to set this parameter to prevent conflicts.
The biggest downside for me though is that buttons are very big compared to emoji, especially if we want >5 options
So it's not the same view? how does it relate the existing button to the new view?
What about dropdowns? π
d.py generates an ID for each button, which discord includes in the interaction
so d.py knows where to throw the interaction to
the IDs being unique across all views and buttons
But why does adding this view make the button use it
You created a new button object
yea, it'll have the same id as the previous one though
it doesn't use the literal id func
it's an id generated by discord.py to be the same across restarts
yea
you can specify your own as needed, but d.py does a good job at generating them itself
I'm not sure then why the examples on github recommends to set it to be custom then.
Would be very weird to me to let it generate it itself
If I have several views for example
Could we port the poll command to sir-robin and put on usage limits to prevent running into rate limits?
We do have a bunch of views in Sir Robin's CJ ext, but dpy does it job well even with a bunch of views.
We could port it to sir lancebot and add a bucket
It still doesn't sound like something I would want to trust. If I had several views of the same class I would have to be careful with the order I register them in on start up and rely on the order to be consistent
But, if you have several views of the same class, you would only register it once.
I... would?
Yeah, I registered the announcement view once.
Then sent like 5 of them to the announcement channel
and worked pretty well
but
What if you wanted each to have different attributes
Well? They do? π
How? you supplied only one view object
Yes, when I load up the cog, I registered an instance of JamInfoView, and then when someone calls cj announce it actually sends this view to the announcements, and starts listening on interactions.

