#dev-contrib
1 messages Β· Page 155 of 1
and have it consistent across each bot
but that's more of an observation of the bots, rather than something that would block this change π
Ah yeah I agree
On this change though, what should I do with the existing issue/PR? Keep them or just start over? (bot#1977, bot#1978)
What is this site? https://github.com/python-discord/bot/blob/main/config-default.yml#L365
config-default.yml line 365
site_api: &API "site.default.svc.cluster.local/api"```
I'd just rebrand them (rename)
I'll delete my comment on the PR too since it won't be relevant anymore
π I was worried about undoing your feedback π thanks
No worries lol
I've done this myself multiple times (started a PR that then got completely changed xD)
Errr apparently I can't delete the actual review itself 
I'll just edit it to say it can be ignored
I think this is something related to docker hosted sites, right?
Based on the config, I'd say that's the site's API, I believe it's used for infractions and whatnot
Is it something that can be hosted locally?
It seems like I really should make my own version of invite filter as it takes me even longer to set that up
Ah yeah the bot might still just use the API in https://git.pydis.com/site
Hmm.. setting up that API just to have a good invite filter seems a bit too much of work for me
If you're just looking for an invite filter, hosting the entire @stable mountain bot might not be the way to go.
I was actually thinking just the API site as it seems to be only thing I would need to set up to make it work, and I alrd have @stable mountain setted up
Or I just have to make up smth else
You can leave the issue as is. You might want to close the PR and open a new one, although given it was just opened I'm fine with you force-pushing to the branch
The thing is, you need the API, which needs the Postgres DB, and then redis on bot. The bot also requires that your server is set up in a very specific way. The filters for invites doesnβt have to be very complex, you might be better off ripping out the code you want without using our system
Kaboom, much simpler. bot#1979
I'm nearly successing on doing my own version of it, but where does the http_session come from? it does not seem to be any kind of Python bot feature afaik. https://github.com/python-discord/bot/blob/1302632c39469a124e85e6b43c5278526874ce5e/bot/exts/filters/filtering.py#L560
bot/exts/filters/filtering.py line 560
response = await self.bot.http_session.get(```
Itβs an aiohttp.ClientSession
Itβs available on the d.py bot instance
Though we do define our own for various unrelated reasons
Do you mind to link me docs if you know them as I can't find them from dpy docs
bot/bot.py line 242
self.http_session = aiohttp.ClientSession(connector=self._connector)```
Oh I misunderstood it. Hmm even more code reading, thanks for linking that!
We define one because we use it to connect to the API, but there is one just on the bot instance
discord/client.py line 220
self.http: HTTPClient = HTTPClient(connector, proxy=proxy, proxy_auth=proxy_auth, unsync_clock=unsync_clock, loop=self.loop)```
There is no problem with defining your own if you want to tho
So basically it's just request
if something like that, I can easily re make a oversimplified version of ir
Well that's not great
will be back
try refresh doc, maybe?
did
class arrow.arrow.Arrow(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, **kwargs)```
An [`Arrow`](https://arrow.readthedocs.io/en/latest/index.html#arrow.arrow.Arrow "arrow.arrow.Arrow") object.
Implements the `datetime` interface, behaving as an aware `datetime` while implementing additional functionality.
!d arrow.api.get
arrow.api.get(*, ...) β arrow.arrow.Arrow``````py
arrow.api.get(*args: int, ...) β arrow.arrow.Arrow``````py
arrow.api.get( ...) β arrow.arrow.Arrow```
Returns an [`Arrow`](https://arrow.readthedocs.io/en/latest/index.html#arrow.arrow.Arrow "arrow.arrow.Arrow") object based on flexible inputs.
wow really
publically these are exposed as arrow.Arrow and arrow.get
!d arrow.arrow
most packages don't have their root names as a symbol
"most"
afaict 90% of the doc packages do have said root names as a symbol
...nvm
not from what ak could see when he set some of them up
yeah just tested, most of them don't
I managed to make a working invite filter even without the need of going too deep inside the source code
what would happen if @stable mountain went down, with github unaccessible?
how would a redeploy be triggered?
kubectl
(also assume that joe is not accessible)
someone can build locally, push to the GHRC and use kubectl to redeploy
ghrc is down, its part of github.
without any github infrastructure, how would a redeploy be triggered without being able to push to ghrc
@clever wraith ^
push to dockerhub?
ah okay
Alright, I can't get the bot to run without Docker. With Docker, everything works fine, but running it with Poetry isn't working.
I have the site, redis, and snekbox running on Docker, all seem to be working fine. This is the full error from poetry run task start: https://paste.pythondiscord.com/dipuvixuni.sql
What am I messing up?
Is the site available at localhost:8000?
Yep, working fine in a browser there
You need to change the config as said in the top part of the notion page
They already have. Since it's looking for localhost not site....
The bot isn't running on Docker in this case though.
In your config are you using https or http for the site protocol?
http I think, let me check
π
what OS?
Alright, win
then localhost isn't set up correctly
if you open http://localhost:8000/ do you see the website?
If we're looking at the site config, no protocol: site: &DOMAIN "localhost:8000"
Alright one sec
add it to your hosts file and use that, I recall someone else having an issue with localhost
Both are http
127.0.0.1 instead of localhost did the trick
(0.0.0.0 gave a slightly different traceback but same error https://paste.pythondiscord.com/efonuhujej.sql)
If you do cat c:\windows\system32\drivers\etc\hosts I'm guessing localhost isn't in there
I'd recommend adding ```
127.0.0.1 localhost
127.0.0.1 www.pythondiscord.local
127.0.0.1 pythondiscord.local
Ah gotcha, it's just powershell then
ahhh
Well as I do for any other windows users, I highly recommend windows terminal + powershell 7. Very nice setup for dev
https://github.com/PowerShell/powershell/
https://github.com/microsoft/terminal/
terminal allows you to have multiple command emulators open in tabs
Yeah that's what I normally use, I'm doing this in cmd though since that's how I have VS Code set up
Need to figure out how to change the default loll
I run my wsl in windows terminal
same
Have you updated windows terminal recently?
github is back :whew:
The settings got updated to have an actual UI now
Yeah it's awesome
There's a defaults option in there π
that was quite a few months ago
Yea, I'm aware
Yeah got that, I mean I need to set the default in VS Code
Ahhhhh
That's still set to cmd for me, I'm sure it's an easy fix I just need to look for it
ctrl+shift+p search for terminal
there should be Terminal: select default profile
It should auto detect any terminal emulators you have installed
Ah you're awesome ty
π
Ew the font isn't working, I need to fix that too but I can figure it out
but hey it's powershell now
AAA nope broke it
lmfao
AHA
Yeah it works great, I have it all set up in Windows Terminal with some customizations and whatnot
Hey Chris, I can take that Sentry error with long rule numbers when GitHub cooperates
Maybe π
Ik this is off topic but congrats on helper @clever wraith !
thank you!
Same π
I kind of get a response sometimes
sounds good π
feel free to assign yourself to the issue
Looks good π
Hey @static canyon , will you be able to review sir-lancebot#901 sometime soon? There was a reminder this morning about it iirc
Oh actually should I make it ... instead of [...]?
hold on let me see where else shorten is already used
hah yeah every single place it's used, it's ...
Ah alright cool, yea maybe overwrite the placeholder then π
Boom again
π
It is done π
Thanks for reviews
!rule 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
:x: Invalid rule indices: 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,...
nice
and now there's a space missing
π
smh my head
ok gimme a sec
bot#1981 wins the world record for smallest pr ever?
Ah didn't notice it got merged already
was going to mention that we should likely split up that line
since it's doing too much now
Ah alright sure
+1 -1? nah, definitely not
err, where?
there's typically not a space between an ellipsis and preceding punctuation afaik
it's done here for example now that I'm looking
maybe I'm wrong, but I've never seen "This sentence ends here. ..."
that's in !d by the way
Should there even be a comma there?
doc strips punctuation in the content before adding the ellipsis, I think that'd be fine here too
Really it could just be ```py
rules = sorted(set(rules))
invalid = [str(index) for index in rules if index < 1 or index > len(full_rules)]
invalid_str = ', '.join(invalid[:10])
or just leave it as is as it's not really important
Yea
invalid = ', '.join(str(index) for index in rules if index < 1 or index > len(full_rules))
if invalid:
await ctx.send(shorten(":x: Invalid rule indices: " + invalid, 75, placeholder=' ...'))
return
Well this is my idea there, similar to how docs does it, worth changing or no?
Sure, seems good to me
Who has good experience with Pillow? I want to know cool things like how resizing and rotating works
@summer garden I like the dropdown for the different display styles, it's always a bit annoying to have to go look up in the docs what letter I have to put for what kind of date style.
Thanks for the fast reply! Same here, I always have to look them up! I'm a little worried that the message looks awkward with just the epoch in the message body and the dropdown
when you select one, will it tell you/format the epoch with the right code for it?
Right now it edits the message body with the formatted timestamp
which is escaped so it doesn't get converted
oh yeah that's fine
What should happen with the dropdown when an item is selected? Should I leave it till it times out?
yeah, I think leaving it til it times out is fine
I'm actually struggling with deleting the dropdown when it expires. We can't really delete the message since it contains the converted timestamp so I was thinking I'd edit the message to remove the ui.View
Is there anywhere in the repo where we do something similar that I could have a look at?
Here's your reminder: dusk time.
[Jump back to when you created the reminder](#dev-contrib message)
Look at king arthur I think? @vale ibex you did a thing to remove dropdowns but keep the message, right?
Yea you can edit the message and set the view to none
How do I reference the message from inside on_timeout of my view class?
await interaction.message.edit(view=None)
Hm I misunderstood. I have the dropdown object
I don't think there's an interaction on timeout
You may need to store the message in the view init then
there's an example of editing when it times out on the challenges section of sir lance
kata_view = self.create_view(dropdown, f"https://codewars.com/kata/{first_kata_id}")
wait what
it copied the line
this line and below
oh wait let me specify the lines
bot/exts/utilities/challenges.py lines 327 to 336
kata_view = self.create_view(dropdown, f"https://codewars.com/kata/{first_kata_id}")
original_message = await ctx.send(
embed=kata_embed,
view=kata_view
)
dropdown.original_message = original_message
wait_for_kata = await kata_view.wait()
if wait_for_kata:
await original_message.edit(embed=kata_embed, view=None)```
Thank you, I'll have a read
Np
It works great, thank you!
Should channels.discord_py change to discord_bots in the config? Not sure if there's been discussion about this before
Probably no discussion on it, as itβs really insignificant
Do you think it's worth the change or should it just stay for now?
minor thing, the topic still references the old stuff
can't find information about setting up webhooks in a test server would it be okay if i leave them as of now i am not working on them
Bump
Also could a staff member please dismiss Bluenix's and Shom770's reviews on sir-lancebot#901? Thanks!
Sure, feel free to PR it riiiiight in
Eh, tbh I don't really think that sort of thing is worth changing, don't feel strongly either way though
π I'll make a PR since it's a tiny change, if it's decided it's not worth it we can just close it
Although it looks like it will affect slowmode stats so I'm not sure who has an opinion on that one
Just don't change the name of the stat
Stat name can change
It is just gauge of current slowmode and can be changed in Grafana.
Won't that split the data?
yeah, but we can always rename the history data
Just don't see it as something useful to change. That stat name is independent of the config variable
!src sm
Get or set the slowmode delay for the text channel this was invoked in or a given text channel.
I think it relies on the constant name
It might create confusion later
No it's separate, it's a value from a dict
Hey this needs a devops review since it changes config right?
Nah, devops is only required if it changes a workflow or a dockerfile
Yeah, for example in api#30 π
Gotcha, gotcha. How is the config updated then, just curious?
The config-default.yml file it what's used in the container
so if you update that it'll be used in production too, just like when you change code
Devops don't need to do anything
Devops don't need to do anything for workflows or dockerfiles either, we just want to make sure we review any changes to those.
Could I get a hand with git? I've accidentally been committing to the pydis repo locally, instead of my fork. How can I transfer the commits over so I can push to my repo?
i think you can treat that as a remote and git pull
while in your fork's directory, do:
git remote add foo path/to/local/pydis/repo
git pull foo
hey
should be easier than that
you can change the origin URL you're pushing to
git remote set-url origin git@github.com:[username]/sir-lancebot.git if using SSH
git remote set-url origin https://github.com/[username]/sir-lancebot.git for HTTP
should be able to push as usual then
ah right
@static canyon thanks for your review on the unfurl PR, I've addressed your feedback
Hey! Sorry that I keep promoting my PR π
So, I would love to have some reviews on api#30.
It's not that bad, the core part is ~6 files in total, and there are also taskipy tasks that make things easier, like test , that will run tests inside docker, so that no-one has to bother with setting things up.(More about on that, in the README in the PR)
Thanks! π
Do we have any kind of censoring here for like super gory or inappropriate words?
uhhh we have filters, yeah
For the madlibs command I am thinking that we may have to listen if a message is deleted and in that case abort so that the bot doesn't send that back?
It's the same thing we deal with on the .uwu/etc. commands, if we get an alert we'll handle it
The mods will be alerted and can delete the embed, we don't really have that kind of short-circuiting logic for our other bot stuff where it takes in user input and spits it back out
yea
Otherwise Sir Lancebot will respond with that back and create a super inappropriate story with the words - or can we leave this to whatever moderator that sees it?
Ah perfect
Fun fact, !eval does have that
It will run our filters onto the output
But that's a different from some of the echo-back commands, right? You can type code that won't trigger the filter and then have the bot say it. In this case with a straight echo that's not the case
I mean, just running a print statement is the same thing, right?
Honestly after we get bot core ready and have Redis inter-bot queues, having sir lance send most of its output to Python for filtering doesn't sound too bad
At the same time, it probably does not matter
And it sounds like a nightmare for contribs
yeah not sure we need that
What exactly is bot core? Is it a "framework" for the bots that centralizes stuff that's used in multiple bots, or have I got the wrong impression?
shared utilities really
No that's the idea of it, basically an abstraction built on top of a discord.ext.commands.Bot class that contains stuff that all bots commonly share (unloading, loading, internal eval, etc).
Got it, makes sense. Is this going to be usable outside of pydis as well?
maybeβ’οΈ
The class stuff was discussed
we won't be building it with external use in mind I don't think
And basically, yeah we might have a class, but most of it will be ne standalone utils
components might be usable, stuff like redis pubsub
The class would just wrap those
gotcha
Yeah
Oh, I got the sense that it would just be a Bot subclass that then all other bots subclass?
I'm thinking by just having a ctx.safe_send method (or an equivalent to avoid monkey patching) so it is quite simple to use
It's more that you need to setup python and site for what's supposed to be a beginner project
Oh, right
I mean we can make it so it just triggers a warn if it starts in debug and cannot ping the bot, and just disable those checks
I've seen some eeehhh uwu usages and such
If the usages don't already trigger the filters, that won't make a difference
If they trigger the filters, the mods have to go there either way
lol
@thorny obsidian if I'm looking at this correctly isn't the file filtering something that can just be changed with a command?
def _get_whitelisted_file_formats(self) -> list:
"""Get the file formats currently on the whitelist."""
return self.bot.filter_list_cache['FILE_FORMAT.True'].keys()
(bot#1983)
!whitelist add <list_type> <content> [comment]
Can also use: whitelist a, whitelist set
You cannot run this command.
*Add an item to the specified allowlist.
Valid list_type values are guild_invite, file_format, domain_name, filter_token, redirect.*
yeah that
!wl g file_format
!whitelist
Can also use: al, allow, allowlist, wl
Group for whitelisting commands.
Subcommands:
!whitelist add <list_type> <content> [comment]
Add an item to the specified allowlist.
!whitelist get <list_type>
Get the contents of a specified allowlist.
!whitelist remove <list_type> <content>
Remove an item from the specified allowlist.
!whitelist sync
Syncs both allowlists and denylists with the API.
β’ .flac - embeddable audio format
β’ .gif
β’ .jpeg
β’ .jpg
β’ .m4a
β’ .mov
β’ .mp3
β’ .mp4
β’ .mpg
β’ .ogg
β’ .png
β’ .wav
β’ .webm
β’ .webp
Chris told me to open an issue for it.
Yea I was not aware of this feature
I didn't look at it too closely since I'm busy atm
Nice π
the magic of finding defs/references with vs code lol
@vale ibex should that be changelogged too or will it just cause csv and json spam
Yup π Done
*trialing not trailing π
I've been really busy recently, but I'll do it whenever I'm free π
I haven't forgotten about it
Great, I'll take a look tomorrow π
!remind 10h10M
Your reminder will arrive on <t:1638176629:F>!
Ah no worries, thanks for replying!
Here's your reminder: I'll take a look tomorrow
[Jump back to when you created the reminder](#dev-contrib message)
sir-lancebot#957 is just a small QoL change for .aoc count so that it gives a more accurate countdown, using Discord timestamps
@thorny obsidian ^ I tried to request you for review but chrome wouldn't let me
Yea was annoyed that it wasn't giving me a time, since I couldn't remember what TZ aoc was based in
So thought I'd fix it rather than complain haha
Does snekbox start entirely new interpreters each time, or is it forking an existing process? I'm interested to know if there's an optimized way to have numpy and pandas always available since they come up in most calls to !e in #data-science-and-ml.
start new interpreters
But they're expensive imports, so if the only way to have them available implicitly is to have snekbox secretly import them before running the code passed to it, I'd oppose that.
probably possible, but not without a lot of architecture changes to snekbox
forking usually breaks things unexpectedly, don't think it really fits something like eval
the time limit kicks in from as soon as nsjail starts, which means we'd need to run imports outside the jail and then put procs into the jail, which is possible but difficult, and very easy to mess up
putting code in jail smh
Just write faster code stel
this is about me forgetting import numpy as np at the beginning of every code sample 
hah
out of interest, the one that currently time out, would they have successfully ran given a few more seconds?
I never said anything about code timing out, Joe did.
I wouldn't want every call to eval to incur an expensive import (numpy) that might not get used.
!e ```py
import time
start = time.perf_counter()
import numpy
print(time.perf_counter()-start)
start = time.perf_counter()
import pandas
print(time.perf_counter()-start)
@vale ibex :white_check_mark: Your eval job has completed with return code 0.
001 | 0.42715913988649845
002 | 0.8533768462948501
@vale ibex worth noting that pandas imports numpy, so if you had imported pandas first, import numpy would have been faster.
!e ```py
import time
start = time.perf_counter()
import pandas
print(time.perf_counter()-start)
start = time.perf_counter()
import numpy
print(time.perf_counter()-start)
@vale ibex :white_check_mark: Your eval job has completed with return code 0.
001 | 0.847184422891587
002 | 2.949964255094528e-06
Ah cool
we have all learned so much
Hah, I haven't learnt much about snekbox, today nor any other day, so I wouldn't know where to begin with making this better
but people far more intelligent than I have said it is difficult and prone to introduce errors
also it's cyber monday and the microphone lemon suggested I get still isn't on sale
π
Guess you'll have to live with losing a second of your time for every !e call
You an always invoice Python Discord Inc. for it at the end of the year
It is doable using a site package
But we loose 1s for each eval, which is a bit meh
But yeah, that isn't impossible, and a bit hacky
It's midnight in the best timezone, east coast :3c
I'll review it when I get out of bed
Hah!
The first commit is just a basic refactor, swapping an if statement around
the 2nd commit is the actual change
Nah itβs just midnight in eric wastlβs timezone, mountain time is better
fyi since you approved, I've added another commit so that the countdown to the next day uses a timestamp too
Hey! Sorry that I keep promoting my PR π
So, I would love to have some reviews on api#30.
It's not that bad, the core part is ~6 files in total, and there are also taskipy tasks that make things easier, like test , that will run tests inside docker, so that no-one has to bother with setting things up.(More about on that, in the README in the PR)
Thanks! π
Your reminder will arrive on <t:1638291863:F>!
I would never.. 
@vale ibex a few questions about your subscribe button PR. I'm not sure if I did something wrong or something's wonky.
a) If someone tries to interact with the buttons and they didn't invoke the command, all I get is an "interaction failed". I don't get the ephemeral response. Is that also happening with your local testing?
b) what's the timeout on this interaction, like when do the buttons disappear? I'm struggling to find this in the code, but that's most likely due to my unfamiliarity with views.
c) for roles like advent of code, it should be assignable before Dec 1. Can the current code handle that? It's currently just checking if the month matches the one given, but I'm wondering how we could introduce a bit of leeway into that.
d) do you think it would be worth showing the other self-assignable roles but somehow indicate that you can only try to assign it during a specific timeframe?
a. I thought I fixed that, but I'll take a look
b. There's currently no timeout. My idea was if I was to add a timeout, by the time it timesout it would be 4 screens up in the chat anyway
c. Yea, I can make it so multiple months can be used
d. I guess we could always show all of them, have the non-assignable ones in red and then give an ephemeral response if it's not the right month
So for the timeout, I think it would still be a good idea to have one. Because just showing up in a channel and seeing it, a person unfamiliar with the buttons may assume they can press it too?
if they do, then they'll get the error from it anyway
and that's if the command is even in the same screen, which it likely won't be in #bot-commands
If we're worried about the buttons both visible, it's probably better served by deleting the message after a certain amount of time anyway
rather than adding custom timeout logic to remove the buttons from the message, which wouldn't work if the bot restarts either
that works for me too
For D, doesnβt the library have a feature to add a disabled button that appears but is grayed out and canβt be clicked? That might also work.
The buttons don't disappear, but unless you specified otherwise they will stop working after 3 minutes
Also, I'm totally unsure how to implement button removal on timeout. The timeout event is dispatched to the view, but the view is not tied to a message, and you need to edit the message to remove the view
Yea, you'd need to store the original message in the view from the init
or, just do a delete_after on the original ctx.send, which I'm planning to do
hmhmhm
It might work for this particular case, but I dislike responses that delete themselves
d: why limit when roles can be assigned?
to show what roles are potentially available, even if they can't be assigned now. Also, the limit is because of the previous seasons and there isn't a strong reason to have advent of code or lovefest be a year-round assignable role. It's only relevant during certain times.
only if they coded that, there's nothing in dpy (or discord) that does that natively
..that doesn't answer my question
dpy defines 180 seconds by default
does it?
yeah
discord/ui/view.py line 155
def __init__(self, *, timeout: Optional[float] = 180.0):```
welp okay then
d: why limit when roles can be assigned?
phrased another way: why not allow the user to assign the roles no matter what season or month? What is the advantage or benefit of blocking... lets say... the advent of code role from being assigned in June?
there isn't a strong reason to have advent of code or lovefest be a year-round assignable role. It's only relevant during certain times.
she edited the message
(okay now i see your edit since it had been scrolled, lol)
well, the second part of my question still stands
People will be toying with a role that can't be used. Easier to just say it's not the season for it
because people spamming role subscribe/unsubscribe during random parts of the year when it isn't relevant isn't something I want.
ah
hmmmm I've seen permanent interactions on other (non d.py) bots
I wonder how that works
Iβm assuming youβre referring to the views, not slash commands and user/message buttons,
but, as someone who hasnβt used views, I assume itβs like everything else in the bot lol
If you want it to be long lived, you keep an external cache of things you are handling, and reattach listeners on startup
Yeah there's like a method to attach such a permanent view.
c and d required quite a rewrite to make it look nice but I've got there now π
Just dev testing
this looks very cool
Did you happen to restart your bot after running the command?
looking forward to january to get my promotion
ngl almost committed that too lol
make sure to deploy it as well π

Is there a better way to do this? ```py
# Join the months together with comma separators, but use "and" for the final seperator.
month_names = [calendar.month_name[month] for month in self.months_available]
available_months_str = ", ".join(month_names[:-1]) + f" and {month_names[-1]}"
return f"{self.name} can only be assigned during {available_months_str}."
@vale ibex @thorny obsidian would it make sense to just have a message in #welcome or somewhere else where you can click on buttons to add roles?
yeah
you'd also lose the context of what roles you already have
Well I mean, you have the user profile
but that could be solved with an ephemeral message saying what the action was
and the user can click again to toggle
And you can respond with an ephemeral message
would need to think about how to handle available roles changing etc
but it could be done
it might lead to a nicer interface too
As long as you create the view correctly, the message will update accordingly
I mean more like, it's going to be 1 message that lives forever, so on boot IG we would just get that message ID and update the view
yeah
along with a task at the start of each month to force an update too
just in case the bot lives across a month boundary
And possibly a command to update it on demand
yea
that could work
@last patio fyi don't review the subscribe PR just yet, we might be changing it
I'm thinking we store the messageID in redis and just do the checks & alterations on init
doing that would mean we don't need to think about making the interaction survive across boots, since it'll be a new view with new interactions each boot
mhm
I'll probably just drop a bunch of commits locally so that the PR is a bit nicer to read through haha
just "start again" as far as the PR is concerned
ofc keeping code locally and just rebasing
Sorry π
Nah don't worry it's not much effort
just some fun force pushes to drop commits on the remote π
I'll give it a look tonight
Something that can be easily reviewed is sir-lancebot#957 though
since it's quite relevant to the event starting tomorrow
ngl it is a good tz
.aoc count
The Advent of Code event is not currently running. The next event will start <t:1638334800:R>.
rock solid
I'd prefer the subscribe command. If we want a permanent message like that we might as well do reaction roles or similar.
Because someone checking their profile to see what roles they have feels like clunky ui
And I wanted to still keep it as a subscribe command to prevent changing all the "run .subscribe in bot-commands" messages that are all over the server
Isn't it just the message in #welcome and the verification DM?
They'd need to be updated regardless
since they reference !unsubscribe
which won't exist anymore
Just make unsubscribe an alias =P
But keeping it as a command still makes it easier for people to adjust to. It's just a different interaction with the command. They don't need to go to an entirely separate channel now
I guess the thing we need to ask is which is better UX
- a command that the user needs to be told about and then subsequently run in bot-commands, but also includes the context of what role they currently have.
- A static message somewhere that users can click on to toggle their roles
I prefer the first. Not having the context of which roles you do or don't have without looking at your profile is awkward imo.
How does it currently show the roles in the PR?
clicking the button toggles the text & colour
clicking a red button gives this error
that text is super long
could we do like "+ Announcement", "- PyWeek Announcements", "+ Advent of Code"
We could remove the role word
since it's not needed
having add and remove is better though imo
I'd rather be explicit and very clear than try to keep it shorter for the sake of being shorter
Just as a note, red seems like a better visual cue for removal, and grey for disabled
true that
luckily they're constants so that's easily changed
ADD_STYLE = discord.ButtonStyle.success
REMOVE_STYLE = discord.ButtonStyle.secondary
UNAVAILABLE_STYLE = discord.ButtonStyle.red
So yea, having the static message would mean add/remove would become toggle
and then the ephemeral message would tell the user the action that was preformed
So they can click again if they didn't realise they already had the role
If there's already an implementation for the command, and a static message is not clearly better, then we can just stick with the command I think
Yea, this is the current interface after clicking some buttons
I've changed it slightly though, so that unavailable buttons are sorted to the end
To the end of each row?
Otherwise it retains the order the roles are in-code
Nah, to the total end
it is a bit weird that you have the locked roles without any additional words
maybe add a π ?
Clicking it gives a verbose response
I don't think adding an emoji would help, since it's still something a user would need to learn what it means
Anyway, the bot is live now if you wanted to play #476196062214750219 message
Still seems more intuitive that way
Would help if the bot replied to you, so it's easy to understand which is yours
wdym?
I imagine it's going to get a bit spammy in #bot-commands
Those are ephemeral messages
Like, it'll reply to your invocation
so only you can see them
The view that holds the buttons doesn't have context of other people's invocations
that would require storing all of the views that are active somewhere, with the autor's user id
I just mean that Botty will reply to your message here
Have it reply to the &subscribe, rather than the bot's message?
Currently there's no reply here
Ahhhh right, I see what you mean now
Either that or ping you in the message
Wheee it's nice
done π
Yea, interaction.response.send_message always replies to the button message
sadge
I might be dumb and completely missed the date but congrats on helper
@vale ibex oh this is interesting. A person cannot unsubscribe from a role during off months. That's consistent with current behavior, right?
yup, it is
unsubbing could be possible, with some changes
but also I'm not too sure if it's all too useful
since atm the temp ones we allow modification the month before
so they have a month to remove if they want to
yeah, just noticed it while doing some funky testing
not dire nor does it need to be "fixed", just wanted to confirm that it's consistent with the current behavior
yupyup
atm the commands in lance are completely locked so you can't run sub or unsub unless the month matches
all you need know is core dev and you're good to go
noice
Here's your reminder: review api#30
[Jump back to when you created the reminder](#dev-contrib message)
mmmm, I'm not sure how it's being calculated since it starts in the evening
Tonight should be the third night of hannukah, which I think is how it's determining that
28th was the 1st night, 29th was the second. So yeah I think that makes sense that tonight is the 3rd
Doesn't it go by the candles?
You light the third candle tonight
It was supposed to be lit 5 hours ago
depends on your timezone
What timezone is it of Israel?
I don't think it's coordinated to Israel time. It's just supposed to be lit after dark (generally) in your area.
Lancebot saying it's the third day, I think is meant to mean tonight is the third night of hanukkah and when you light the third chandle
Ok, thanks
Hey @clever wraith do you have time to finish off bot#1889?
If not, I can take a look at it
But it looks like there is a deadlock?
I can't get any help channels to close
Actually my 3 braincells still working are dumb, dumber and monke
I used the wrong prefix π€¦ββοΈ
Not sure about that output though, looks somewhat worrying. But it could actually be working, I had to go hence why I sent this here rather than continue debugging
hahahahahahaha βis there a deadlock?β βi used the wrong prefixβ i love it
@vale ibex I'm reviewing the nomination thread PR. When I start a review, I get the warning of "Could not find a thread linked to..." which is only in the archive_vote() function as far as I can tell. So I'm not sure how this is interacting.
Awwww nooo! The testing server and this server has now the same profile picture
Oh really haha
You mean server icon, right?
Test server is a bit brighter, it'll be fine π
π€
Unless it's switched I'll have to
This is the worst thing that's happened to me since I had my first thought
Well if it helps I'm confused too
what is your Emojis.incident_actioned and Emojis.incident_unactioned set to?
are they π or π ?
Lmfao
so the checkmarks and magnifying unicode, but I've been having a hell of a fucking time getting the emojis to not error
since it sounds like the archive reaction listener is getting triggered from the bot reacting to the post
!e print("\u2705\u274C")
@vale ibex :white_check_mark: Your eval job has completed with return code 0.
β
β
after posting the review, the bot reacts with check_mark to the invocation
since that's also the incident actioned emoji in your config, it's seeing that as a archival request
I might just add check in on_raw_reaction_add that the reactor isn't the bot
just for local dev instances
kk that's pushed
i do, ive just been busy recently
Alright cool, let me know if you need any help π
thanks
schools just been really busy
Yea, understandable π You should always prioritise school anyway.
urgh, I feel like I need a crash course in what unicode emoji formats our config will take to actually work with local dev
It's whatever discord.Emoji allows
so either a unicode string, or <:emoji_name:emoji_id>
<a:emoji_name:emoji_id> for animated
so our config has like... 3 different kinds, right?
<:emoji_name:id>
"\u123123"
":emoji_name:"
which one is expected and works?
all 3 should work
Okay, I had issues with it not
the first is for custom emoji, the second two are base emoji (unicode emoji/server emoji)
all of those should work, but the latter is not ideal, since duplicated names can be issues
like ":eyes:" broke when trying to add reactions because I didn't have any ducky emotes
(from the _random_ducky() function)
and when testing the nomination archival, it's not acknowledging my specified incident_action emoji, which I have set as :snowflake:
in _cog.on_raw_reaction_add() what does emoji look like after being assigned?
compared to Emojis.incident_actioned, Emojis.incident_unactioned
but also something like "\N{TICKET}" works?
Yea, that's python sugar to make unicode
It's a CLDR name
can't remember what it stands for
so, this is what I'm struggling with then.
1st is the emoji it's getting, 2nd is Emojis.incident_actioned, 3rd is unaction.
it seems discord is returning it as a plain unicode char
I'll just... accept that emojis in discord and d.py make no fucking sense and approve this
so annoyingly, you'll need to use unicode in the config
Okay, so the config shouldn't use the :emoji_name: style then?
Also that means that if we ever don't have ducky emotes, it's going to break
because the grab a random ducky emote fails on :eyes: and discord just would not add that as a reaction
yea, if that emoji is ever being compare to an emoji returned by discord, rather than just being added to a message, it should be unicode
adding a reaction like that should work
oh it profoundly didn't for me
because the function returned ":eyes:" and discord just didn't want to do that
!int e ```py
msg = discord.utils.get(self.bot.cached_messages, id=915403844744249384)
await msg.add_reaction(":eyes:")
In [6]: msg = discord.utils.get(self.bot.cached_messages, id=915403844744249384)
...: await msg.add_reaction(":eyes:")
...:
Out[6]:
File "/bot/bot/exts/utils/internal.py", line 180, in _eval
res = await func()
File "<string>", line 6, in func
File "/usr/local/lib/python3.9/site-packages/discord/message.py", line 1406, in add_reaction
await self._state.http.add_reaction(self.channel.id, self.id, emoji)
File "/usr/local/lib/python3.9/site-packages/discord/http.py", line 335, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 10014): Unknown Emoji```
interesting
mhm, sooooo unsure what to do about that.
@cold island but I believe that was your PR that added the random ducky thing. I'm curious how you tested it and got it to work
alright, just searched the codebase for :\w*?: and this is the only instance that would cause an error
\π
!charinfo π
secondary question, what's the intended behavior if someone leaves and then someone tries to post a review for them?
what line is that from?
It's failing on line 87 in _review
you added a line that relies on nominee.id before that check comes into play
nah, the check is before that
but for some reason isn't checking the first thing that's returned
which is the error string it seems
that check is on line 123 for me
line 81
that's just checking for a review, no? and doesn't it return a string and then None, None?
Yea, it seems that's check is seeing if there's suppose to be a review
but it's jsut returning a string, so that check is failing
So it's getting a non-empty string
(this was previous code)
it seems that string was added for get_review to work nicely
but then broke that check on line 81
Right, but you added something that will now make it fail non-gracefully since it relies on nominee.id and the working check for a user in the guild doesn't come into play until line 123
Yea, whereas previously it would fail silently and probably raise an exception
we just haven't ran into it in prod
:D I'm so good at fucking these things up
I can think of one instance where we would have if the review tried to get posted later
hah good choice
Welp...bye bye Sir Threadevere, nice having you
Why did Sir Lancebot's status change? I'm guessing it's the AoC countdown, but it used to say "Playing Commands: .help"
yknow... I just had a funny feeling that sir threadavere might be back when it's time to test forks
What forks?
yup, it's for aoc. This function is responsible for it https://github.com/python-discord/sir-lancebot/blob/60174af6db1b7034a21d0e61233b66e45035ce2f/bot/exts/events/advent_of_code/_helpers.py#L502
bot/exts/events/advent_of_code/_helpers.py line 502
async def countdown_status(bot: Bot) -> None:```
discord.py forks
Ah ok, I see. But why does it need to change the status of the bot?
Ah
well... why not?
'cause nobody looks at the bots status because its below the bottom of the screen
Well, not unless you scroll down, right? π
yeah
so what's the harm in changing the status for some fun shenanigans?
Well there isn't really, I was just curious
well its current status can be useful to people if they want to find it, but one that doesnt show the prefix cant
I'm not sure how many people look at the bot's status as a way to find it's prefix though
@dusky shore help
AdventOfCode
.adventofcode
All of the Advent of Code commands.
Anagram
.anagram
Given shuffled letters, rearrange them into anagrams.
AprilFoolVideos
.fool
Get a random April Fools' video from Youtube.
AvatarModify
.8bitify
Pixelates your avatar and changes the palette to an 8bit one.
.avatar_modify
Groups all of the pfp modifying commands to allow a single concurrency limit.
.avatareasterify [colours...]
This "Easterifies" the user's avatar.
It does
Considering modmail doesnβt have any user facing commands, and that mods only use a couple frequently, it doesnβt really matter
A case where the bot tried to review someone off server? It happened before, worked fine
Uuuh I just ran it and it worked? 
Maybe it's a dpy 2.0a bug?
So when you don't have a ducky and the bot tries to add the ":eyes:" reaction, it worked?
Cause it threw the error message Chris showed above
Yep, I'm positive I tested it
Maybe Chris can eval it with modmail, since it's still on 1.7
wouldn't that require joe?
Devops can
I thought eval was locked to owners since it's above everyone
does @stable mountain use discord.py 2.0?
it uses webhooks in some parts of code, right?
if yes, would it be possible to tell where
It uses for the incidents channel
may I see the source from somewhere?
thx π
thank you!
test
Modmail raises the same error
So when you developed it, you used emoji literals, which is why it worked
I think I noticed a bug in aoc leaderboard
an hour ago, I was 181st in leaderbord -> #aoc-bot-commands message
now I'm 182nd #aoc-bot-commands message
this means someone somehow jumped in front of me, which shouldn't be possible with how points are assigned (at first check, I already had both parts done, my score didn't change at all)
someone joined the LB after you ran the first command, so the points changed
but my score didn't change at all.
so the bug is still there - some people get adjusted and other don't
uhh, I dunno how the poitns are calculted, lemme check
aoc leaderboards can only have 200 max users, so we actually have a few leaderboards running in the background
when you do .aoc join it sorts you into an aoc leaderboard in the backend
So when we calculate scores, we can't just use the aoc score, we need to do it ourself
So I am guessing there is an issue in that implementation
yes, that's why it shouldn't be possible to jump in front of someone
I wasn't refuting your point.
Just laying out all the info I have
I haven't looked into that too much myself, so I'm not too sure what could cause this discrepancy
as I said there are people who just jumped in front of me - e.g. 78 | continental-beauty-msbacd | 1352 | (1, 1)
- score adjustment of people joining was +2 until place 70, then it was +1 for some time and became no adjustment later (including my place)
Yea, so I am presuming the thing that collates the points from each of the leaderboards, and then calculates the overall score/position has an issue somewhere
Unable to convert 'aoc' to valid command, tag, or Cog.
bot/exts/events/advent_of_code/_helpers.py line 112
def _parse_raw_leaderboard_data(raw_leaderboard_data: dict) -> dict:```
ok not relating to this but why don't we use star_results to get the per day and star LB (currently it has a separate list)
okay, so the bot actually gets real completion time from api
so jumps make sense
and so do +2/+1/+0 because the person joining had two times and some people got two, some one, and some none tasks before the person joining
ty
idk why I thought it's in python bot and I tried !src instead of .src ^^'
cc @molten perch
we could probably make this niceer and have python check lance and vice versa
it could at least say "are you sure you didn't mean {opposite_bot_prefix}src?" XD it would make me think, instead of just trying to use full aoc name and stuff because I thought it's about the short form instead of wrong bot XD
Yea that would likely be easier
Since to actually get the src from the other bot, we'd need ot have some inter-bot comms
like a redis pub sub sort of thing
Itβs been a while. As far as I remember it uses the star results indirectly, but I would have to take a look at it, to know for sure.
Hmmm... I really don't see an issue with using emojis in code. It's just another kind of character
Me neither I'd be fine with a mix. The issue is that if you try to do message.add_reaction(":eyes:") discord returns a 400 error, so as long as we avoid that, we're fine
But built-in emojis have to be used as URL-encoded Unicode??
That never worked..
I never said it did
message.add_reaction accepts either a unicode escape sequence IE \U{eyes} or \u0123
or a custom emoji string
yeah seems like that's not the right format. Interesting though that :x: and :cookie: work but :eyes: doesn't
Oooh right right
Huh? Does this mean when the next puzzle is released for AoC?
Yeah cuz it sounded like we went back in time all of a sudden lmao
Yup, if you looked at the function I linked yesterday with this, it's going to change it's status for each puzzle release
Feel free to PR a fix π
It's unlikely to be fixed if it doesn't get addressed by the ones who use it
I don't really know Python to fix it
hmmm, maybe, maybe not.
I've written a src command which was buffed, and showed the branch and more
How did you get a bot to give src information of a cog from another bot?
ofc that still required the command to exist in the same file...
I didn't, let me think about it
that is partially how mine works
(the reason it worked like this is because github didn't always match the local code)
would probably be easier to do interbot communication than scrape github tbh
it would request the file from github, and parse the ast, then find the function definition with the same name
yeah 100%
if we were to do this, I feel like using the database would make more sense
I think Lance and any other bots here to add to this could have an only-in-Prod update of its commands and where they're located
then python has a smart src command which would get it for all bots matching the name, or fuzzy match stuff, etc (doesn't have to be this big, just brainstorming ideas)
eg !global-src help would return a message with an embed for each bot: the src of python's help, lancebot's help, and king Arthur's help
now, if we were to change this and not use the db
then there could be an internal interbot com where python could get info
this could also extend to making a global help command with both Lance and python
disclaimer: this was entirely a brainstorm and some of this is almost certainly unfeasible, or not worth the work to implement it, and complexicity of said features
hmmm, if I was to implement this today I'd cheat and make a special command which would have global checks removed for it, and only bots would be able to invoke it, so if the command wasn't on one bot, it would invoke the special command on the other bot which would send either an error or success embed
Ah, I didn't look at that. But I gotcha.
hmmm, does Lance actually think it's the seventh?
(aside from the formatting issue)
hannukah?
my guess is something in the code is not handling the cutover between months correctly
!remind 5h out of hospital, look at Hanukkah command
Your reminder will arrive on <t:1638397347:F>!
Thank you for redirecting to the right channel. Will remember for future purposes
@cold island it depends how you're asking me lol
Thank you! π
@brisk brook I addressed your review on bot#1939 (about time)
Haha thanks I'll take another look
π₯³ that's awesome!
Congrats @molten perch !
Thanks! π
nobody will say anything about when volcyy actually joined
Congrats @last patio, we all like to feel like new ehh?
wat
@last patio congratulations on core dev! Don't forget, force pushing can be dangerous π
thanks arl! that's why I do it daily
nice!
Congrats! π₯³
Congrats @molten perch!
Congrats @last patio!
I thought you were a core dev already tbh
PS: They were :p
Wait what @green oriole #dev-announcements message
Wasn't Volcyy a core dev for like ages
view the message directly above this message, lol
Yeah, sent before I saw
Volcyy has been devops for awhile, but Core Dev as of like... two? weeks ago?
The role color for devops and core dev is the same
surprised that its possible to be devops but not be core here
Well congrats @last patio !
They have overlapping areas for sure, but devops can work on things entirely separate to core dev items.
Like managing our k8s cluster and various internal settings and tools doesn't have that much overlap with the nitty gritty of reviews and specific features for Python bot.
Gotcha
ahhh, that makes sense
...what in the world
?
socket.gaierror: [Errno -3] Temporary failure in name resolution
oh fake redis
Feel free to post the rest of the traceback
fake redis.
given that its fake redis, I do know, but feel like perhaps the error could be a bit more helpful, if redis isn't found
i-
uhm
bot/exts/holidays/hanukkah/hanukkah_embed.py lines 103 to 108
def hanukkah_dates_split(self, hanukkah_dates: list[str]) -> None:
"""We are splitting the dates for hanukkah into days, months and years."""
for date in hanukkah_dates:
self.hanukkah_days.append(date[8:10])
self.hanukkah_months.append(date[5:7])
self.hanukkah_years.append(date[0:4])```
rather than this, can we switch it to using arrow?
(or datetime.datetime)
the list is currently ['2021-11-28T19:03:00-03:00', '2021-11-29T19:04:00-03:00', '2021-11-30T19:05:00-03:00', '2021-12-01T19:05:00-03:00', '2021-12-02T19:06:00-03:00', '2021-12-03T18:23:00-03:00', '2021-12-04T19:32:00-03:00', '2021-12-05T19:08:00-03:00', '2021-12-06']
@cold island it is not meant to work with the default !help command?
It should
It's suppressed only for errors
Because I got this: #476190141161930755 message
Oh that help
No it shouldn't
Well
At least I didn't think of that π
It's an interesting idea though
I assume we want to change that ehh?
Because those are 5 reactions (so it fits on one actionrow)
Ooooh, right that's handled by another paginator?
I thought you meant adding navigation for extensions
yeah
Okay then that could be another PR/change in the future
yeah
okay figured it out
the hanukkah command just needs to use datetime and strptime
def _parse_times_to_datetime(self, hanukkah_dates: list[str]) -> None:
"""We are splitting the dates for hanukkah into days, months and years."""
for date in hanukkah_dates:
try:
self.hanukkah_datetimes.append(datetime.datetime.strptime(date,"%Y-%m-%dT%H:%M:%S%z"))
except ValueError:
# there is a possibility of an event not having a time, just a day
# to catch this, we try again without time information
self.hanukkah_datetimes.append(datetime.datetime.strptime(date,"%Y-%m-%d"))
there is also an issue with the api not returning a time for the last event, which is probably the current problem
by rewriting to datetimes, we solve a lot of the problems as well
FYI
yup, we're aware. It's what arl is working on now
Ah ok
huh apparently there's also a memory leak in this cog too
a... memory leak? in a cog? in Python?
no, lancebot
I mean, no one has said if I should make a pr yet π
I'll put in the work if its authorized
I meant the language but granted that wasn't obvious
ah
Zig has already said yes to a PR #dev-contrib message
oh i missed that lol
oh lol, not sure why I thought bot#1868 had passed policy bot
Here's your reminder: out of hospital, look at Hanukkah command
[Jump back to when you created the reminder](#dev-contrib message)
well auto merge is on ready for a core dev π
^ that's why i forgot that zig allowed
RIP, I'll find you someone to review dat pr 
So question about async RedisCache, the .contains() method, is that just checking keys? I think it's the case, but wanted to double check
sir-lancebot#959
yupyup
okay cool cool
lol, he said "I am not sure what I'm looking at, but since it worked fine
"
the command is currently broken until the fix is live, so I would appreciate some reviews ^^
give it a minute
I mean, I do want to stress that properly testing and reviewing PRs is important. Including some of the edge cases. I had a very not-fun hour yesterday debugging an issue because a seemingly easy PR that had been merged prior actually ended up breaking functionality.
we did test it properly last time in the test server, the code looks fine and two reviews were already there
I mean I don't know, ask him not me
The subscribe command always silently failed previously
I didn't remove that, but it doesn't seem great
it isn't great yeah
why does it need to be a reply?
pinging is the same as replying tbf
I'm just pointing out that the attitude of "I don't know what I'm looking at but since it worked fine" isn't a great one, especially since there have been changes as recent as yesterday to it. It causes headaches down the line if features get missed due to not thorough testing.
ugh, don't make me switch for that pls
... alright then. Forget I said anything then.
Yea, reply seemed nicer since you could jump to the message