#dev-contrib

1 messages · Page 84 of 1

short snow
#

after a process of reviews and checls

#

or sometimes without those

short snow
#

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

vocal wolf
#

rip

#

I'll see if they respond

short snow
#

so pypi is ready for review?

#

sir-lancebot#73

short snow
#

hmmm

granite goblet
#

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)

green oriole
granite goblet
green oriole
#

Oh, it is already implemented

granite goblet
#

Yeah :D

vocal wolf
dusky shoreBOT
granite goblet
#

Not to say there's no added functionality you could work on if you wanted ^^

green oriole
#

Is there anything in the issue that hasn’t been implemented yet?

granite goblet
#

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

green oriole
#

Alrighty, have a good night!

gritty bolt
#

What's the brief and help parameter for @commands.command() for?

short snow
#

Help parameter basically overwrites the the docstring on our @commands.command() function

#

and

#

Brief is The short help text for the command.

clever wraith
short snow
#

Patience you must have my young Padwan

clever wraith
gritty bolt
sleek steppe
#

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"""
    ...
gritty bolt
#

So the only difference is where the text is placed?

clever wraith
#

should I wait for my issues to get approved, or start on the PR?

exotic ember
short snow
#

hence you use the help parameter to override it

short snow
#
    @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 😤

green oriole
#

You need to clear the cache

short snow
#

and how do i? on desktop ubuntu

green oriole
#

Clear ~/.cache/discord maybe?

exotic ember
#

hmmm?

clever wraith
#

edited

clever wraith
#

@gritty wind how were the changes i made?

gritty wind
#

Haven't had a chance to start reviewing things today yet

#

I'll let you know when I get around to it

clever wraith
#

ok

clever wraith
#

@gritty wind so how is it?

gritty wind
#

I'm still working on other things, haven't gotten around to it

vocal wolf
#

@serene flare are you ChrisLovering on GitHub?

patent pivot
#

that's the other chris lol @vocal wolf

vocal wolf
#

darn

patent pivot
#

this chris is uhhhh

#

i have the name

vocal wolf
#

bot#1416 needs review(s)

dusky shoreBOT
sleek steppe
vocal wolf
#

You are correct

serene flare
#

Sorry to disappoint!

vocal wolf
#

Chris with an underscore is Wubbzi

serene flare
#

correct

clever wraith
#

i would like to improve @dusky shore 's xkcd command

short snow
#

oepn a issue

#

saying how will u improve it

#

and why

short snow
#

can we quicly have a look at the valentine fix pr

#

or valetine would get over 😦

clever wraith
#

how do I make a new branch?

#

(yes ik i'm dumb)

short snow
clever wraith
#

ok

ember cloud
#

should there be a command explaining .whl files?

gritty bolt
#

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

clever wraith
#

@gritty wind how were the changes I made?

gritty wind
#

Again, I will tell you when I get around to reviewing it

tawdry vapor
gritty bolt
#

Wait, so like error.handled = True?

tawdry vapor
#

Yes

gritty bolt
#

That's neat, thanks

gritty bolt
#

What's the command to see the help message for a cog?

#

Or do I have to manually make one?

short snow
short snow
#

@vocal wolf can you put a image on how the pypi looks now?

#

the pypi command of bot

tawdry vapor
#

No. The error handler is coded to ignore errors that have that attribute

vocal wolf
#

look at the very top comment

#

of the PR

#

image has been updated

short snow
#

ok thanks!

tawdry vapor
#

You need to set it in your local error handler

short snow
#

ok thanks Mark!

gritty bolt
#

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

cold island
#

hmm how can I use a converter without context?

short snow
#

@vocal wolf #bot-commands message we forgot something, we need to escape the *.

#

or they would get bold or in italics

vocal wolf
#

There's so many edge cases lol

#

thanks, I'll implement that soon

short snow
#

🤷

#

cool, np!

#

again, it was vester who caught the edge case

#

idk how he always does that.

celest charm
#

Otherwise, it doesn't make sense to call a converter without a context, because it needs some info from it

cold island
celest charm
#

@cold island Does it do any async actions?

cold island
#

but it's a signature used by dpy

#

so I don't think you can change it

celest charm
#

but if you need async stuff or access to the context, you need to make a class

cold island
#

it doesn't use anything async

celest charm
#

Then why isn't it a function?

cold island
#

🤷‍♂️

celest charm
#

@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

cold island
#

But then I have to change all places where it was used 😔

celest charm
#

@cold island wdym?

#

b) and c) don't have this issue

cold island
#

c isn't the case

celest charm
#

then b)

cold island
#

I'm passing None rn but it's pretty meh

celest charm
#

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?

cold island
#

it really has nothing to do with dpy logic

green oriole
#

What do you want to convert?

cold island
#

DurationDelta

celest charm
#

can you give a link?

green oriole
#

Isn't that a custom converter

cold island
#

it is

celest charm
#

Yeah, idk why it's a class

cold island
#

it's subclassed below

#

which is... weird

celest charm
#

oh jesus

cold island
#

why the fuck is it subclassed lol

celest charm
#

mamma mia

cold island
#

It's like Ellipse(Circle)

celest charm
#

yeah lmao

green oriole
#

It does make sense if you follow the logic 🤷

rapid swallow
#

git blame someone

green oriole
#

That's an interesting problem though

#

I'd say move the logic out of the converter to an util

cold island
#

fix is right though...

#

neither DurationDelta nor Duration need to be classes

green oriole
#

Well, we use them as d.py converter, so we have to put them in a class, right ?

celest charm
cold island
#

yes, if you scroll up you'll see allowed_string

green oriole
#

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

cold island
#

yeah, it's just going to massively clutter the PR

green oriole
celest charm
green oriole
celest charm
celest charm
#

hmmmmmmmmmmmm

#

Not sure, can you try?

#

Putting a function in a Union is certainly a brutal hack

green oriole
#

I don't see why not though

celest charm
#

because it's not a type

vocal wolf
#

@green oriole my god I didn't L I N T

celest charm
#

and it's abuse of typehints

green oriole
vocal wolf
#

not again lmfao

green oriole
#

Haha

cold island
#

That makes me want to go with option b

#

I think I'll go with b

vocal wolf
#

@green oriole bing bam pow

green oriole
#

Very good

celest charm
#

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.

vocal wolf
#

@green oriole does it even need another review?

green oriole
#

🤷

vocal wolf
#

alright, merging

#

done

green oriole
#

Damn, increased coverage

vocal wolf
#

merged before the bot could even react

green oriole
#

That's so silly haha

vocal wolf
#

fastest PR in the west

#

@obsidian patio thank you for finding the edge case of the PyPi command. It has been resolved.

short snow
vocal wolf
#

already merged

obsidian patio
#

Aaah, I see it now, if we’re thinking of the same thing

vocal wolf
#

Me and Ak are planning to discuss it sometime to see what we can do with it

obsidian patio
#

Alright, sounds good

gritty bolt
#

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?

wise oriole
#

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?

short snow
#

which has a string assigned to it

gritty bolt
#

Example?

short snow
#

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.

gritty bolt
#
"""
            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

short snow
#

@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

dusky shoreBOT
gritty bolt
#
    templates: Dict[str, str] = {
        "shakespearean-sonnet": "abab/cdcd/efef/gg"
    }
#

This is what the dictionary look like

eternal owl
#

I just gave my final exam, I will review it tonight for sure @short snow

short snow
green oriole
#

!remind 2h30M review 575

stable mountainBOT
#
Can do!

Your reminder will arrive in 2 hours and 30 minutes!

short snow
#
@commands.command(
  help=f"""
      ...
      {''.join(x for x in x)}
      ...
      """
  aliases=("poem",)
)
async def love_poem():
  ,,,
gritty bolt
#

Ah I see, alright

vocal wolf
#

I did, we're good tho

#

pypi command was merged

#

and now is up and running

#

All conversations were resolved in the end

vale ibex
#

🎉

vocal wolf
#

!source pypi

stable mountainBOT
#
Command: pypi

Provide information about a specific package from PyPI.

Source Code
vocal wolf
#

here's the final product

vale ibex
#

Ooo fancy itertools.cycle

vocal wolf
#

ye lol

cold island
#

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.

celest charm
#

Maybe putting converters in annotations wasn't the best idea ahem

#

Is it possible to use Annotated?

exotic ember
celest charm
cold island
#
def bla(duration: Duration):
  print(duration.isoformat())
#

isoformat belongs to datetime, but duration is of type Duration as far as Pycharm is concerned

celest charm
#

That's why

#

!pep 593

stable mountainBOT
#
**PEP 593 - Flexible function and variable annotations**
Status

Accepted

Python-Version

3.9

Created

26-Apr-2019

Type

Standards Track

celest charm
#

exists, but bot is not on 3.9 yet (right?), and AFAICT discord.py doesn't support it

vale ibex
#

Isn't this the converters.Duration converter?

cold island
#

yes

vale ibex
#

I've seen it used exactly like that in the reminder command

#

!src remind

stable mountainBOT
#
Command: remind

Commands for managing your reminders.

Source Code
celest charm
#

Well, it works, it's just that the type checker can't tell that it's right

vale ibex
#

Ahhh

celest charm
#

because it's type annotation abuse

cold island
#

yeah it's just annoying to not have the auto complete and see the yellow highlight

green oriole
#

You can typehint it again I guess

#

duration: datetime at the top of the function body

celest charm
#

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
#

it does work

#

but

#

it's ugly

green oriole
#

🤷

#

You can keep it during development and get rid of it when committing

celest charm
#

@cold island You could make a datetime wrapper that would also inherit from Converter and have a convert method, but that's worse

green oriole
celest charm
#

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)

vocal wolf
#

lmfao

celest charm
#

!pypi aiohttp?sql=drop+table+students&

stable mountainBOT
#
NEGATORY.

There was an error when fetching your PyPi package.

celest charm
#

@vocal wolf ^^^

#

arrrgh

vocal wolf
#

tis a shame

celest charm
#

@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.

vocal wolf
#

don't we format urls through format a lot throughout the bot?

celest charm
#

maybe we do, we probably shouldn't

#

Especially in places we pass some token and such

vocal wolf
#

We don't pass a token for this one

celest charm
#
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
celest charm
vocal wolf
#

How should we do it?

celest charm
#

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

vale ibex
#

Is this worth an issue to remove all instances?

celest charm
#

Well, it's not always evil. It's only evil with unchecked user input

vocal wolf
#

Now that you told me about it, I'll keep it in mind for as long as I can remember.

celest charm
#

for example, it's fine to use it in python-news, because it's only substituted internally

vocal wolf
#

I feel like it is a good idea

celest charm
#

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

vocal wolf
#

What would the regex be? Something like [a-Z0-9_-]*?

celest charm
#
[-_a-zA-Z0-9]+
vocal wolf
#

Is a-Z equivalent to a-zA-Z or am I just imagining that it exists?

vale ibex
#

I think . can be in pypi names too

#

So maybe something like [\.\-_a-zA-Z0-9]+?

vocal wolf
celest charm
#

yeah

#
[-._a-zA-Z0-9]+
#

no need for \

celest charm
vocal wolf
#

ah

celest charm
#

you could do A-z, but that's confusing.

vale ibex
#

isn't ._ a special pattern?

vocal wolf
#

thank you for information

celest charm
#

!e

import re
print(re.match("[-._a-zA-Z0-9]+", "context_manager-patma.py"))
stable mountainBOT
#

@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'>
celest charm
#

I haven't found any other occurences of URL&format.

vocal wolf
#

I'll do a pr

short snow
#

@vocal wolf you can do this for the commands that are using a similar thing

celest charm
short snow
#

yes

celest charm
#

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

vocal wolf
#

which cog is that for?

celest charm
#

wolfram

#

but that's just a refactoring

#

(here it's actually secure)

vocal wolf
#

@celest charm thank you for noticing this and all, I'll do a thing once I wake

celest charm
#

👍

short snow
#

#bot-commands message @vocal wolf we should send the help command or the error handler user input error here

late wolf
#

We do send help command

#

the person just clicked on trash icon

short snow
#

ah

#

my bad

#

sorry xith

gritty bolt
#

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

vale ibex
#

Max line length in sir lancebot is 120, rather than 80

gritty bolt
#

I meant for doc strings

vale ibex
#

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

gritty bolt
#

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

vale ibex
#

ohhh, multi-line blocks like that

gritty bolt
#

Yep

vale ibex
#

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

gritty bolt
#

I thought python conventions is 79 characters max?

gritty wind
#

Be careful of short broken up strings or

vale ibex
#

Checkout tox.ini in the root

gritty bolt
#

What do you mean by short broken up strings?

gritty wind
#

you get

#

!help eval

stable mountainBOT
#
Command Help

!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!*

vocal wolf
vale ibex
gritty wind
#

Yes, and it's still open

vale ibex
#

Ahh

gritty wind
#

bot#1285

dusky shoreBOT
gritty wind
#

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

green oriole
#

We should remove single line breaks, and keep consecutive line breaks IMO

gritty wind
#

So your best bet is to test out if it looks good

green oriole
#

Not sure what is the proposed solution in the PR

gritty wind
#

Iirc that's what the PR does

green oriole
#

Sweet

vale ibex
#

can we just not replace all \n with nothing, and s-

#

nvm

gritty wind
#

It actually does
re.sub("(?<!\n)\n(?!\n)", " ", command.help)

vale ibex
#

I read the chat, and seems like that's what its doing 😛

gritty wind
#

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

green oriole
#

!remind 1h Learn how to calculate time deltas you dummy, and actually review 575 this time

stable mountainBOT
#
Can do!

Your reminder will arrive in 1 hour!

gritty bolt
#

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?

gritty wind
#

The paginator just sends a single embed if it can

#

I think it should be fine

gritty bolt
#

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

gritty wind
#

Do you see anything relevant in the logs?

gritty bolt
#

Nothing

gritty wind
#

Hmm are the changes pushed to github yet?

gritty bolt
#

Not yet, but I can do so now

gritty wind
#

I'll test it when you do

vale ibex
#

I think I'm going to cancel sir-lancebot#577 and implement sir-lancebot#581 instead

cold island
#

Is there an easy way to get the bot's member object?

gritty wind
#

self.bot.user

cold island
#

👌

gritty wind
#

but to get the member object I think you have to filter the guild

balmy sparrow
#

Yep, bot.user gives you a ClientUser object

stable mountainBOT
#

@green oriole

It has arrived!

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)

gritty bolt
gritty wind
#

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?

gritty bolt
#

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

gritty wind
#

Do you see all 5 emojis on the embed?

gritty bolt
#

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

celest charm
gritty wind
#

Do you have a better solution?

celest charm
gritty wind
#

hmm why though lol

celest charm
#

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

gritty wind
#

Fair enough

stable mountainBOT
#
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")
gritty bolt
#

@short snow Yo, I am done with #558 Markov Poem Generator PR

vale ibex
#

sir-lancebot#558

dusky shoreBOT
vale ibex
#

or issue it first?

green oriole
#

You can PR it right away

vale ibex
#

sir-lancebot#589 fwiw

gritty wind
#

I don't know if this is possible, but can that be extended to all commands in the error handler?

vale ibex
#

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?

clever wraith
#

is there a template server i can use for sir lancbot?

#

@gritty wind

vale ibex
#

The template for the other bot will work for sirlancebot too

vale ibex
#

it'll just have more than what's needed

clever wraith
#

link?

vale ibex
#

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=

vale ibex
#

That's my .env file for sir-lancebot

#

with the values taken out

clever wraith
#

👍

vale ibex
#

Some cogs require extra API tokens to work

#

If they aren't present, the cog just won't load

gritty wind
#

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

clever wraith
gritty wind
#

It means you don't have Redis setup and running

clever wraith
#

redis>

gritty wind
#

Are you using the docker container?

clever wraith
#

docker takes too much space on my computer

#

which is why i don't prefer

gritty wind
#

Alright, you can use fake redis

#

Is this @stable mountain or @dusky shore

final bane
#

Oie gamers chatos do caramba

gritty wind
#

Yeah that's fine, I only use it for DBs personally

clever wraith
gritty wind
#

Alright, set
USE_FAKEREDIS to true in your env file

clever wraith
gritty wind
#

it doesn't matter

clever wraith
#

why is lint flake8 failing?

flake8...................................................................Failed
- hook id: flake8
- exit code: 1
gritty wind
#

Is there any more text with that?

clever wraith
#

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

gritty wind
#

So on line 73 of file xkcd.py, you are missing a whitespace

#

probably something like
x=2
instead of x = 2

clever wraith
#

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?

gritty wind
#

So why did you choose the solution you did

#

Why did you do A instead of B

#

Let me find a good example

clever wraith
#

ok

gritty wind
#

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

clever wraith
gritty wind
#

Alright, so I'm assuming you just added a field in the embed that contains the alt from the request

gritty wind
#

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

clever wraith
#

Ah

#

@gritty wind made a PR for xkcd command

gritty wind
#

Coolio, now all that remains is someone to review it lol

clever wraith
#

yes

vale ibex
#

@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

clever wraith
vale ibex
#

If the user does.xkcd latest the url seems to be set to that right?

clever wraith
#

yup

#

hold on

#

lemme replace with the number instead

vale ibex
#

self.latest_comic_info will be the json for the latest comic

clever wraith
#

but anyway, we make the request, so could I use that?

vale ibex
#

Wdym?

clever wraith
# vale ibex Wdym?

like we do self.bot.http_session.get(f"{BASE_URL}/{comic}/info.0.json") as resp:

vale ibex
#

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

cosmic moat
#

@short snow I'm going to work on the youtube command later, I'll ping you when I've done so

short snow
short snow
#

I got three pings here, where is the third one... hmmmm

#

Got it .

#

Two things: @gritty bolt

  1. Mark the reviews as resolved if they are done.
  2. You have conflict in you pipfile.lock
clever wraith
#

would the thing I did for imporving the xkcd command go in #changelog ?

#

@short snow

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

vale ibex
#

which pr?

short snow
#

The cooldown on valentine kne

#

one*

vale ibex
#

Ah, there's nothing to screenshot on that

#

Its just the user doesn't get a cooldown if the command fails

short snow
#

so userinputerror doesn’t send a embed?

vale ibex
#

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

short snow
vale ibex
#

Where is that second screenshot from?

short snow
#

am really tired (4am here) or is it really sending 2 embeds

#

error handler

vale ibex
#

where

short snow
#

Sirlance/bot/exts/evergreen

#

/errorhandler.py

vale ibex
#

🤔

#

That code was getting hit before too, let me investigate

short snow
vale ibex
#

yea I see it

clever wraith
short snow
#

Ah it didn’t

#

idk wait for the mods to reply

vale ibex
#

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

vale ibex
#

Nice spot btw

short snow
clever wraith
#

@short snow how is the idea on making a fun fact command about python?

#

@short snow

vocal wolf
#

@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.

clever wraith
#

ok

cosmic moat
# short snow Sure

i'll be working on it soon, should we use the same emojis we are for the reddit command?

short snow
gritty bolt
brazen charm
#

If your pipfile is up to date with master, just relock

cosmic moat
#

do we have a server with a downvote emoji?

short snow
#

Hmm, idk how to explain this, maybe try googling u will find something

cosmic moat
#

If not, I'll add one

#

doesn't look like it

short snow
cosmic moat
#

for dislikes, no?

short snow
#

On yt command

#

Idts

cosmic moat
short snow
#

I never look at dislikes personally

cosmic moat
short snow
#

likes are more important imo

cosmic moat
#

should it be upvotes

#

or thumbs up/thumbs down

short snow
#

One min, lemme see

#

the ones used in reddit, the grey one

short snow
cosmic moat
#

okie

#

Do we have a server for sir lancebot emojis?

gritty bolt
short snow
cosmic moat
short snow
#

Ask some core dev, even am not in it

cosmic moat
#

I see the upvote command is from there, but I'm not sure where there is

brazen charm
#

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

cosmic moat
short snow
#

Ask xith mahbe

#

he is online

cosmic moat
#

@vocal wolf do we have a emoji server, and if so, could I be invited?

short snow
#

Just reser the pipfile and relock it, this should work imo

cosmic moat
#

we probably should have pinged a helper core dev rather than a mod haha, hopefully he doesn't think there is a problem

short snow
#

so i thought, he was the best

patent pivot
#

lol

#

i was like

#

90% sure we had an invite pinned somewhere

cosmic moat
cosmic moat
patent pivot
#

not sure

#

will find after i finish this pizza

cosmic moat
#

and thanks :D

short snow
#

Dm me the invite too

gritty bolt
#

I did pipenv lock and it still doesn't work, I really don't know what I am doing wrong

patent pivot
#

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

gritty wind
#

Try running install?

vocal wolf
#

Do we have an emoji server?

cosmic moat
gritty wind
#

If it’s conflicting with master, merge master into your branch first

gritty wind
#

And make sure you are merging upstream master

patent pivot
#

we have 2

#

lol

short snow
#

U have more then 50 emojis?

sullen phoenix
vocal wolf
#

oh so it does exist

patent pivot
#

ahhhhhh that's where it's pinned

short snow
#

Ok i really need sleep now. Bye! It is 7am lemon_grimace

vocal wolf
#

gn

gritty bolt
# short snow This works?

By reset, do you mean replacing the pipfile.lock file with master's pipfile.lock and then running pipenv lock?

gritty bolt
gritty wind
#

Can you pull master and push without locking?

gritty bolt
#

I suppose I could but wouldn't my pipfile be outdated?

gritty wind
#

Yeah, I’ll try to run the lock on my end to see what’s up

#

Alternatively you can dump them on pastebin

#

!paste

stable mountainBOT
#

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.

cosmic moat
#

I'm wondering how they even managed to function so late

vocal wolf
#

You have not seen my summer sleep schedule

#

go to bed at 10-11am

#

wake up at 6-8pm

gritty wind
#

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

gritty bolt
#

For the second option, just copy it from the master branch and push?

gritty wind
#

copy it from the master branch (not through git), install, and push

gritty bolt
#

Okay just did it

gritty wind
#

Ok if it doesn't work, I regenerated it again on my end

#

And it's showing up different from your branch

gritty bolt
#

So what do I do?

gritty wind
#

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

gritty bolt
#

Do I copy your paste and push it?

gritty wind
#

Nah mine is the same as yours now

#

You should see two red paragraphs on this page

#

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

#

I'm not sure why it's fucking up though, it normally works

gritty bolt
gritty wind
gritty bolt
gritty wind
#

On that page, there is a prev/next button you can use to find the highlighted bits

#

Yeah top right

gritty bolt
#

I can't remove the markers though

#

Or do I copy it into my text editor, remove them and re-push?

gritty wind
#

Like you can't edit it online at all?

gritty bolt
#

Omg, I can, I just never tried it and I thought I couldn't

#

It was that easy...

cosmic moat
#

How come I am unable to get emojis working in my local server? lol

#

Also, @short snow this is a demo

short snow
gritty wind
#

What do you have in your constants?

cosmic moat
#
        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

short snow
#

ah no need of get emojis

#

look how reddit is done

cosmic moat
# short snow look how reddit is done
        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__?

gritty wind
#

Honestly these should all be in constants.py 🤔

#

Is your code public yet?

cosmic moat
gritty wind
#

Yesh

cosmic moat
#

no, it's still progress

#

once I get these emojis workign it will be

gritty wind
#

hmm can you dump it somewhere for testing?

short snow
#

hmm, are those the right ids?

#

\<emoji>

gritty wind
#

I think you can't use like the emoji object in messages, you just use the name:id

short snow
cosmic moat
short snow
#

awesomeee

cosmic moat
#

the problem was getting them in __init__, so I get them on command time, yeah

#

I'll add these to constants

gritty wind
#

noice

cosmic moat
#

and change the ids to the emoji server ones

gritty wind
#

You really just need the IDs to be added to constants

cosmic moat
#

then you'll have it

short snow
#

you forgot to spaces between the emojis ig

cosmic moat
#

I've been doing the emojis with f1re, so we'll fix those after this commit

short snow
#

okie dokie

cosmic moat
#

@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

short snow
cosmic moat
#

sounds good

#

It should be good to merge if you guys approve

gritty wind
#

Can you re-request a review from the current reviewers to clear out their approvals/denials

cosmic moat
#

er, how do I start a review again?

gritty wind
#

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

short snow
#

top right corner

gritty wind
#

You can also dismiss the reviews by clicking on the cog thing

cosmic moat
gritty wind
#

Hmm you should be, screenshot?

cosmic moat
gritty wind
#

We don't assign on PRs btw -- I learned that the hard way lol

cosmic moat
gritty wind
#

What happens when you click on the circle?

gritty wind
cosmic moat
#

tuns blue and then nothing

gritty wind
#

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

cosmic moat
#

ah okay

#

the pr/review process confuses me a bit sometimes on github

#

anyways, I'm going to head off to bed

#

goodnight!

gritty wind
#

You left a review comment - neither an approval nor request

#

night night

late wolf
#

#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.
thismessage sent?

gritty wind
#

!e is a command

#

eval

#

!e print("hello world")

stable mountainBOT
#

@gritty wind :white_check_mark: Your eval job has completed with return code 0.

hello world
late wolf
gritty wind
#

Right

#

it's the command suggestion

#

not the actual command

late wolf
#

huh?

gritty wind
#

Try it in #bot-commands

late wolf
#

I get a suggestion

gritty wind
short snow
#

ah it is the cog problem

#

@gritty bolt Reviewed

gritty bolt
#

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

exotic ember
#

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

gritty bolt
#

by category, you mean like "Development" would be the category of this channel?

exotic ember
#

yep

gritty bolt
#

@short snow do you really prefer soft red instead of pink for the love poem?

exotic ember
#

if it's an error embed, the convention is to use soft red

vale ibex
#

Similar thing happens in DMs too, I have a PR open for it somewhere

gritty bolt
#

How do I add a cool down on a command?

gritty wind
#

one sec

gritty bolt
#

Thanks. But, how do I use it? What is BucketType.user?

gritty wind
#

You can just add it above the command

gritty bolt
#

Actually, wait, if it is a discord.py command I could probably search the docs

gritty wind
#

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

gritty bolt
#

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?

gritty wind
#

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

short snow
#

We can do it on our own, after sending the result, we can reset the cooldown ig

gritty bolt
short snow
#

Never used it, so idk

gritty wind
#

Ah yeah, that sounds good

gritty bolt
#

If a user decides to spam the command even though max_concurrency is enabled, will the bot on the server automatically punish the user?

short snow
#

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

gritty bolt
#

Oh I see

short snow
#

@green oriole @gritty wind Just a reminder to review the connect four pr. lemon_pleased

cosmic moat
#

@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?

vale ibex
#

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.

cosmic moat
#

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

vale ibex
#

Sure! 🙂

cosmic moat
#

sounds good!

#

also, how can I use emojis in this format?

    issue = "![IssueOpen](https://cdn.discordapp.com/emojis/629695470327037963.webp?size=128 "IssueOpen")"
    issue_closed = "![IssueClosed](https://cdn.discordapp.com/emojis/629695470570307614.webp?size=128 "IssueClosed")"
    pull_request = "![PROpen](https://cdn.discordapp.com/emojis/629695470175780875.webp?size=128 "PROpen")"
    pull_request_closed = "![PRClosed](https://cdn.discordapp.com/emojis/629695470519713818.webp?size=128 "PRClosed")"
    merge = "![PRMerged](https://cdn.discordapp.com/emojis/629695470570176522.webp?size=128 "PRMerged")"
vale ibex
#

those get auto changed into the emoji by discord if they're sent as text

#

Try it

cosmic moat
#

ah

vale ibex
#

Copy paste that into disc

cosmic moat
#

yep

#

alright, thank you

vale ibex
#

👍

#

Remember this when the owl coup begins

cosmic moat
#

forever loyal

#

alright, chages pushed @vale ibex

vale ibex
#

:youtube::post_detail::user::view::like:

#

youtube :post_detail: :user: :view: :like:

#

🤔

cosmic moat
#

ah

#

wrong server

#

sigh

vale ibex
#

Flake8 didn't like the new line after the docstring either

#

do you have the precommit hook setup?

cosmic moat
#

it's passing for me

vale ibex
#

weird

#

what about if you do pipenv run lint?

cosmic moat
#

all passing

vale ibex
#

🤔

cosmic moat
#

even flake8 . gives nothing

vale ibex
#

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

hardy gorge
#

Hmm, this is a message from a flake8 plugin

vale ibex
#

Do you think pipenv install is needed?

hardy gorge
#

Could you do something like pipenv run flake8 --version?

green oriole
hardy gorge
#

And/run pipenv run flake8 without precommit

#

My guess is that precommit bypasses the venv

#

Falls back to systemwide

cosmic moat
hardy gorge
#

And the version?

#

What's the output?

cosmic moat
#

3.8.4 (mccabe: 0.6.1, pycodestyle: 2.6.0, pyflakes: 2.2.0) CPython 3.8.5 on Linux

vale ibex
#

pipenv sync --dev?

hardy gorge
#

So, no plugins installed

#

Try the sync --dev

cosmic moat
#

got it :D

#

alright, that change is pushed as well

vale ibex
clever wraith
#

I need a couple sourcesfor fun facts about python

#

also, where should I store the text file?

vale ibex
#

bot/resources/evergreen

clever wraith
vale ibex
#

As for resources you could open a discussion and ask for some input from the community, or take a look around google

clever wraith
#

ok

#

yup

vale ibex
#

I'm not aware of any sources with many facts, there might be some out there

clever wraith
#

i think maybe making a discusson would be best

short snow
#

Sorry supermazingcoder, got stuck with exam prep today, will see if i can do a review tomorrow

timid sentinel
vale ibex
#

Getting a random one from that could be cool

timid sentinel
#

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

short snow
cosmic moat
#

Thank you for the review @cold moon

#

great suggestions

#

I made all of the changes

short snow
#

@cosmic moat no frequent pushed (is mentioned in contributing guide)

#

make all commits, and push together at end

cosmic moat
#

ah, I was not aware of that

#

I actually didn't know that was a thing

#

what is the difference?

short snow
#

difference in?

cosmic moat
#

between pushing after everyone commit and at the end of them all

brazen charm
#

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

short snow
#

Can everyone see my new pfp or old pfp on github webhook? Cuz even on ipad it shows the old one

sleek steppe
#

it shows the one you have on discord lol

short snow
#

Hmmm

sleek steppe
#

interesting

short snow
#

Lemme try clearing cache

#

Nah, doesn’tnwork 😦

#

Anyway heading of to bed. Gn!

sleek steppe
#

Good night

vale ibex
#

Good luck with the exam!

short snow
#

3 days to go for that. lemon_pleased

vale ibex
#

Ahh fair enough 😄

sleek steppe
#

Why does await ctx.send_help('command') use commands.DefaultHelpCommand for sir-lancebot?

clever wraith
#

it looks like a lesson lemon_thinking

sleek steppe
timid sentinel
clever wraith
#

so how can I get a weird fact from this? lemon_thinking

#

@timid sentinel

timid sentinel
#

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

clever wraith
#

ok

celest charm
#

learn something new every day, right

gritty wind
#

Tbf it can be a shock to people who have never heard about python, though it is certainly infamous for it

clever wraith
obsidian patio
clever wraith
celest charm
clever wraith
#

ok

gritty wind
#

Some lisp programmers stand by it 😔

clever wraith
#

that import thing tho

#

so funny

vale ibex
clever wraith
#

oh wait not yet

#

should I put an absolute path or a relative one for opening the fle?

#

@vale ibex

vale ibex
#

Opening what file?

clever wraith
#

the text file

#

how do I make the help command?

vale ibex
#

Sorry, I don't have the context here. I thought you were having an issue with arrow?

short snow
#

@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?

cosmic moat
#

@short snow all changes addressed

short snow
gritty wind
#

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

cold moon
#

@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?

short snow
gritty wind
#

I think it’s too blocky for that

#

We don’t want to flood pygen

short snow
#

yeah. thought so

#

maybe we could reduce the truncated amount

short snow
#

which is not needed

green oriole
#

Yes

#

In fact, it should even be in an embed

short snow
#

also you have a requested review on c4 on lance along with scaleios

green oriole
#

I may not review the connect four PR until this weekend, but it may get merged before then

short snow
#

we have many study leaves :D, so i have time for coding

#

got timetable today

cosmic moat
#

yeah

short snow
#

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

cold moon
cosmic moat
#

ah I put it in the wrong place

cold moon
#

Yes, search_youtube don't have cooldown, command have cooldown

celest charm
#

@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?

cosmic moat
#

well, it just checks for a non 200 return code and logs it with where it's from and the return code

celest charm
#

why doesn't it also check if the computer is on fire?

cosmic moat
#

LOL

celest charm
#

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.

cosmic moat
#

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

celest charm
#

@cosmic moat it is, youtube/google could have screwed up its DNS stuff

cosmic moat
#

doubt

celest charm
#

well, last year:

  1. google's services were down for a few hours
  2. cloudflare had a royal screwup with DNS
    so it's on the same level of probability
#

i.e. once a year

cosmic moat
#

ah

#

that wouldn't be catched?

celest charm
#

It would be thrown as an exception, and the top-level handler will catch it.

#

So I'd say just leave all the issues to the top-level handler, because doing here otherwise really makes the code hard to read

cosmic moat
#

can I just add an exception at the top

#

and keep the rest

#

i like knowing the error code