#dev-contrib
1 messages · Page 84 of 1
wooohooo!
atlast now cht can work in help channels
@vocal wolf they are no longer in this server, ak said so
i wanted the list of anthems they had collected
rip
I'll see if they respond
I think this would be a cool feature. If anyone's interested, you can give it a poke. https://github.com/python-discord/sir-lancebot/issues/73
hmmm
Also tagging @short snow Hey! Sorry this is actually already implemented, I'll reply on github as well. You can search for 'prideanthem' to see example usage,, unless there's something else going on?
(It was PR #227)
Hello, and welcome back! I don’t think anyone is working on it right now (CC @vocal wolf), feel free to open a PR if you feel like it. 😄
Oh no, I'm saying the issue is out of date. I already submitted a PR to implement that command, and it was accepted and merged in
Oh, it is already implemented
Yeah :D
The PR was already implemented in sir-lancebot#227
Not to say there's no added functionality you could work on if you wanted ^^
Is there anything in the issue that hasn’t been implemented yet?
I don't remember if I implemented a way to refrain from repeating songs quickly, and I'm sure there's more songs out there to add now, there was a suggestion to include a foreign or foreign language flag to include to allow/select pride anthems in other languages, I don't think I did that
And then there was the unanswered question of support for adding more pride anthems through the command (e.g. .prideanthem add <song info> rather than through prs
I'm actually heading to bed right now though, but feel free to tag me in any questions and I'll get back to you tomorrow :D
Alrighty, have a good night!
What's the brief and help parameter for @commands.command() for?
Help parameter basically overwrites the the docstring on our @commands.command() function
and
Brief is The short help text for the command.
Patience you must have my young Padwan
ok
What's the difference between the help parameter and regular docstring?
Don't really understand that question
It's just the difference between
@command(help = 'This is a good command')
async def command(ctx): ...
And
@command()
async def command(ctx):
"""This is a good command"""
...
So the only difference is where the text is placed?
should I wait for my issues to get approved, or start on the PR?
yes please, that way there is less wasted work in the event the issue scope changes
sometimes for making it easier to understand code, coders incldue their explaination of the code, which is unncessary for the other ppl in the community to know
hence you use the help parameter to override it
like this ^
@command(
help = 'Docstring that the community members would see when do a help on the command',
aliases=(...)
)
async def command(ctx):
"""Docstring that contributors would see when looking at this pr."""
...
is github webhook every going to update my profile pic 😤
You need to clear the cache
and how do i? on desktop ubuntu
Clear ~/.cache/discord maybe?
ok
hmmm?
edited
@gritty wind how were the changes i made?
Haven't had a chance to start reviewing things today yet
I'll let you know when I get around to it
ok
@gritty wind so how is it?
I'm still working on other things, haven't gotten around to it
@serene flare are you ChrisLovering on GitHub?
that's the other chris lol @vocal wolf
darn
bot#1416 needs review(s)
I think it's @vale ibex
You are correct
Sorry to disappoint!
Chris with an underscore is Wubbzi
correct
i would like to improve @dusky shore 's xkcd command
git checkout -b feature/name
ok
should there be a command explaining .whl files?
and this site https://www.lfd.uci.edu/~gohlke/pythonlibs
For sir lancebot, is there a way for the evergreen error handler to not give out the error ERROR: Unhandled command error:
I have have handled the error on the cog, but for some reason, the evergreen error handler is still triggered
@gritty wind how were the changes I made?
Again, I will tell you when I get around to reviewing it
Yes. Set the handled attribute on the exception you handled to True.
Wait, so like error.handled = True?
Yes
That's neat, thanks
What's the command to see the help message for a cog?
Or do I have to manually make one?
<prefix>help <command>
where would that be put? In our cog error handler right?
@vocal wolf can you put a image on how the pypi looks now?
the pypi command of bot
No. The error handler is coded to ignore errors that have that attribute
ok thanks!
You need to set it in your local error handler
ok thanks Mark!
For sir lancebot, is it possible for the help parameters of commands.command to display a list of arguments one could make?
For example, I have keys in a dictionary which are the arguments the user can put into the command
hmm how can I use a converter without context?
@vocal wolf #bot-commands message we forgot something, we need to escape the *.
or they would get bold or in italics
🤷
cool, np!
again, it was vester who caught the edge case
idk how he always does that.
If the converter doesn't require any info from context, it should be a simple function, right?
Otherwise, it doesn't make sense to call a converter without a context, because it needs some info from it
it doesn't use the context from what I see
@cold island Does it do any async actions?
@cold island https://discordpy.readthedocs.io/en/latest/ext/commands/commands.html#converters
discord.py allows any callable to be used as a converter
but if you need async stuff or access to the context, you need to make a class
it doesn't use anything async
Then why isn't it a function?
🤷♂️
@cold island I guess you could
a) make it a function;
b) extract the conversion logic into a function that will be called in two places;
c) just copypaste the logic, because the fact that your algorithm matches the converter could be a coincidence.
d) pass None or some other garbage for ctx in the converter method, but that's evil and should not be done
But then I have to change all places where it was used 😔
c isn't the case
then b)
I'm passing None rn but it's pretty meh
ugh
👀
Well, it has the obvious disadvantage that if the converter starts requiring the context, your part will crash and burn.
So maybe just extract the conversion logic into its own method/function?
it really has nothing to do with dpy logic
What do you want to convert?
DurationDelta
can you give a link?
Isn't that a custom converter
it is
oh jesus
why the fuck is it subclassed lol
mamma mia
It's like Ellipse(Circle)
yeah lmao
It does make sense if you follow the logic 🤷
git blame someone
That's an interesting problem though
I'd say move the logic out of the converter to an util
@cold island @green oriole This is how I would do it if backwards compatibility should be preserved https://paste.pythondiscord.com/usuhunewev.py
no
It can be a simple callable
(i.e. a function)
yes, if you scroll up you'll see allowed_string
Let's make it a function then, there's no point in having a class
Well, apart from the subclass, but we can work around that
yeah, it's just going to massively clutter the PR
That's a good solution IMO apart from the PEP8 breaking constant name
Read the hastebin snippet above ^
I don't think that should stop us from making the needed changes
This is how I would do it with just functions (backwards compatibility broken) https://paste.pythondiscord.com/isocedahad.py
Can it be used in a union?
hmmmmmmmmmmmm
Not sure, can you try?
Putting a function in a Union is certainly a brutal hack
I don't see why not though
because it's not a type
@green oriole my god I didn't L I N T
and it's abuse of typehints
Bad developer smh
not again lmfao
Haha
@green oriole bing bam pow
Very good
I guess you could do something like
def to_class_converter(converter: Callable[[str], T]) -> Type[Converter]:
class _Converter(Converter):
async def convert(ctx, arg: str):
return converter(arg)
return _Converter
but it's #esoteric-python
IMO the converter interface is object-orientation abuse (which I already said). It uses classes that should really be functions.
@green oriole does it even need another review?
🤷
Damn, increased coverage
merged before the bot could even react
That's so silly haha
fastest PR in the west
@obsidian patio thank you for finding the edge case of the PyPi command. It has been resolved.
one minute lemme have a look
already merged
Not sure what I found, but happy to help hahah
Aaah, I see it now, if we’re thinking of the same thing
@green oriole @vocal wolf what’s the current state of the #779073065560703007? Any plans?
Me and Ak are planning to discuss it sometime to see what we can do with it
Alright, sounds good
For sir lancebot, is it possible for the help parameters of commands.command to display a variable list?
I have a dictionary and its keys are the arguments of the command
So I would like to display that to the user
Is it possible to somehow put the dictionary into the help text or do I have to do that manually?
I entered the command .bemyvalentine in a wrong way and still there is a 30 min cooldown. can you make cooldown such that its only applied if the command worked successfully.
#sir-lancebot-playground message
I did this, and they gave 30 min cooldown. (command didnt execute correctly cause of user's mistake -> still a cooldown). was it intended to work this way?
yeah, it is just used like a normal variable
which has a string assigned to it
Example?
Can u give an example of how u want it?
Like do the “can” part and i will see if that is right or wrong.
"""
The rhyme scheme is made from characters separated by slashes. E.g "abab/cdcd/efef/gg". The slashes denote a new stanza, i.e, they create a new line. Same characters mean that the lines rhyme. Note that the characters are case sensitive! For example, a and A represent two different rhyme schemes.
You may also use our existing rhyme scheme templates:
+ shakespearean-sonnet
+ couplets
+ ...
"""
I currently have the list at the bottom manually typed in
@green oriole @gritty wind @eternal owl sorry for the ping but can sir-lancebot#575 be reviewed as soon as possible as the valentine has only 15 days left
templates: Dict[str, str] = {
"shakespearean-sonnet": "abab/cdcd/efef/gg"
}
This is what the dictionary look like
I just gave my final exam, I will review it tonight for sure @short snow
Ok, so this is about the help paramater for commands.command and not the doctstring for a function.
You can do it like this:
!remind 2h30M review 575
Your reminder will arrive in 2 hours and 30 minutes!
@commands.command(
help=f"""
...
{''.join(x for x in x)}
...
"""
aliases=("poem",)
)
async def love_poem():
,,,
Ah I see, alright
Np! Hope they went well 
You rang?
I did, we're good tho
pypi command was merged
and now is up and running
All conversations were resolved in the end
🎉
!source pypi
Provide information about a specific package from PyPI.
here's the final product
Ooo fancy itertools.cycle
ye lol
well this is kind of annoying. I want to use the Duration converter which returns a datetime, but when I want to use a method of datetime on the result it complains that the variable is of type Duration.
Maybe putting converters in annotations wasn't the best idea ahem
Is it possible to use Annotated?
what does the code look like? I don't understand why it happens
# MyConverter converts to an int
def foo(bar: MyConverter):
print(42 + bar) # error; bar is a MyConverter, can't add to an int!
def bla(duration: Duration):
print(duration.isoformat())
isoformat belongs to datetime, but duration is of type Duration as far as Pycharm is concerned
exists, but bot is not on 3.9 yet (right?), and AFAICT discord.py doesn't support it
Isn't this the converters.Duration converter?
yes
Commands for managing your reminders.
Well, it works, it's just that the type checker can't tell that it's right
Ahhh
because it's type annotation abuse
yeah it's just annoying to not have the auto complete and see the yellow highlight
You can typehint it again I guess
duration: datetime at the top of the function body
Maybe you could do something like
from typing import TYPE_CHECKING
if TYPE_CHECKING:
Duration = datetime # or whatever type it converts to
else:
class Duration:
...
anyway, any solution is probably a hack
not sure duration: datetime will work
maybe ```py
assert isinstance(duration, datetime)
@cold island You could make a datetime wrapper that would also inherit from Converter and have a convert method, but that's worse
Could we do that directly in the converter file? That could be a good solution
IMO using annotations like this is abuse of notation, with the obvious downsides that
a) type checkers will not understand WTF you're doing, which renders our thoroughly typehinted codebase much less typesafe
b) if you want to make a union converter or an optional converter, you have to use class-based converters
c) will it work with delayed evaluation of annotations? (which is default since 3.10)
lmfao
!pypi aiohttp?sql=drop+table+students&
tis a shame
@vocal wolf Don't substitute URLs with format. It's almost as bad as formatting SQL with f-strings.
You should use facilities built into aiohttp.
don't we format urls through format a lot throughout the bot?
maybe we do, we probably shouldn't
Especially in places we pass some token and such
We don't pass a token for this one
URL = "https://pypi.org/pypi/{package}/json"
^ aiohttp?sql=drop+table+students& gets substituted here, and we get
https://pypi.org/pypi/aiohttp?sql=drop+table+students&/json
Sure. But people are going to look at the code base and look at how dynamic URLs should be generated, and they'll see format.
How should we do it?
Here I don't think aiohttp will help, you should just check that the name only contains a-zA-Z0-9 or _-
otherwise, say that it's not a valid package name
Is this worth an issue to remove all instances?
Well, it's not always evil. It's only evil with unchecked user input
Now that you told me about it, I'll keep it in mind for as long as I can remember.
for example, it's fine to use it in python-news, because it's only substituted internally
I feel like it is a good idea
Maybe we should make some tag or something about it? I have seen it a couple of times
e.g. in super's youtube command
What would the regex be? Something like [a-Z0-9_-]*?
[-_a-zA-Z0-9]+
Is a-Z equivalent to a-zA-Z or am I just imagining that it exists?
a-Z means "all characters between a and Z", but Z comes before a, so it's empty.
ah
you could do A-z, but that's confusing.
isn't ._ a special pattern?
thank you for information
. is special, but not in [ ]
!e
import re
print(re.match("[-._a-zA-Z0-9]+", "context_manager-patma.py"))
@celest charm :white_check_mark: Your eval job has completed with return code 0.
<re.Match object; span=(0, 24), match='context_manager-patma.py'>
I haven't found any other occurences of URL&format.
I'll do a pr
@vocal wolf you can do this for the commands that are using a similar thing
cht.sh is one of them
is it in lancebot?
yes
well, I don't know if it's actually that critical if it's known to be impossible to abuse for a given service
also, maybe this could be refactored to use aiohttp's built-in formatting
which cog is that for?
@celest charm thank you for noticing this and all, I'll do a thing once I wake
👍
#bot-commands message @vocal wolf we should send the help command or the error handler user input error here
For sir lancebot doc string conventions, must each line use most of the 80 characters for each line?
Right now I am using about 75% of the 80 characters for each line just so that they line up nicely in my text editor
But if using most of the 80 characters is preferred, then I can change that
Max line length in sir lancebot is 120, rather than 80
I meant for doc strings
Ah, well the max is just a max, rather than a target
So if your doc strings get the point across in less that 80, then that's fine
I wouldn't try to add words just to reach the 80 limit
For example
"""
A decorator to access and cache rhyme sets.
If the rhyme set of the word already exists in the cache, then
there is no need to execute `func` because results can be taken from the
cache. Otherwise, execute `func` and store the results into the cache.
"""
I hit enter after about 75% of the 80 characters limit
ohhh, multi-line blocks like that
Yep
Then yea, looking at other doc strings, it looks like just try to get them up to the limit
your 75% thing looks fine
also, I'm still pretty sure the line limit is 120, rather than 80
I thought python conventions is 79 characters max?
Be careful of short broken up strings or
Checkout tox.ini in the root
What do you mean by short broken up strings?
!eval [code]
Can also use: e
*Run Python code and get the results.
This command supports multiple lines of code, including code wrapped inside a formatted code
block. Code can be re-evaluated by editing the original message within 10 seconds and
clicking the reaction that subsequently appears.
We've done our best to make this sandboxed, but do let us know if you manage to find an
issue with it!*
np
Wasn't there a PR to deal with this?
Yes, and it's still open
Ahh
bot#1285
It's stalled right now due to a lack of ideas
If you have any, feel free to share
But even if it does get implemented, it still needs to be ported
We should remove single line breaks, and keep consecutive line breaks IMO
So your best bet is to test out if it looks good
Not sure what is the proposed solution in the PR
Iirc that's what the PR does
Sweet
It actually does
re.sub("(?<!\n)\n(?!\n)", " ", command.help)
I read the chat, and seems like that's what its doing 😛
I don't remember what that does
Ah it removes multiline so it's a single line
and then discord breaks it up
That's a positive lookahead and behind
!remind 1h Learn how to calculate time deltas you dummy, and actually review 575 this time
Your reminder will arrive in 1 hour!
Is it okay to use a the LinePaginator as my embed?
There may be times where the user might generate a really large poem where a LinePaginator is necessary
However, there also may be times where it isn't if the poem is short
Is it okay to use the LinePaginator at all times?
For some reason, the reactions of the line paginator on my test server does not work. They reactions count increases by one but it does not do anything to the line paginator
Do you see anything relevant in the logs?
Nothing
Hmm are the changes pushed to github yet?
Not yet, but I can do so now
I'll test it when you do
I think I'm going to cancel sir-lancebot#577 and implement sir-lancebot#581 instead
Is there an easy way to get the bot's member object?
self.bot.user
👌
but to get the member object I think you have to filter the guild
Yep, bot.user gives you a ClientUser object
@green oriole
Here's your reminder: Learn how to calculate time deltas you dummy, and actually review 575 this time.
[Jump back to when you created the reminder](#dev-contrib message)
I have just pushed the changes
Forgot to link: https://github.com/python-discord/sir-lancebot/pull/558
No worries, and I think your lock file may be out of date
Running pipenv install should fix it though
Hmm what input are you using to get a long output?
.poem onceuponatimetherewasanuglybarnacle,hewassouglyeveryonediedtheend
I was testing the bot's ability to process long rhyme schemes. I am considering adding a limit to how long a rhyme scheme can be
Do you see all 5 emojis on the embed?
Yep
I have ran pipenv install, the bug is still there
Wait, I tried using the LinePaginator on a shorter long rhyme scheme and it worked
It seems like the LinePaginator breaks for very long lines?
Wait nevermind, it worked once before breaking again
I think I realise what's happening here, it breaks after the poem timeout runs out
I have to separate the message sending process from the poem generation process. I will work on that and see if that's the cause
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Do you have a better solution?
No, I was just hinting to an r-string
hmm why though lol
well, newlines are treated by the regex parser as newlines, but it's a bit unexpected
r"(?<\n)\n)\n(?!\n)", and you don't have to remember whether it works
it's not very important, if it's already there
Fair enough
What about guild.me
me```
Similar to [`Client.user`](#discord.Client.user "discord.Client.user") except an instance of [`Member`](#discord.Member "discord.Member"). This is essentially used to get the member version of yourself.
Type [`Member`](#discord.Member "discord.Member")
@short snow Yo, I am done with #558 Markov Poem Generator PR
sir-lancebot#558
@green oriole Want me to raise a PR for #ot0-psvm’s-eternal-disapproval message?
or issue it first?
You can PR it right away
sir-lancebot#589 fwiw
I don't know if this is possible, but can that be extended to all commands in the error handler?
possibly, not sure how reset_cooldown reacts if there isn't a cooldown to be reset
so it might mean checking for a cd first
but definitely possible
but it would still require the command to raise an error, atm it just returns so no error
Yea, looks like reset_cooldown is safe even if there's no cooldown
So we could just remove the if and just always reset the cd
i guess the question would be, is there a case where a command raises an error and we don't want to reset the CD?
The template for the other bot will work for sirlancebot too
it'll just have more than what's needed
link?
We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.
The last part of that
You'll need to set these env vars ```
BOT_TOKEN=
BOT_GUILD=
REDIS_HOST=redis
BOT_DEBUG=true
PREFIX=
AOC_ROLE_ID=
BOT_ADMIN_ROLE_ID=
LOVEFEST_ROLE_ID=
ROLE_HELPERS=
AOC_CHANNEL_ID=
AOC_COMMANDS_CHANNEL_ID=
CHANNEL_ANNOUNCEMENTS=
CHANNEL_COMMUNITY_BOT_COMMANDS=
CHANNEL_DEVLOG=
wha?
ok
👍
This is the full list https://pythondiscord.com/pages/contributing/sir-lancebot/sir-lancebot-env-var-reference/
We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.
Some cogs require extra API tokens to work
If they aren't present, the cog just won't load
To start the bot up, you only need the first table Core, everything else can be added as needed for features
Some of the debug variables will also be really useful in general
👍
why am I getting this error when I do pipenv run start?
It means you don't have Redis setup and running
redis>
Are you using the docker container?
no
docker takes too much space on my computer
which is why i don't prefer
Oie gamers chatos do caramba
Yeah that's fine, I only use it for DBs personally
@dusky shore
Alright, set
USE_FAKEREDIS to true in your env file
should 'true' be captial?
it doesn't matter
why is lint flake8 failing?
flake8...................................................................Failed
- hook id: flake8
- exit code: 1
Is there any more text with that?
hold on
Flake8...................................................................Failed
- hook id: flake8
- exit code: 1
Loading .env environment variables...
bot/exts/evergreen/xkcd.py:73:18: E225 missing whitespace around operator
So on line 73 of file xkcd.py, you are missing a whitespace
probably something like
x=2
instead of x = 2
ah
@gritty wind i don't get this part of the PR form:
Reasoning
<!-- Outline the reasoning for how it's been implemented. -->
what does it mean?
So why did you choose the solution you did
Why did you do A instead of B
Let me find a good example
ok
Hmm looks like most people ignore it
If you link the feature you're working on, I may be able to help you write it
Alright, so I'm assuming you just added a field in the embed that contains the alt from the request
yes, and link to the url
Your reasoning may be
The `alt` key from the request was already available, and could be safely added to the embed. The URL was also available```
It's just a brief description of the way you've implemented the feature
Coolio, now all that remains is someone to review it lol
yes
@clever wraith im on mobile so wasn't able to test the changes. Please correct me if what I said wasn't correct.
The url /latest just 404s for me
wha?
self.latest_comic_info will be the json for the latest comic
ok
but anyway, we make the request, so could I use that?
Wdym?
like we do self.bot.http_session.get(f"{BASE_URL}/{comic}/info.0.json") as resp:
Yea, the info var will contain the response as it either gets set to self.latest_comic_info or with the resl from the request
ok
@short snow I'm going to work on the youtube command later, I'll ping you when I've done so
Will have a look. Great!
Sure
I got three pings here, where is the third one... hmmmm
Got it .
Two things: @gritty bolt
- Mark the reviews as resolved if they are done.
- You have conflict in you pipfile.lock
would the thing I did for imporving the xkcd command go in #changelog ?
@short snow
How would i know?
it depends on the mods
But idts
since there was one for xkcd recently
@vale ibex can u include a screenshot in your pr?
about the change
which pr?
Ah, there's nothing to screenshot on that
Its just the user doesn't get a cooldown if the command fails
so userinputerror doesn’t send a embed?
all the user facing stuff is the same
It's the same error embed as before
its just now their cd gets reset
Take a look at bot/bot:67
Where is that second screenshot from?
where
yea I see it
Sure
hmm?
Alright, so it looks like you're right @short snow. I missed the error listener cog we have in that folder. I only saw the error handler in bot/bot
After taking a look though, the only thing it adds is the help embed with a short message about their input, which we want anyway for this.
I'll add a comment
Alrughtyy cool
Commented
@short snow how is the idea on making a fun fact command about python?
@short snow
@clever wraith There's no need to ping anyone multiple times in succession. People will get to you when they can, you need to be patient.
ok
i'll be working on it soon, should we use the same emojis we are for the reddit command?
Yep.
Well, i kinda like it iff the facts are of good quality but final decisison is on the triage lead and the other staff
ok
I just marked the reviews as resolved. How do I fix the conflict in Pipfile.lock?
If your pipfile is up to date with master, just relock
do we have a server with a downvote emoji?
Hmm, idk how to explain this, maybe try googling u will find something
We don’t really need down votes
for dislikes, no?
wdym?
I never look at dislikes personally
hmm, alright
likes are more important imo
This
With pipenv lock, right?
I think so, vested had told me
how could I get invited there?
Ask some core dev, even am not in it
I see the upvote command is from there, but I'm not sure where there is
Yes, I usually do it during the merge, so pipfile gets updated to master and your version and then the pipfile.lock gets relocked and overwritten by your version
ah
@vocal wolf do we have a emoji server, and if so, could I be invited?
Just reser the pipfile and relock it, this should work imo
we probably should have pinged a helper core dev rather than a mod haha, hopefully he doesn't think there is a problem
Only one with online status.
so i thought, he was the best
ah true
do we?
Dm me the invite too
I did pipenv lock and it still doesn't work, I really don't know what I am doing wrong
I have tried searching the issue up, but I only found one blog post and its solution didn't work
https://dev.to/rrees/resolving-git-conflicts-in-pipenv-lockfiles-2g03
This works?
as of now the only users in the emote servers are helpers, so I'd need to check what our policy is on that before sending out invites tot non-staff
Try running install?
Do we have an emoji server?
I'll send it to you
If it’s conflicting with master, merge master into your branch first
According to this, we do
And make sure you are merging upstream master
U have more then 50 emojis?
pinned in #dev-core
oh so it does exist
ahhhhhh that's where it's pinned
Ok i really need sleep now. Bye! It is 7am 
You're getting my sleep schedule lol
gn
By reset, do you mean replacing the pipfile.lock file with master's pipfile.lock and then running pipenv lock?
Yeah, that's what I did, but when I run pipenv lock it brings me back to where I started
Can you pull master and push without locking?
I suppose I could but wouldn't my pipfile be outdated?
Yeah, I’ll try to run the lock on my end to see what’s up
Alternatively you can dump them on pastebin
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
that's even later than you most nights lol
I'm wondering how they even managed to function so late
I just did it
Alright, I'll check it out
Hmm seems its complaining about unrelated libraries
One thing to try would be to completely delete the pipfile and running install again, but that may not work as inteneded
another would be to delete it completely, and manually copy it in from the master branch
For the second option, just copy it from the master branch and push?
copy it from the master branch (not through git), install, and push
Okay just did it
Ok if it doesn't work, I regenerated it again on my end
And it's showing up different from your branch
So what do I do?
Did it work?
Ah yeah it worked
It's flaring up the dependencies you added for some reason, but those should be easy to fix
Do I copy your paste and push it?
Nah mine is the same as yours now
You should see two red paragraphs on this page
something like this
It's just git(hub) being weird, but you can remove the
<<<<<<< markov-poem-gen
=======
>>>>>>> master
And it'll work
same thing for both paragraphs
essentially this
I'm not sure why it's fucking up though, it normally works
Where did you get this?
If you go to the PR, at the very bottom where it says conflicts, there should be a resolve button
The one in the top right?
On that page, there is a prev/next button you can use to find the highlighted bits
Yeah top right
I can't remove the markers though
Or do I copy it into my text editor, remove them and re-push?
Like you can't edit it online at all?
we need some sources
How come I am unable to get emojis working in my local server? lol
Also, @short snow this is a demo
idk, this was probably my first time, otherwise i sleep at 2am max
What do you have in your constants?
self.youtube_emoji = self.bot.get_emoji(810358765114622053)
self.post_detail_emoji = self.bot.get_emoji(810362544287383624)
self.user_emoji = self.bot.get_emoji(810359435960385536)
self.view_emoji = self.bot.get_emoji(810371390124458024)
self.like_emoji = self.bot.get_emoji(810361845353021471)
these are just from my bot test servers
upvote_emoji = self.bot.get_emoji(755845219890757644)
comment_emoji = self.bot.get_emoji(755845255001014384)
user_emoji = self.bot.get_emoji(755845303822974997)
text_emoji = self.bot.get_emoji(676030265910493204)
video_emoji = self.bot.get_emoji(676030265839190047)
image_emoji = self.bot.get_emoji(676030265734201344)
reddit_emoji = self.bot.get_emoji(676030265734332427)
should I not get it in __init__?
this version?
Yesh
hmm can you dump it somewhere for testing?
I think you can't use like the emoji object in messages, you just use the name:id
so:
would become !lemon_hyperpleased
got it 🥳
awesomeee
the problem was getting them in __init__, so I get them on command time, yeah
I'll add these to constants
noice
and change the ids to the emoji server ones
You really just need the IDs to be added to constants
then you'll have it
yeah
you forgot to spaces between the emojis ig
It's something we'll have to fix, the emojis are not equally sized
I've been doing the emojis with f1re, so we'll fix those after this commit
okie dokie
@gritty wind @short snow I committed the new changes
It's not ready for merge quite yet though -- need to change all of the emoji id's from my test server
will have a look later in the day
Can you re-request a review from the current reviewers to clear out their approvals/denials
sure
er, how do I start a review again?
If you go to the files changed menu, there is a review button
if you want to rerequest a review
Do it at the very top of the conversations menu
top right corner
You can also dismiss the reviews by clicking on the cog thing
It seems like I can't rerequest jason's for whatever reason
Hmm you should be, screenshot?
also I've had this just sitting here for a while
We don't assign on PRs btw -- I learned that the hard way lol
won't let me request
ah, how come?
What happens when you click on the circle?
Idk, it doesn't really signify much that other things don't. It is isn't a big deal though
tuns blue and then nothing
Possibly because he's not part of the org
It doesn't influence the review count, so I don't think it should matter
But he may be able to rerequest himself
ah okay
im not even sure what I did just here lol
the pr/review process confuses me a bit sometimes on github
anyways, I'm going to head off to bed
goodnight!
#sir-lancebot-playground message
Even though !e? was not a command, why was
You are not allowed to use that command here. Please use the #bot-commands channel instead.
message sent?
@gritty wind :white_check_mark: Your eval job has completed with return code 0.
hello world
but !e? isn't
huh?
Try it in #bot-commands
I get a suggestion
Yeah, which you are not allowed to get in #sir-lancebot-playground
I merged master to my local repo and now I get this error:
sir-lancebot/bot/exts/evergreen/issues.py", line 182, in on_message
message.channel.category.id in WHITELISTED_CATEGORIES
AttributeError: 'NoneType' object has no attribute 'id'
The bot is functioning for my cog though
the command assumes the channel you run the command in is in a category
I assume the channel you ran the command in has no category? in that case message.channel.category would return None, therefore there is an access error on the id field
by category, you mean like "Development" would be the category of this channel?
yep
@short snow do you really prefer soft red instead of pink for the love poem?
if it's an error embed, the convention is to use soft red
Similar thing happens in DMs too, I have a PR open for it somewhere
Oh I see
How do I add a cool down on a command?
There's a discord.py decorator for it
one sec
Thanks. But, how do I use it? What is BucketType.user?
You can just add it above the command
Actually, wait, if it is a discord.py command I could probably search the docs
The bucket types indicate who the limit applies to, for example user limits it to each individual user using it once per 10 minutes
A global bucket would be for all of discord, etc
Awesome, thanks
Is it possible to have a cooldown that refreshes after the bot gives what the user requested?
For example, in the poem cog, the user can request for another poem only when they get one
If I do it in terms of time, then those who requested shorter poems would have to wait long and those who requested very long poems may get a chance to execute the command multiple times
Is it max_concurrency?
I don't know that there's any good bulitin way to handle that
Max concurrency will apply to all users across the bot, not really connected to cooldowns
I guess what you'd be looking for is a global cache instead
we keep some of those for certain features
We can do it on our own, after sending the result, we can reset the cooldown ig
If I do max_concurrency(1, BucketType.user), wouldn't that do just that?
Never used it, so idk
Ah yeah, that sounds good
If a user decides to spam the command even though max_concurrency is enabled, will the bot on the server automatically punish the user?
If same thing was sent 3 times ig in 10 seconds
ks has a pr on that which changes it to 3 ig
not sure tho
Oh I see
@green oriole @gritty wind Just a reminder to review the connect four pr. 
@vale ibex About moving the emoji ID locations -- it looks like only the "general" emojis go there, i.e. status, approved, etc.
but, the reddit extension's emoji ids are in the module itself, and I cleaned up mine by putting it in a YouTube class in constants.py
should it still be added?
i mean the dice emoji, the tic tac toe emoji the issue and Pr emojis are all in there
but yea I agree, the emojis are a little scattered atm
So probably not a huge deal.
it seemed like those were a bit more general maybe?
I can definitely add them there though
However, it's a little bit of conflict between the reddit command and here, since I do use two of the reddit emojis
actually, I'll add the emojis I need there, and then do another issue about moving the reddit emojis, should only take a bit
Sure! 🙂
sounds good!
also, how can I use emojis in this format?
issue = ""
issue_closed = ""
pull_request = ""
pull_request_closed = ""
merge = ""
ah
will do
forever loyal
alright, chages pushed @vale ibex
They'll need to be the ids from #578587418123304972
Flake8 didn't like the new line after the docstring either
do you have the precommit hook setup?
all passing
🤔
even flake8 . gives nothing
Weird
PS C:\Users\Chris\src\sir-lancebot> pipenv run lint
Loading .env environment variables...
Check for merge conflicts................................................Passed
Check Toml...............................................................Passed
Check Yaml...............................................................Passed
Fix End of Files.........................................................Passed
Mixed line ending........................................................Passed
Trim Trailing Whitespace.................................................Passed
check blanket noqa.......................................................Passed
Flake8...................................................................Failed
- hook id: flake8
- exit code: 1
Loading .env environment variables...
bot/exts/evergreen/youtube.py:111:1: D202 No blank lines allowed after function docstring
Mine fails if I checkout your PR
Hmm, this is a message from a flake8 plugin
Do you think pipenv install is needed?
Could you do something like pipenv run flake8 --version?
You are probably running the system flake8 here
And/run pipenv run flake8 without precommit
My guess is that precommit bypasses the venv
Falls back to systemwide
still nothing
3.8.4 (mccabe: 0.6.1, pycodestyle: 2.6.0, pyflakes: 2.2.0) CPython 3.8.5 on Linux
pipenv sync --dev?

I need a couple sourcesfor fun facts about python
also, where should I store the text file?
bot/resources/evergreen
ah
As for resources you could open a discussion and ask for some input from the community, or take a look around google
I'm not aware of any sources with many facts, there might be some out there
yup
i think maybe making a discusson would be best
Sorry supermazingcoder, got stuck with exam prep today, will see if i can do a review tomorrow
Depending on what sort of thing you're looking for, you could take a look at https://github.com/satwikkansal/wtfpython @clever wraith.
Getting a random one from that could be cool
You could also have some less programming related ones, like python 1.0 was released in ..., guido van rossum was the original creator of python, he was know as the BDFL which stand for ..., python was voted as the nth most popular language in the stackoverflow survey, etc, etc
@cosmic moat no frequent pushed (is mentioned in contributing guide)
make all commits, and push together at end
ah, I was not aware of that
I actually didn't know that was a thing
what is the difference?
difference in?
between pushing after everyone commit and at the end of them all
A push to an open pr will trigger actions, so it's not ideal if you can group them but doesn't matter all that much
Can everyone see my new pfp or old pfp on github webhook? Cuz even on ipad it shows the old one
it shows the one you have on discord lol
Good night
Good luck with the exam!
3 days to go for that. 
Ahh fair enough 😄
Why does await ctx.send_help('command') use commands.DefaultHelpCommand for sir-lancebot?
i don't understand, what is this?
it looks like a lesson 
oh it's because @dusky shore bot.help_command is still commands.DefaultHelpCommand
It's a collection of individual examples of python (or cpython) behaviour that may seem weird or unexpected
ah
I meant that more for inspiration, you could try and convert some of the examples into more concise facts
You don't have to use that if it isn't the sort of facts you were looking for
ok
> Lesser known things about Python
>
learn something new every day, right
Tbf it can be a shock to people who have never heard about python, though it is certainly infamous for it
Wait, really?
Yeah. Still recovering from the shock!
just show them lisp dialects
ok
Some lisp programmers stand by it 😔
have you done pipenv sync --dev?
oh wait not yet
should I put an absolute path or a relative one for opening the fle?
@vale ibex
Opening what file?
Sorry, I don't have the context here. I thought you were having an issue with arrow?
i finshed that
@SuperMaZingCoder#0001 having a look at your pr now
@cosmic moat do you have a test server? so that i can join and test it out?
@short snow all changes addressed
#sir-lancebot-playground message WIkipedia doesn't filter out 18+ content
I don't think talking about those things is 18+
by itself
If it had porn on the other hand, that may be a different story
but Porn sites, and porn in general is legitimate knowledge
@cosmic moat Cooldown comment should be added to command docstring instead. Also, could you please use bot.bot.Bot instead of commands.Bot in typehints to make IDEs autocomplete and analysis better?
should cht.sh be allowed in #python-discussion
should i open a quick pr for that?
also you have a requested review on c4 on lance along with scaleios
Yes, sure thing
I may not review the connect four PR until this weekend, but it may get merged before then
It is i think
yeah
one approve needed for this and markov poem
it would be awesome if you do it on markov
since valentine has only 13 days left
Command docstring is https://github.com/SuperMaZingCoder/sir-lancebot/blob/feature/youtube/bot/exts/evergreen/youtube.py#L123
ah I put it in the wrong place
Yes, search_youtube don't have cooldown, command have cooldown
fixed
@cosmic moat Why is the logic so complex?
Can't you just throw an exception if either the analytcis or the video search doesn't succeed, and catch it at the top level?
Besides, under what circumstances would youtube statistics or youtube search return non-200 if youtube is not totally down?
well, it just checks for a non 200 return code and logs it with where it's from and the return code
why doesn't it also check if the computer is on fire?
LOL
i.e. why does it care about that? and why would it occur?
If youtube is down, you might as well get a failed connection, which you don't catch.
well, it cares so that we don't flood the console with errors, and because it gives valuable information about the return code.
and it could happen if we've hit the daily rate limit
if we get a failed connection
that's not related to the youtube command
@cosmic moat it is, youtube/google could have screwed up its DNS stuff
doubt
well, last year:
- google's services were down for a few hours
- cloudflare had a royal screwup with DNS
so it's on the same level of probability
i.e. once a year


message sent?