#dev-contrib
1 messages ยท Page 110 of 1
No access to link ๐
I'm fine with that, I'd like getting to 1k additions/deletions
maybe one day lol
I think we can leave this PR as is and have the others as issues
or we can include the tvban part in this pr
@short snow In bot#1564, please make purgeban not take any argument for purge days, but instead take args for time. If time exists, don't permaban.
Please also do the same thing for voiceban, where if a time is supplied, it won't be permanent.
@vale ibex good?
Yea, since we're removing the arg for purge days, just make sure we still use 1 day as a const.
We should add this scope to the issue/PR for context
will it be possible to make a custom cooldown decorator that applies cooldown based on the command arguments?
Yes
it looks like wrapping things in ` to make codeblocks is a rather common usecase, maybe we could make a util for it?
I like how the docstring for the SourceConverter on lancebot still has tag in it
In what way would it work? Wrap some passed in string in backticks?
@balmy sparrow should all converters go in converter.py?
i saw some places with
strikethrough = "~~"
...
strikethrough + "text" + strikethrough
``` and the such
i'd assume them all to be there
or is that not how everyone else thinks?
imo yea
I don't think passing it through an util function instead really helps the readability of the string, do you have an example on how it'd look compared to just doing ```
f"โ`{text}`โ"
forget i said this, adding the symbols are definitely easier
yeah, you're right, it's more readable this way
nice
Well the checks passed
Also that's only on bot right
Oh lancebot has no tests
what do you think about merging the ping command cog and the uptime command cog?
https://github.com/python-discord/sir-lancebot/blob/main/bot/exts/evergreen/uptime.py
https://github.com/python-discord/sir-lancebot/blob/main/bot/exts/evergreen/ping.py
I think that's a good idea, it would be cleaner
i'm good with ^ if a core dev is, considering i made the ping command i'd like to take it on
(will make an issue)
done
@fervent sage will it conflict if we merge your PR now before the spring cleaning PR?
yep but the conflicts shouldnt be too bad to fix
(+ i can fix them myself which im fine with)
Pipfile line 13
"async-rediscache[fakeredis]" = "~=0.1.2"```
Used to think this format meant optional dependency
But I can't find anything about it in the pipenv docs
Tbf the pipenv docs are shit
Anyone know what it actually means?
yeah
also "~=0.1.2" is wrong
yeah it is extra optional deps
SO post says extras option for extras
for example, aiohttp has a speedups extra which brings aiodns, cchardet and a few other things
Are you sure? I think ~=0.1.2 will allow 0.1.3 but not 0.2
~=0.1 would allow 0.2
would it?
I think I'm misunderstanding then
I was under the assumption ~=0.1 would only allow ~=0.1.X
IG I was wrong
Ahh yes I see now
~=0.1 is >=0.1, ==0.*
TIL, thanks
Yea it's "this or higher right-most number"
yea
@balmy sparrow I'm not sure about replacing return from with return by
what's this referring to 
๐ค i felt like "returned by" sounded right
but english isn't my first language, so maybe I'm wrong there
i think returned by fits better too
you return from a function, and have a thing returned from a function
the api returns a thing, the thing has been returned by the api
My two cents is that only reusable converters should be in there
If they're only used in one place, then they're better off in the same tower as the cog
Well I'm pretty sure all lancebot's converters are only used in one place
Hmm, I think the destiction should be usable, rather than used
Eg a whitelist check or a duration converter makes sense to be a util
Whereas something specific to a cog should be with that cog
The ones that I have in converters.py are WrappedMessageConverter, CoordinateConverter, SourceConverter, and DateConverter
Those names don't really tell me exactly what they do, but I'm willing to hear other people's opinions on this
I'd prefer only convertors that could reasonably be reused by another cog be in that utils folder
If those fit into that category then fine ๐
what's the source for this?
async-rediscache#1
cool
setup.py lines 37 to 39
extras_require={
"fakeredis": ["fakeredis[lua]>=1.4.4"],
},```
This is useful if you have dependencies that can add functionality, or something similar, but don't need them to always be available
no not that
this, when its on seb's github
not sure I follow, Sebastiaan maintains async-rediscache
ah, you mean how is it detecting it?
(the not needing the SebastiaanZ/ before the repo#issue)
It was previously on python-discord so it redirects
@sleek steppe smh, commiting single quotes in a PR
that's a paddling ๐
Just found it funny since you have that spring clean pr lol
Which PR?
I copied and pasted most of it lol
hah yea thought as much
bot/exts/evergreen/avatar_modification/avatar_modify.py lines 313 to 314
"""Load the PfpModify cog."""
bot.add_cog(AvatarModify(bot))```
lul
that's on me
actually no, I blame @fervent sage for suggesting a better name
it's all vco's fault, yes, that's it
๐
understandable
hahaha
Already done lol
youre the one who stole it :P

alright did anything get destroyed while I was asleep?
Understandable, the day of reckoning is upon us.
Would you look at that, it's progress o' clock.
noo!!
1566
:3c you're welcome. I'm very good at making issues and no contributions
I thought issues count as contributions?
like the creation of them
Egh, to me "real" contributions are the PRs and Reviews
ah
Which is also why you should vote no to the thing in the other channel regarding me 
haha, maybe after my finals
I'm currently watching my lectures at 2x speed to just even make a real attempt at catching up
sounds like something that I'd do
ok, willl do
ty
uhh one question, by taking no arguments for purge days, meaning, i just remove that argument?
and use 1?
arghh, the second i edit any line, it would cuz those flake errors
and if i reset it origin, it works perfectly
https://github.com/python-discord/sir-lancebot/pull/649 needs a quick approval
from core dev
we can reduce 3 prs down ๐
all of them are short
testing 645 now
Done your suggestion @balmy sparrow ๐
Nah, only the first three
oh makes sense
i thought the webhook hates me and selectively sent my stupidest nitpicks >.>
Haha, recently I had 3 of my webhooks fail
Haha
!clos
clos doesn't make sense
hmmm the command suggester doesn't catch it
!clos
You're just an admin ๐
So yea, since the bot already suggests the correct command, don't think its something we want to change
if not any(role.id in MODERATION_ROLES for role in ctx.author.roles):
yup, looks like mods don't get suggestions
yeah that
You should use off-topic though
Isn't that a webhook
I'm not sure if that's something that's worth it, considering that markdown is commonly used in the threads and is used for quoting
@vco re: sir-lancebot#722 , what do you think about moving the ping command to the uptime command's file? that way the original author will also show up on the file on github
wow smh @fervent sage linting errors
I'm gonna be totally honest, i really dont appreciate how you're talking to me like that, it seems very aggressive
no, sorry, it was meant to be like a ๐
ive already done the commit how would i do that?
do the thing where commits get reversed and then recommit into that file
is the proposal to put it into the spring cleanup branch?
oh right, so swapping the order that was done?
im not totally sure what you mean?
currently there's a commit merging both cogs, but the suggestion is i merge them the other way
right yeah
so you need to undo the previous commit, make the changes and then force push a new commit
git reset HEAD~1 to go back a commit
then make changes
git commit ... to commit
and then git push --force to update the branch
force push?
yes, you are altering history
mind blowing
then there's another issue which is that i did it this way round specifically because it makes more sense for 'uptime' to be in ping than the other way around
because we undid the commit with HEAD~1, which is git sugar for HEAD take away 1 commit
git reset HEAD^ 
what does this do?
same thing I think
Use the git push --force
that should be an otn: "use the git push force"
HEAD^ is short for HEAD^1 which seems to differ from HEAD~1 in which commit it selects
so you can do HEAD~ as well for ~1
Wouldn't you want to do --hard?
on this, imo it makes more sense to add a comment saying "The uptime command is from <author>" so that the placement still makes sense, given there was thought that went into the ordering originally
cc @balmy sparrow
Depends on if you're trying to unstage changes or erase them
Ah true
Anything works, I don't have an issue with where the commands are obviously, the issue was only making sure the original author gets their due credit
actually they arent on it anyway lol because of the folder rename from seasons to exts, so time to go commit hunting
oh oof
i tracked down the original commit and commented it in case anyone wanted to look 
hey, i have a question regarding https://github.com/python-discord/sir-lancebot/issues/719... even tho it was approved that we add new categories to the quiz command, are we authorized to also change some stuff, fix some flaws and add some dynamic programming? our current code can be found at https://github.com/cat-dev-group/sir-lancebot
Can you explain what exactly you mean by "dynamic? And which flaws you're referring to?
also remember, there is already a pr up on sir-lance which refactors this file, so have a look at it before doing stuff.
not hardcoding. like how i did VARIATION_TOLERANCE = 83
really? which is that and who made it?
I have no idea what that means. Can you give an example?
I agree, the commit messages aren't great
These commits are seriously in violation of our guide
I will close the PR if these commits are left as is
do commits have to follow guide in the fork as well?
oh no
Yes, since those commits get merged
then i really fricked up, i don't know that
the commits on the fork, will be same as that on the pr
No, but are you going to rename all of them before PRing?
yes, definitely
if it violates the guidelines, i'll go back tomorrow and change everything lol
Some of those aren't for Lance, are they?
they all are-
well this isn't merged yet, and we already started coding... oh no
i have this bad feeling
I suggest that you rename them now, and make sure to follow the guide in the future
that all shit broke down
i can't, it's late here
I didn't mean now now. But whenever you get the chance, it might be best to go back.
You don't have to do it immediately, but the sooner the better
Definitely before PRing
Alright, back to the question on hand
Defining constants like that is fine
yay
I'm still confused on this "dynamic" and these "flaws"
If the dynamic system refers to like switching numbers in math questions, that sounds cool as long as it works
yes, it works
also, regarding the https://github.com/python-discord/sir-lancebot/pull/618 pr, should we redo everything to make it fit with that?
You could just wait until that gets approved, since it seems to be rather far along. But don't delete the code, some of it would definitely be useful.
so i should just keep on going? knowing that it might all be for nothing?
Maybe take a look at Jason's code, and then see how you can change the code you have right now to make it work. But don't set anything in stone yet, keep in mind that things can change as reviewing goes along.
Keep in mind that that's a maybe
With all the reviews and what not, that PR is definitely approaching the final stages, so let's not make any huge changes for now
This should probably be a different PR as well
You can open an issue for that sometime
yes ofc, so should i wait for that pr to be approved first, and redo everything?
for now, just adding math and science questions shouldn't be a problem
you can do the "dynamic" part once it gets merged
in a separate pr like scaleios said
Yes of course, but I'd prefer just redoing the whole thing after your pr's approved, so i could do actual formal commits, implement the mutiple answers, etc. I'll just wait for now
I need to sleep now, i'll make an announcement and close the issue tmr
you shouldn't close the issue
just wait for the pr with the open issue
that's totally up to you ๐
Oki
Hey, that's not really relevant to this channel. This channel is for pythondiscord projects.
Check out #editors-ides
totally forgot that voice bans have tests too
@gritty wind you haven't awaited action here, should i do that in this pr? or it was not done for some reason
Which tests?
shouldn't it be just action?
yeah, just saw that, got it
notice the lack of parentheses
import asyncio
async def test():
print("The function")
async def main():
print("Started main")
x = test()
print("called test, but didn't await")
await asyncio.sleep(2)
print("slept a bit, still nada. let's await the function now")
await x
print("done")
asyncio.run(main())
I can't explain async, so here's a POC that explains the concept
yeah i got that, didn't see the apply_infrac function
and in the test below that is was just action, but it was a callable of user.kick already, defined two lines about that
we can suggest new features for Sir Lancelot right?
what if you could train a model for english and general help just with this discord server?
introducing machine learning to sir lancebot is something we frowned upon from doing so.
it introduces unnecessary complexicity
and getting human help is much understandable than a bot talking to you
We've decided against the use of any type of machine learning for helping as it'd be a unpredictable black box, unfortunately.
Thank you for the idea, though.
ah fair enough, yeah i guess since it would pretty weird if the bot started swearing since it learned it before lol
i wouldnt mind automatic help messages for d.py 
but i also have enough experience with ML and GPT-2 to realise what a horrific mess it can turn into lol
lol
lmao, really wanted to learn C++ i guess
lol
The exclusion from ML from lancebot or most of our projects isn't because it's risky at all, AI/ML is certainly battle tested. The reason is that it comes with several large dependencies, requires a lot of compute to train and is a big thing to maintain in an area which we don't have many folks familiar with
whoops
lol no worries
for some reason whenever i specify co author, the github actions runs twice
hey, i have a question:
my lack of experience caused me to write some pretty informal commit messages in one of the forks i was supposed to pr to sir lancebot. however, i've decided to abandon that fork and start over since the structure of the program i'm supposed to modify will soon change completely, rendering my code incompatible. when i open a new fork, i don't need to worry about my last fork, right? so i wouldn't have to re-write the 40 commit messages if i open a new fork after the code changes?
this is the kind of msgs im talking about lol
a fork is your own version of the repository. You can do with it whatever you want, and delete it as well.
If you delete the fork, you aren't going to have the commits as well.
A different solution would just be to create a new branch from upstream:main
you don't need to delete it.
If you didn't open a PR yet, you can also force push changes
and it'll override your git history
alright, i'm going to start over then
Yeah you could just reset (soft) to the first commit and force push it
no but it's not just that, the thing is i'm working on adding tons of stuff to .quiz command, but the literal structure of the file is undergoing a huge change so i gotta start over anyways lol
ten hours of hard work, poof
If you aren't on main you could delete the branch
i'd prefer starting over with a new fork
where is that change?
If someone is restructuring the file, it might be better to merge your changes first
Although those commit message are indeed not great
https://github.com/cat-dev-group/sir-lancebot/blob/main/bot/exts/evergreen/trivia_quiz.py here and here https://github.com/cat-dev-group/sir-lancebot/blob/main/bot/resources/evergreen/trivia_quiz.json, but no one's gonna accept that with those commit msgs... should i go rewrite them all? it'll only take like 2 hours and then i can send a pr...
really? but then their change would have to adapt to my changes lol
If you really want to rewrite your commit history, using rebase is a way better choice
Yes, someone will have to adapt either way, but I'm not sure that you having to adapt is the better choice here.
rebase?
:D i see a last strand of hope
Rebase is basically an interactive tool allowing you to rwrite your git history, like squashing two commits into one and changing the messages
Either way, conflicts like that should be brought forward before deciding to abandon your work.
ok, so how do i install rebase?
It is part of git itself
yes yes, i'll get to work with rebase and see if i can make it better
oh-
Before that, where is the structure change?
https://why.life-is-pa.in/5YD2no can we rename projects? (to update to Sir Lancebot now)
I think you should proceed with development as usual, as it mainly splits the file into several. Whichever PR is merged first, it should be fairly simple to adjust the other.
alright! thanks a lot! also, is it valid if i do a new fork, and put all my 40 commits into 6 or 7 logical big commits (like i have a completed copy, all i have to do is to copy it onto the github file)?
because 40 commits to rewrite is a little... too much lol
Whatever is convenient for you. As long as the changes in each commit tell the same story (described in the commit message) it works.
ofc! it will be way more detailed and formal than the little pieces right now
:D
Small commits are fine fwiw
yes, but then i'll have to rewrite all the small commits lol
But I usually opt for several big ones when I'm writing a feature
anyways, i'll get to work!
alright! thanks a lot!!! i abandonned this yesterday but i'm restarting today lol :D
@dry folio I liked your previous nickname "Wait... It's all objects?"
It was a good one
yes, i like it too
how would i write this part? i don't have a relevant issue
OHHHH OK
would this be considered a "valid" commit message?
Sure
yayayayayay
I mean
What is it then
the commit message is "Add 30 math questions and 30 science questions to trivia_quiz.json"
Pr or comment
i mean, it's better than "sciency stuff" lmao
He is talking about
Oh
@short snow why did you resolve https://github.com/python-discord/bot/pull/1446/files#r627739424? ๐ค
This one? It isn't resolved
I unresolved it
Ah ok
sir-lancebot#716 can be merged btw
grrr j9 beat me to it lol
Was gonna ping you to merge lol
missing a not broke the .mosaic command so I'll make a PR to fix it lol
Well, it isnโt working
missed a not there that's my bad
.mosaic 5
Your input was invalid: Squares must be a positive number less than or equal to 10,000.
Usage:.avatar_modify mosaic [squares=16]
!ext unload mosaic
:x: Could not find the extension mosaic.
yeah, the condition got reversed because i missed a not by the looks of it
.mosaic -5
Aha
.mosaic 20000 works
can you send a PR in ?
Just not anything below 10,000
toxic's on it
Reminder that all commits should be tested in a PR before approval is given.
I tested it but it wasn't broken for me ๐ค
ngl 20k seems very nice
yeah my bad, was careless
We want to avoid user image inputs as much as possible
It's both of our faults because I forgot to pull when testing it
Yes but it is moderated discord wide
#476196547324018688 if anyone with access wants to test the hotfix
You guys saw nothing 
@sleek steppe those .mosaic subtitles are ๐
@sleek steppe lots of people having fun with the command in #sir-lancebot-playground
great because it starts from one person and then everyone tests it ๐
heh it's fun trying to spot it in the usage
@balmy sparrow gooood call on if it isn't a perfect square you get the next nearest, makes the command much more fun to use
ahh thanks :D
I feel so proud of that math there
||Definitely didn't copy it ||
although i'm still so embarrassed about that condition
haha, it's fiiiine
lol wait is that gonna trip the resource limits i wonder
keeping my eye on #dev-ops-notifications
Doesn't the max_workers=1 allow 1 concurrent image command at a time
@vale ibex It's that Lance isn't receiving the USER_UPDATE event
yea, I thought fetch_member deals with that, since it's an API request
rather than going through the cache
I see a bee there.
discord.py does something it technically shouldnt, which is make people think that members have things like id, avatar, etc
ahhh, so the cache is appending the member extras to the fetch_user call?
discord doesnt necessarily send you the member's internal user object tho
I thought why I was blocked by api discord... But in fact it turned out to be repl.it... Helped kill 1
so the member's user field is filling from cache
hmmm
It doesn't update it?
fetch_user should work
lemme see if we use anything attribs of the member obj
We use member.display_name
but IG we can just change that to use ctx.member
rather than the fetched user
I'll make the changes and spin up a bot in the test server
actually im wrong on this, however discord.py doesnt seem to update cached users from fetch_member, and then populates the member's user details by getting from the (non updated) user cache...
???
You mean author right
ye, that 1
Hi, if I have an idea for an "experimental" feature that would be "fun to try", do I submit an issue to sir-lancebot or how do I discuss the possibility of a contribution?
you can submit an issue yeah, though we can likely tell you here if its the sort of thing that fits lance
discord/member.py line 220
self._user = state.store_user(data['user'])```
(after which you can create an issue :P)
:)
I thought og lance since I'm a beginner at contributing but it's possible that the feature is more of a utility than "fun".
Basically I want a way to keep track of the help channels I've interacted with in the last x minutes/hour. It may only be an issue for me but I've "lost" several discussions because I forgot which channels I participated in.
I could see if fetch_user makes a difference
I'm working on it now
i've got it implemented on 8bitify if anyone with access wants to play
something like this: https://github.com/python-discord/bot/issues/1567?
?
That sounds about it!
#null
thats been discussed, and i think the tl;dr was along the lines of "for the few people who actually knew about the command and could benefit from it they may as well use discord's search bar instead"
Yeah, having an easier way to narrow down where you've been helping recently is something that's been requested
We're discussing it and possible other solutions at our staff meeting this Sunday
Can I search in just help channels? It would be neat If iI could get a list and a link to my newest post but that may be a nice to have.
Oh sweet, so then it's not only me. :)
Yeah, discord's search isn't really robust enough if you channel hop enough and have longer convos elsewhere
Could one request a bot to simply at one whenever something is said in the same conversation?
Or DM as I guess the issue was about, sorry, haven't looked through it yet.
so, let me grab some screenshots of some of the other proposals
Those are the other 3 suggestions, each with their pros and cons
Wow, it's indeed not only a "me" problem, good to hear, and some great suggestions.
yeah, definitely not only a you problem~
without actually reading the content that sounds really funny to intentionally ghost ping people 
lol it's a definite no
A new helper wouldn't understand the ghost ping
All of these are still on the table so-to-speak. Will be a topic of discussion this Sunday and following days.
tho i'd rather the ping stays until i click a reaction on it to yeet it, on second thoughts
That could be confusing to the claimer
That's awesome, thank you for the info, happy to see that things are being done. :)
yeah, thanks for recommending a suggestion too! We value that kind of feedback
Well, I'll just have to think of some other "fun" feature then. ^^
@thorny obsidian Sorry if I'm being slow but what did I do that was good? ๐ฌ
suggesting new things is good, it helps the community evolve and get better for everyone :P
come to this channel and make a suggestion!
Aah! Got it, thanks. :)
It's something I value, if members of the community feel comfortable enough to suggest improvements that's typically a good sign
I mean, I was nervous about it, because well, new experience. But the contribution guidelines feel very friendly so decided to give it a go.
yay! That's good to know
It basically says don't hesitate to ask, so then I banked on people actually expecting questions. :)
So yeah, good work with those.
Description
This is because discord.py would populate the user portion of the fetched member with cached information which would cause the avatar url not to be updated as we had intended with that...
step 1: get a large guild
use a command, change your pfp and then use the same command
Um, I think I implemented that, will have a look,
make sure you don't have member intent enabled
peeps in the test server feel free to use my bot, ill leave it on
chriiiiisssss :)
crashfile-detector#1
:P
hah it's a bit pointless now though
New project ๐
I am late, it started 4 days ago 
hasnt been fixed downstream yetโข๏ธ
We didnโt change the mosaic command ๐
what's this referring to?
about the color?
same, blue looked good
The color of the embed is not critical and fine. Changes requested should be made with more reasoning than "I don't like the color"
I was saying it to use the same colour as 8bit
And yeah it was a very optional one, got no comment, so thought it got skipped
well*
got it
actually not really honestly
its happened multiple times
see my comments after that message
the bug that caused it has been fixed in chromium now, and will be backported into Discord soon
I did
so we won't need something like this
nah, we're still not certain if we want to include it in our infra
so it's not really something we're actually working on
another thing about it
more of a proof of concept
yeah
just that
nothing more
since it should use head unless that doens't work then it should get
because a smart person could skip this by not implementing head requests
idc you can make an endpoint that blocks head requests
which means that it wouldn't work
again, PoC lol
Yea, and exactly what we'd do in that circumstance is unknown
like we could block by default
I'm gonna fix some merge conflicts on spring-cleanup now ๐
this is based on a gist that I wrote recently and we've stuck it in a fastapi app, we're going to talk about how/whether we're going to use it in a staff meeting at some point
Oh I'm surprised there's only one conflict

huh nice
lmfao
Do we only use """ for multiline docstrings?
probs not if I had to guess
Because shivanth commented here https://github.com/python-discord/sir-lancebot/pull/718#pullrequestreview-652970218 and I'm guessing I should just leave the '''
well it took like 2 minutes to fully lint
interesting
i'm not sure if this is normal
yes exactly!!
the last one took 2 mins, this one was after i merged the new updates into this branch (sorry i didn't specify that)
interesting
yes this one! @patent pivot
yeah
image = next(
(
url for url in data["image_list"]
if url.endswith(self.valid_image_extensions)
), emoji
)
Does this look fine lol
It shouldn't happen often, since the cache is normally used
alright, thanks!
either way, i fixed all the lint errors and so the pr is ready for review :D
The ones on bot take longer than that lol because of the tests an generating coverage reports
_iter = (
url
for url in data["image_list"]
if url.endswith(self.valid_image_extensions)
)
image = next(_iter, emoji)
hmmm
not sure which looks better
I'll use that one, thanks
wait this is valid code?
What makes you think it isn't?
lol
this one looks better
I'm genuinely curious, since I wrote that in discord's editor, so it could very well be wrong ๐
Yeah I included it in my commit
Hi, I got Sir Lancebot up and running locally and when I ran the .help command the "navigation" disappeared after a while so I didn't have time to read through all the pages. I just tested on the actual bot and it's the same. Is this the expected/necessary behaviour or is there room for improvement?
It eventually times out and removes the reactions
what is it even tracking lol
oh, I see
yeah this isn't used at all
Closed project, we can always open it back up if need be
Ah, I figured as much.
although I don't think that will be necessary
cheers for the QoL fixes @clever wraith
Ay, was hesitant on the extensions one since it was pretty nitpicky although I wonder if i should've iust gone with !raw's approach of adding zero width characters instead of escaping all markdown
what command did it edit?
bot#1571 and bot#1572
The first one, yeah
Any markdown would affect it, wouldn't it?
I had implemented that locally, but there was still a small bug in it: #dev-contrib message
Honestly I think I have 20 tests failing locally but not inside the CI, sooooo
Ok, but please push changes before marking as resolved ๐
I can't see the changes you make locally
ah ok, i used to mark changes as done, when i finish them locally, would remember that next time.
do you know why that test fails tho, the link i had linked in the above msg, i do convert it to str, but doesn't get converted for some reason
Why are you inserting self?
that's what is followed in all tests of incidents, so i followed the pattern it is not needed, dunno how it got added into mine
I'm genuinely asking, I suck at unittests
Also, if you can't push the changes because you have a bug, then you're not really done.
@green oriole can you explain to me the downside of using channel.history in your PR? it just seems much simpler and cleaner
We have like a max 10 messages in that channel anyway
Well I just avoid fetching one too many message
Manually breaking would just add more code
Add? Not really. You'll ditch the suppress and the multi-line next
That's almost the same idea as doing it manually
one second, messed up commits, will fix it
It's the same idea, it's just less readable
Is it less readable? I could add a more in-depth comment
ok, should be fixed now zig, also i think you forgot to reply on https://github.com/python-discord/bot/pull/1446#discussion_r624363552
akarys here, https://github.com/python-discord/bot/pull/1446/files#r615390833, should i check for webhook is None, directly after the fetch line? and log level should be error?
I think
async for new_message in message.channel.history(before=message.created_at):
if messages[-1].created_at - new_message.created_at > timedelta(seconds=2):
break
messages.append(new_message)
Looks much clearer than:
with contextlib.suppress(NoMoreItems):
while True:
new_message = await message.channel.history( # noqa: B305 - yes flake8, .next() is a thing here.
before=messages[-1].created_at,
after=messages[-1].created_at - timedelta(seconds=2)
).next()
messages.append(new_message)
This combination of suppress, infinite loop, and creating an iterator in a loop for a single next just seems like a code smell tbh
Especially when an async for is an adequate replacement
It will break if it reaches the end of the channel though
how will it break?
If there is no message I'm pretty sure it, I'll raise NoMoreItems
Shouldn't that just stop the loop? like StopIteration stops a for loop
Wait no
That's not what history does
it'll just return an empty set of messages and the loop will end pretty sure
tnx
Hi, I'm setting up my test server to work with bot (already have invited and successfully ran sir-lancebot) and am struggling with the configs. I don't fully understand which channels, categories etc my server needs. Can someone post a screenshot of their working test server or is there some other way I can get "confirmation" that I've got the things set up right?
Are you trying to set up Lancebot or Python?
And the guides on this page explain everything you need to do: https://pythondiscord.com/pages/contributing/
@vocal prairie Python, Lancebot already works. I'm in the middle of setting up Python and find the setup somewhat challenging.
In your config.yml, change these sections
style.emojis
guild.categories
guild.channels
guild.roles
guild.webhooks
Did you use the template?
discord.new/zmHtscpYN9E3 is the template that helps
I've been trying to get the template but didn't catch the part where it opens in Discord. I've just been forwarded to discord.com/channels/@me in the browser. In my defence I'm on a 14" laptop and everything is a bit of a mess... ๐ฌ
Well then, that worked, thank you!
๐
A few more issues; There are two "video" roles (green and grey) in the template, which id do I add to configs and does it matter? I can't find roles for project_leads and domain_leads. Do I create these and are there some specific permissions etc these need?
You donโt need to add everything in the config
Follow the guide on the website as it has all the sections you need
Thatโs a relief ๐
If in doubt, guess
Iโve been doing that though, and it says to look in config for the sections to set up
How do I deal with webhooks? Can I ignore them in config or should I create them and guess the channel they should post in?
You donโt need to create anything if you use the template
Everything is created for you
The only thing you need to manually add is the trash can emoji
Ok, there are no webhooks in my server using the template so I just ignore those in config?
Yea, my dotenv just looks like this ```
BOT_TOKEN=
BOT_GUILD=476190141161930753
USE_FAKEREDIS=true
REDIS_HOST=redis
BOT_DEBUG=true
PREFIX=&
AOC_ROLE_ID=651730380898041862
BOT_ADMIN_ROLE_ID=476190234653229056
LOVEFEST_ROLE_ID=795910065424171028
ROLE_HELPERS=476190429960732672
AOC_CHANNEL_ID=476190141161930755
AOC_COMMANDS_CHANNEL_ID=476196062214750219
CHANNEL_ANNOUNCEMENTS=476196024512413698
CHANNEL_COMMUNITY_BOT_COMMANDS=476196062214750219
CHANNEL_DEVLOG=476196115432210443
This is for @stable mountain
This is strange because my server definitely had the webhooks
Anyways, skip them for now, add them later if the bot doesn't start
Iโm just not very good at this. ๐ฌ
It can start without it
But I got Lancebot up and running, yay. ๐
This is indeed a more intermediate levelled challenge.
We hooks arenโt, you need to make them
How do I know which channel they post in, or do I just guess?
Post what?
Webhooks post in a specific channel?
The channel doesn't matter, and the bot starts fine without them. You can add the IDs as you need them
Excellent, thank you!
Are u setting up bot and Lance?
Yes, thatโs the plan.
Oh ok, running with docker or pipenv?
Havenโt used Docker yet, just installed it but got Lance running with pipenv.
Iโm on Unbutu 20.4 via WSL2
Yeah Lance is pretty simple to run, bot is where the challenge comes ๐
Mmhm
That OS doesnโt matter, until u are on windows
Haha, I mean, I am on Windows but not more than I can help. :)
Docker is easier for bot imo
Since bot has a database and stuff, that can be hard to set up
But, slower and more resource taking, in my case
Thatโs what I started to realise, hence my downloading Docker desktop.
It works well enough on my 4 gig ram computer
Wow
I run site with pipenv and then run bot with pipenv, so works well
Yeah same, 4 gig ram here
I havenโt started to look at site yet, maybe I should? Do I need it for running the bot? I just updated my hosts file but am still in the config step. Havenโt attempted to run yet.
You need it running, but you can use the docker compose for that
Yeah, site contains the api, which is needed for the bot
There are plans to separate tho, and it is a work in progress
Oh, definitely Docker then...
I run it normally without docker, never went through a problem
It's no problem to run locally, but docker is certainly simpler considering it provisions postgres
Also if you want to be pedantic it's closer to the production environment
Iโm rather new to Docker so this should be an excellent opportunity to get familiar with it.
๐ช
So technically, if I use Docker, I only need the BOT_TOKEN in .env?
Yeah BOT_TOKEN
and the site token
BOT_API_KEY=badbot13m0n8f570f942013fc818f234916ca531
But thatโs set by Docker?
It is set in the docker-compose
But I assumed you are running the site using docker, and the app using pipenv
It is? Nice
I do something similar so I can use my IDE's debugger
If u run with or without it, u only need token and bot api key
api key is set in the docker-compose, so if you do a full docker-compose setup, you technically only need the token
That was probably what I meant. :)
incredible token
The forms frontend is really nice.
Whoever worked on that, you did a wonderful job!
hmmm @vale ibex what does local dev of the metabase cog look like
if not configured will this just error out when the DNS lookup fails?
I've made it so that it you don't give the username and pass env var, the cog won't load
If you give them, but don't change the url, then it'll error out on dns ye
ahhh I missed that
@vale ibex 
Oh yea lol
That was so that the link wasn't sent in the test server
Didn't want to leak anything
Probs should have removed / mentioned that lol
lmfao
What is this lol
from bot#1573
for .mosaic, i think a cool parameter is to mosaic other peoples avatars
.mosaic <number of squares> <optional user tag>
We need to bump license year of bot
It was already discussed and deemed unnecessary
because?
ahh okay, thanks
This is an obscure PR bot#1573
what does it even do? Does it just upload the data from metabase to a pastebin ?
https://github.com/python-discord/sir-lancebot/pull/583#discussion_r627074804 could some staff un resolve this comment
Done
Noice ๐
Hi, Iโm trying to run Python bot with Docker on WSL2 Ubuntu but canโt connect to Redis. Iโve used both use_fakeredis=true and USE_FAKEREDIS=true in .env with the same result.
bot_1 | for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
bot_1 | socket.gaierror: [Errno -2] Name or service not known
bot_1 | 2021-05-09 14:01:43 | bot | CRITICAL | Could not connect to Redis. Is it running?```
Yeah, I came across that problem too when I set it up, could u share your config?
Just a sec
So I just changed use_fakeredis to true in config.yml and have a new issue instead, yay.
redis:
host: "redis.default.svc.cluster.local"
password: !ENV "REDIS_PASSWORD"
port: 6379
use_fakeredis: true
``` Or do you need to see the whole config file?
Ah, because that's my new issue, now it can't connect to the site API.
what's the schema set to?
2021-05-09 15:31:29 | bot | CRITICAL | Could not connect to site API. Is it running?```
```yml
urls:
# PyDis site vars
connect_max_retries: 3
connect_cooldown: 5
site: &DOMAIN "pythondiscord.local"
site_api: &API "api.pythondiscord.local"
site_api_schema: "http://"
site_paste: &PASTE !JOIN ["paste.", *DOMAIN]
site_schema: &SCHEMA "http://"
site_staff: &STAFF !JOIN ["staff.", *DOMAIN]
paste_service: !JOIN [*SCHEMA, *PASTE, "/{key}"]
site_logs_view: !JOIN [*SCHEMA, *STAFF, "/bot/logs"]
# Snekbox
snekbox_eval_api: "http://snekbox.default.svc.cluster.local/eval"
# Discord API URLs
discord_api: &DISCORD_API "https://discordapp.com/api/v7/"
discord_invite_api: !JOIN [*DISCORD_API, "invites"]
# Misc URLsw
bot_avatar: "https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_circle/logo_circle.png"
github_bot_repo: "https://github.com/python-discord/bot"
It should be web:8000 for docker iirc
and api.web:8000 for api
See the contribution guide on site
I've been doing nothing but looking at that for two days but I started out without Docker so I guess I forgot to change again once I decided to use it.
Ah ok ๐
Thank you for pointing that out, here we go again...
OMG thank you!
It finally connected, I was so close but had forgotten about changing config for Docker... Really appreciate the help.
No problem 
Wow I'm silly, it even says to change it in the config file, I guess I went for .env since it's in the environment variables section, just like the guide for Lance.
Now there's an issue with running tests - all but one fail. I guess this is because I'm using Docker? Do I need to run locally to run tests?
I did read and follow the instructions of the test guide: https://github.com/python-discord/bot/blob/main/tests/README.md#tools
I believe I also had a test failing locally previously, you can just ignore it if it's not related to the code you're wowrking with
I've yet to get to working on some code, getting it up and running has been an adventure on its own. But that feels comforting, I guess I can try and "do something" and see if I can get a test to pass.
I didn't really look into why it didn't work
@brazen charm Did you too run the bot in Docker?
No, I run it directly
Ah, so then it's not necessarily a Docker issue.
Congrats @fervent sage ! ๐

Congrats @fervent sage!
Welcome to the green team! 
Congrats @sleek steppe @fervent sage
welcome to the yellow team too 
Which test is failing, and tests donโt depend on docker, so itโs the reason it fails
Hey @merry ember!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
โข If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
โข If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
@short snow https://paste.pythondiscord.com/itesotewot.less
That was just to get the names of the failing tests but I'll run again. ๐
Yeah, I wanted the details
Oh, i asked if you wanted the trace backs in the first message but think it got lost since I couldn't post it..
Do you want the trace backs for a new run?
try changing the perms of the log folder
sudo rm -r logs/ && mkdir logs && touch logs/bot.log seems to fix this
Stel had the same issue earlier
Had used this and it had fixed it
Lol go on..
You can ignore that
Woho
Wow, I never thought I would get stuff to work.
And this is just on the PC, I have a Mac too... ๐
Lol, it is indeed bumpy, once u get into contributing to bot, I am sure u will switch to pipenv
Just do the same steps, will work out
I think for now this will be my dedicated bot machine..
Is it preferable to run with pipenv? I was afraid to use Docker but now I'm more afraid to set it up with pipenv.
It works with Docker, finally, I was just wondering whether I should try to get it to work with pipenv too.
Why use pipenv if you can use Docker?
I don't know, that's my question... I think @short snow hinted that that would be a good thing to do.
because docker comes with more overhead and slower restarts
But that's not that bad
Personally I would prefer to run it locally, feels like I have more control, but given that I don't know what I'm doing, Docker is fine.
I run locally because it allows me to run through my IDE, and my debugger
But do whatever works for you
Docker is used for production environment and not really useful when u are developing
True
It's better for prod unless you set it up with a multi-stage dockerfile. Then it's better (at least for my personal projects)
Running two pipenv run start (site and bot) is faster than running docker, imo
You may have special circumstances, but most people I've helped set up the bot, and me, have the containers up in seconds
You don't have to convince anyone though
Ultimately, it comes down to preference
Umm, it is up in seconds, but I still feel pipenv is faster, yeah personal preference
As long as your code is fine, no one cares how you run
There's a planned migration to poetry for Lancebot, right?
Yeah
There's already a PR opened for it
The reason it's pending is it's a 3.9 migration as well
that is waiting on one dependency
Joe 
I've PRed the 3.9 dependency a couple days ago
it should be updated on pypi soon
Then I've got a PR ready for bot as well
Pr link?
Wonderful
Just checking; From this I take it that I have to wait around for a new good first issue to become available? https://github.com/python-discord/bot/contribute
The good first issue are usually issues that are easier for getting started
but they aren't required
I've been "doing" OS before, but not on a "real" project so am a little fuzzy on the procedure.
Have a look through this page
If you see an issue without the s: planning tag, and want to take it
Leave a comment
You'll get assigned if there are no problems
Ah, without the Assignee?
Yep
I mean an issue that isn't in planning and doesn't have an assignee?
If something is assigned, you could ask the author to collab on it, but that's up to them
yeah
Ah
i lost my config file for bot

We have one on notion for the staff server
oh yeah the staff server exists i definitely rememberd that
personally don't use it for development
don't need everyone seeing how good a programmer I am

How can I add the proper emojis to my test server?
Ok
Alright, it is working now
def partition_text(string: str, max_chars: int) -> List[str]:
"""Return partitions of string with less than max_chars characters."""
if len(string) == 0:
raise ValueError("String cannot be empty")
partitions = []
index = 0
done = False
while not done:
partition_start = index
while not done:
start_index = index
while True:
if index >= len(string):
done = True
break
if string[index] in BREAKABLE_CHARACTER:
index += 1
while string[index] in BREAKABLE_CHARACTER:
index += 1
break
index += 1
if index - start_index > max_chars:
raise ValueError(f"Word {string[start_index:index]!r} is larger than max_chars ({max_chars})")
if index - partition_start > max_chars:
index = start_index
break
partitions.append(string[partition_start:index])
return partitions
I guess once commented it shouldn't be that bad? It is probably more readable already
Eeeh, I'd like to try and get the current implementation to work first
so give me a bit
3 nested while loops 
Yeah I'd rather exhaust other options before opting for this
so whats the goal? just split a long string into a list of strings broken up on a break character?
Commented version: https://paste.pythondiscord.com/oruzocohel.py
basically textwrap.wrap
hm, but what? if its basically that why not use that?
I'm not sure
im guessing its the BREAKABLE_CHARACTER that makes it incompatible with wrap
Gotta run
I'll give you an update if I figure something out
pain:
yaml.scanner.ScannerError: while scanning for the next token
found character '\t' that cannot start any token
in "config.yml", line 281, column 1
everything was going so well until it wasnt 
ive updated it to be spaces on notion
Hello again... Running bot tests goes splendidly, but it seems like the fix I did to run the tests now has broken running the bot...
ERROR: for bot Cannot start service bot: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:495: container init caused: rootfs_linux.go:60: mounting "/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu-20.04/8925b0b7a1cb21fef2aea7d49c967f40547df4b488732886b5221703b6c28c1e" to rootfs at "/var/lib/docker/overlay2/030f3260f6d15a90093897c6ed603b98fdd514a97664f139cb4aad31f59da22c/merged/bot/logs" caused: no such file or directory: unknown
ERROR: Encountered errors while bringing up the project.```
remove the container and rebuild it
Will do
also do a volume prune
A what?
it's a command
docker volume prune
It'll remove any unused volumes
do that after removing the container
Thank you, both bot and tests run now. ๐
I've just started looking, I don't know if I'm ready considering the pain it was just to get the thing working...
I just added the trash can, got a bit side tracked and then noticed that the bot wouldn't run, again.
Yay, my trash can is working and I'm so happy. ๐ฅฒ
:)
Ping doesn't work locally
Nice bot name
I have an issue opened for that
ah
well the main point was to see if the bot was really alive which it thankfully is
@green oriole
At https://github.com/python-discord/bot/pull/1549/files#diff-6226fd47d9677af7c1a68077c7229358b3e0c4b9bae7c71e8ab61fda1530320bR146 you shouldn't join with an empty string. There should be a space by default, and a newline if the previous partition ended with a period.
At https://github.com/python-discord/bot/pull/1549/files#diff-6226fd47d9677af7c1a68077c7229358b3e0c4b9bae7c71e8ab61fda1530320bR179 try adding placeholder="".
This should deal with the formatting issues I've seen.
How do I tell Lance the trash can emoji ID? Don't say I've missed this too in the instructions...
I know, but where do I "set it"?
I works for bot, which is awesome, but I suspect Lance also needs to know about it.
TRASHCAN_EMOJI