#dev-contrib

1 messages ยท Page 135 of 1

fallen patrol
thorny obsidian
#

So, thinking on the contributing tag, something like this? Or do y'all think it's not worth having?

austere hornet
trail pilot
#

Not sure if the main bot has upgraded to the latest DPY version tho

thorny obsidian
#

That would require a large overhaul to how our tags are currently processed

trail pilot
#

Ah

thorny obsidian
#

All of our tags are markdown files that are processed into embeds

trail pilot
#

Ah alright, that makes more sense than just having one large cog with a ton of different commands

#

I wonder if the .tictactoe could be rewritten with the discord UI

vocal prairie
#

Hmm, that sounds interesting

#

It could be buttons attacked in a 3x3 or something like that

trail pilot
#

Yea

#

Once Iโ€™m done with my current PRs I might mess around with it

stable mountainBOT
#
It has arrived!

Here's your reminder: that
[Jump back to when you created the reminder](#dev-contrib message)

clever wraith
#

what are you gamering

clever wraith
#

Hi

patent pivot
fallen patrol
#

what in the world

#

loguru is one of the most cursed libraries i have ever seen

green oriole
#

Pressing submit review when entering a tunnel is always fun

static canyon
#

@green oriole what exactly do you mean by an "explanation" of the regex?

#

I figured the variable name was enough to tell you what it does

green oriole
#

Yes, you did say what it does, but you didn't say how

static canyon
#

Ah right

green oriole
#

This regex is too complex to be understood like that

static canyon
#
reg = r"(?:`[^`\\]*(?:\\.[^`\\]*)*`)" \  # matches inside codeblocks without a group
      r"| ([_|])"  # matches `_` and `|` that weren't captured by previous part, in group 1 for access```something like this?
#

Not quite sure how to word it

#

And I guess I should use re.compile? (never used that before)

short snow
#

you can use () rather \, liek:

reg = (
  r"(?:`[^`\\]*(?:\\.[^`\\]*)*`)"  # matches inside codeblocks without a group
  r"| ([_|])"  # matches `_` and `|` that weren't captured by previous part, in group 1 for access
)
static canyon
#

I just prefer \ for separating strings

#

But yeah

#

What do you think of the comments though? @short snow

#

Are they good enough?

short snow
#

gimme a minute, need to put it into regex101, i don't remember regex symbols ๐Ÿ˜”

green oriole
#

@static canyon seems like I forgot to mention we should use named capture groups, sorry

#

I'd personally add more comments, but I guess that's good enough

short snow
#

yeah the coments are prett nice, what does without a group mean in the first comment pithink

static canyon
#

All the () are non-capturing

static canyon
#

Currently gotpy markdown_regex = ( r"(?:`[^`\\]*(?:\\.[^`\\]*)*`)" # matches inside codeblocks (no capturing groups) r"|(?P<markdown>[_|])" # matches `_` and `|` that weren't captured by previous part inside `markdown` group ) markdown_outside_codeblocks_indices = [ m.span()[0] for m in re.finditer(markdown_regex, content) if m.groupdict().get('markdown') ]

#

Thoughts?

green oriole
#

you don't need a non capturing group anymore

static canyon
#

True

#

I'll get rid of it

#
        markdown_regex = (
            r"(`[^`\\]*(\\.[^`\\]*)*`)"  # matches anything inside codeblocks (backquotes)
            r"|(?P<markdown>[_|])"  # matches `_` and `|` that weren't captured by previous part inside `markdown` group
        )
        markdown_outside_codeblocks_indices = [
            m.span()[0]
            for m in re.finditer(markdown_regex, content)
            if m.groupdict().get('markdown')
        ]```
#

Would help to shorten the second comment but not sure what to (line is exactly 120 chars)

brisk brook
#

One source or confusion I can find is why this means that we now ignore underscores inside codeblocks

#

Can you just mention like "By matching whole codeblocks here first, it means that the following regex won't match characters inside codeblocks"

#

Pretty rough comment, but should get the idea across of what I am imagining @static canyon

static canyon
#

Yep

#

Will add that before

#
        # By first matching everything inside codeblocks, the part that 
        # matches underscores and pipes won't match those within backquotes
        markdown_regex = (
            r"(`[^`\\]*(\\.[^`\\]*)*`)"  # matches anything inside codeblocks (backquotes)
            r"|(?P<markdown>[_|])"  # matches `_` and `|` that weren't captured by previous part inside `markdown` group
        )
        markdown_outside_codeblocks_indices = [
            m.span()[0]
            for m in re.finditer(markdown_regex, content)
            if m.groupdict().get('markdown')
        ]```this good? @brisk brook
brisk brook
#

Yeah I like that

short snow
#

maybe add an example, like the __eq__ one, which was included in the issue description

static canyon
#

I'm happy with this so gonna push in ~3hrs (when I get home) if there's no other feedback

#
    @staticmethod
    def escape_markdown(content: str) -> str:
        """Escape the markdown underlines and spoilers that aren't in codeblocks."""
        # By first matching everything inside codeblocks, the part that
        # matches underscores and pipes won't match those within backquotes
        markdown_regex = (
            r"(`[^`\\]*(\\.[^`\\]*)*`)"  # matches anything inside codeblocks (backquotes)
            r"|(?P<markdown>[_|])"  # matches `_` and `|` that weren't captured by previous part inside `markdown` group
        )
        indices_of_markdown_outside_codeblocks = [
            m.span()[0]
            for m in re.finditer(markdown_regex, content)
            if m.groupdict().get('markdown')
        ]

        escaped_content = ""
        for index, char in enumerate(content):
            if index in indices_of_markdown_outside_codeblocks and (index == 0 or content[index-1] != "\\"):
                escaped_content += "\\" + char
            else:
                escaped_content += char
        return escaped_content
cold island
#

What is the purpose of the \\ and the \\.?

#

For content[index-1] != "\\", include a negative lookbehind

#

And then the loop becomes

escaped_content = "\\".join(content[indices[i]:indices[i+1]] for i in range(len(indices)-1))

(yes, yes, I used range-len)

#

Except if it starts with 0 you'll need to add another \ at the beginning ๐Ÿค”

#

Actually you don't even need to do that

static canyon
cold island
#

What is the purpose of the

([^`]*)*
static canyon
#

Can't remember exactly how it works, but```
([^]*([^]*)*)

cold island
#

Why doesn't

`[^`]*`

Do that?

static canyon
#

That's not between quotes iirc

cold island
#

Or even just

`.*?`
static canyon
#

The latter should work actually yeah

#

My regex knowledge isn't great so I often do stuff way too convoluted

static canyon
cold island
#

You can specify in a regex pattern that you want the match to not follow a specific string

#

So you can say "give me all the markdown symbols that don't follow slashes"

#

Also, are you trying to handle multi-line string as well? I don't use finditer much, but you might need to add the DOTALL flag

#

And if you're trying to handle multi-line code blocks, then the pattern becomes a bit more complex

static canyon
#

Sopy `.*?`|(?P<markdown>(?<!\\)[_|])?

static canyon
cold island
#

Hmmm.. that's true

#

Although I feel like there's an edge case here

static canyon
#

Worked before but not now

cold island
#

โ€‹โ€‹||Hel_lo||`โ€‹

#

!raw 885880207662280734

stable mountainBOT
#
== Raw message ==

`โ€‹โ€‹`โ€‹โ€‹||Hel_lo||`โ€‹โ€‹
cold island
#

Surrounded by backticks, but not in a codeblock

#

You'll need to make sure that you're ignoring proper code blocks

#

The snekbox module handles codeblock detection if you want to take a look

brazen charm
#

how likely is that to occur in a mailing lists?

#

We don't need a needlessly complex regex; it's only to make the text more readable which that wouldn't really be in the first place

static canyon
#

This seems to work for multi-line codeblocks

cold island
#

If it's just for the mailing lists and there's no issue with an occasional mistake a simplified version is fine

#

But that should probably be documented, lest someone copies it later

#

You should really just use the flag for multiline strings

static canyon
#

nvm it doesn't work

cold island
#

The wildcard won't match newlines unless you add the DOTALL flag

cold island
static canyon
#

If a line within the codeblock was empty it didn't work, but made changes which fix it

#

but this breaks if the end of codeblock isn't on a newline lol

cold island
#

I tried in Python and seems to work just fine

#
import re

pattern = r"`.*?`|(?P<markdown>(?<!\\)[_|])"
s = """
\`\`\`py
test_in_g

\`\`\`_in_g
"""

indices_of_markdown_outside_codeblocks = [
    m.span()[0]
    for m in re.finditer(pattern, s, re.DOTALL)
    if m.groupdict().get('markdown')
]

print(indices_of_markdown_outside_codeblocks)```
#

Ignore the slashes in the string lol

static canyon
#

But```py
```py
test```

#

(If the closing backquote is same line)

cold island
#

It does

static canyon
#

But then you're using a completely different reg to me

cold island
#

There's a limit for regex101, you need to try in proper python code

static canyon
#

Right

cold island
#

There's no finditer option there as far as I know

static canyon
#
r"`.*?`|(?P<markdown>(?<!\\)[_|])"
static canyon
#

So I've now got```py
@staticmethod
def escape_markdown(content: str) -> str:
"""Escape the markdown underlines and spoilers that aren't in codeblocks."""
# By first matching everything inside codeblocks, the part that
# matches underscores and pipes won't match those within backquotes
markdown_regex = (
r". *?" # matches anything inside codeblocks (backquotes)
r"|(?P<markdown>(?<!)[_ |])" # matches unescaped _ and | that weren't captured by previous part
)
indices_of_markdown_outside_codeblocks = [
m.span()[0]
for m in re.finditer(markdown_regex, content, re.DOTALL)
if m.groupdict().get('markdown')
]

    escaped_content = ""
    for index, char in enumerate(content):
        if index in indices_of_markdown_outside_codeblocks:
            escaped_content += "\\" + char
        else:
            escaped_content += char
    return escaped_content```
cold island
static canyon
#
return "".join(
    char
    for index,char in enumerate(content)
    if index not in indices_of_markdown_outside_codeblocks
    else "\\" + char
)
cold island
#

Hmm yeah that might work better

#

Though it that case I'd change indices_of_markdown_outside_codeblocks to a set

static canyon
#

Except that's invalid syntax lol

cold island
#

lol, you need to move the if-else to the beginning

static canyon
#

Does this look good?py return "".join( char if index not in indices_of_markdown_outside_codeblocks else "\\" + char for index, char in enumerate(content) )

#

Not quite sure where to split the newlines

cold island
#

I'd put the else on the next line

static canyon
#

I was thinking there because then lines 1+3 directly show the yielded value

#

But if you think I should move then I will @cold island

cold island
#

It seems better to me, but I don't have a strong opinion about it

cold island
#

There's also a space on the 7th line

static canyon
#

yeah I fixed the spaces

#

When I copied it added a load of spaces

static canyon
#

Full Function:```py
@staticmethod
def escape_markdown(content: str) -> str:
"""Escape the markdown underlines and spoilers that aren't in codeblocks."""
# By first matching everything inside codeblocks, the part that
# matches underscores and pipes won't match those within backquotes
markdown_regex = (
r".*?" # matches anything inside codeblocks (backquotes)
r"|(?P<markdown>(?<!)[_|])" # matches unescaped _ and | that weren't captured by previous part
)
indices_of_markdown_outside_codeblocks = {
m.span()[0]
for m in re.finditer(markdown_regex, content, re.DOTALL)
if m.groupdict().get('markdown')
}

    return "".join(
        char
        if index not in indices_of_markdown_outside_codeblocks
        else "\\" + char
        for index, char in enumerate(content)
    )```
brisk brook
#

What is the output of the same blog post I opened the issue for?

#

That should be a good test

cold island
#

m.groupdict().get('markdown') can be replaced with m.group("markdown")

#

m.span()[0] can be replaced with m.start()

#

It doesn't particularly matter, but in your case where you have a constant pattern I'd store it after compilation

#

Meaning markdown_regex = re.compile(...) and then markdown_regex.finditer(...)

static canyon
#

As a constant at top of file?

cold island
#

Either instead of the current line or at the top of the file yeah

#

We do it at the top in other modules so let's go with that

#

with screaming snake case

static canyon
#

Yep

#

Screaming since constant

static canyon
#

Does this look good? @cold island```py
MARKDOWN_REGEX = re.compile(
r".*?" # matches anything inside codeblocks (backquotes)
r"|(?P<markdown>(?<!\)[_|])", # matches unescaped _ and | that weren't captured by previous part
re.DOTALL
)

...
@staticmethod
def escape_markdown(content: str) -> str:
"""Escape the markdown underlines and spoilers that aren't in codeblocks."""
# By first matching everything inside codeblocks, the part that
# matches underscores and pipes won't match those within codeblocks
indices_of_markdown_outside_codeblocks = {
m.start()
for m in re.finditer(MARKDOWN_REGEX, content)
if m.group('markdown')
}

    return "".join(
        "\\" + char
        if index in indices_of_markdown_outside_codeblocks
        else char
        for index, char in enumerate(content)
    )
cold island
#

You can use MARKDOWN_REGEX.finditer(content). Otherwise I think looks fine

static canyon
#

Right yeah

#

Thanks

static canyon
#

@cold island @brisk brook @green oriole all pushed into bot#1822, thanks for the help ๐Ÿ‘

dusky shoreBOT
patent pivot
#

why do we only have 5 projects on site homepage

#

ah we transferred django-simple-bulma

#

what should we replace it with? poll time.

#

!poll "What should be the 6th repository on pythondiscord.com homepage?" "King Arthur" "Pixels" "Quackstack"

stable mountainBOT
#
What should be the 6th repository on pythondiscord.com homepage?

๐Ÿ‡ฆ - King Arthur
๐Ÿ‡ง - Pixels
๐Ÿ‡จ - Quackstack

patent pivot
#

!remind 3h check this

stable mountainBOT
#
Sure.

Your reminder will arrive on <t:1631312528:F>!

vale ibex
#

branding?

patent pivot
#

we've always locked it to python projects in prior, I'm not opposed to branding though

vale ibex
#

hmm yea true

#

I'm not fussed

vale ibex
austere hornet
#

Nooo RIP @Code Jam Participants

#

Ik that's off topic mb

#

There's nowhere else to write it tho

patent pivot
#

has a decent few users

vale ibex
#

speaking of metricity

#

metricity#7

dusky shoreBOT
austere hornet
#

You're lucky @clever wraith you're name is still green, but lighter

#

Well yeah

vale ibex
#

they're auto-dismissed

#

from the force pushes

#

bash has shopt

dim pelican
#

This aint luck, this is dedicated hard work

stable mountainBOT
#

entry_point.sh line 6

shopt -s nocasematch```
dim pelican
vale ibex
#

the next line I do a string compare

#

that shopt makes it case insensitive

#

yup

dim pelican
#

That's not bad, that is like looking for something relatively quick and easy to help out with

dusky shoreBOT
dim pelican
#

that is 113 files my man

vocal prairie
austere hornet
#

Hey @vale ibex , when you have a moment, could you please "accept" the changes on sir-lancebot#843 so this is not showing up? Would greatly appreciate it. Thanks so much!

dusky shoreBOT
vale ibex
#

feel free to dismiss my review if you've done the changes

#

Then if another core dev looks at it before me then it's fine

green oriole
#

Psstt.. they can't dismiss reviews

vale ibex
#

ah lol

austere hornet
vale ibex
#

well someone can at some point if they get to it before me ๐Ÿ˜›

green oriole
#

Imagine me logging in to that device

#

It has become a meme at that point

austere hornet
vocal prairie
#

np, i was reviewing stuff anyway

stable mountainBOT
patent pivot
#

okay king arthur wins

#

PRing

#

wait why did tests fail

#

is github ratelimited or something

#

hmmmmm

#

yeah idk what's going on

#

this works locally

#

ah wait the tests do fail locally

#

fixed it, had to update the test data json

#

okay, PR is ready for review

short snow
#

Anyone needing some reviews lemon_hyperpleased

#

oh shit my green ๐Ÿ˜”

austere hornet
vocal prairie
short snow
#

I dunno django

patent pivot
vocal prairie
#

oh yeah I meant to review that but I lost wifi lemon_angrysad

dim pelican
#

Just noticed the passes in the tests for that one

short snow
#

joe why not make it 9 ferrisBongoHyper

patent pivot
#

9 projects?

short snow
#

yeah

patent pivot
#

maybe in future, but for now we need to get 6, lol

vocal prairie
#

Do we have that many significant projects that are accepting open source contribs?

short snow
#

quackstack, kubernetes, pixels

#

kubernetes idts

vocal prairie
#

True

short snow
#

but there isn't another one

#

lol

vocal prairie
#

Forms could be a possibility once it becomes not just staff

patent pivot
#

Kubernetes has accepted contribs iirc

#

in fact

short snow
#

then there you go ๐Ÿ™ƒ

patent pivot
#

!remind 14h docs for k8s

stable mountainBOT
#
You got it!

Your reminder will arrive on <t:1631375433:F>!

patent pivot
#

I'm migrating internal docs from notion to GitHub pages

#

our run books, post-mortems and hopefully much more

thorny obsidian
#

nah, .aoc countdown should be fine

short snow
#

who is shom770 on discord?

thorny obsidian
#

frontogensis iirc?

short snow
#

Ah so @trail pilot I really like the use of discord menus for this but as a user, I would like to view the basic information about the challenge first and then if I am interested in it, I would go see the full problem description. So I think there should be two views, one which would be originally sent, something like the original of this PR and then we should go show the full problem (like the default view of the current PR state).

But that's personal preference.

trail pilot
#

Hello! Thanks for the feedback. The thing is though that I'm not really sure, as I've gotten conflicting feedback. Some people want the description and the difficulty, then miscellaneous infomration

#

and others want the same as you want

#

So I'm not really sure what to do tbh

short snow
#

Ah, I see, we could probably have a vote here?

short snow
#

@cold island I think we need to update the message content limits on site

cold island
#

I updated it for the embed. I recalled we already updated it in other places. It still bugs out with the latest version of the site?

short snow
#

is the capping done on the database, so i would need to create the tables again?

cold island
#

Should've been just validation

short snow
cold island
#

Might try running a migration when I'm more awake

short snow
#

how do you delete everything from a db

cold island
#

I'd just delete the container

short snow
#

not running with docker ๐Ÿ™ƒ

cold island
#

Well there's your mistake right there

short snow
#

kek for some reason, docker just makes my memory usage go brrr, so i use it only for extreme cases

sullen phoenix
#

delete the db with DROP DATABASE <name> lol

#

don't go fooling around with that in production though lmao

#

i vaguely remember someone dropping some dbs in production..

short snow
#

Yeah I don't do that in production, just seeing if that's the problem with the content limits

trail pilot
#

React to this for Option 1, Option 1 is the image below:

#

React to this for Option 2, Option 2 is the image below:

uncut shore
#

!voiceverification

stable mountainBOT
#

Voice verification

Canโ€™t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.

proper oyster
#

#bot-commands

fallen patrol
#

Hey, could sir-lance get the trashcan added to the bottom of issue autolinking?

#

I've done it here, its not hard, willing to implement it for lance ( since all of the stuff for it already exists)

placid ermine
#

this stuff isn't as important

molten perch
fallen patrol
#

Well

#

The automatic file link stuff already has a trashcan

#

And IMO anything that parses user msgs like should have an option to delete the response

glacial veldt
static canyon
#

[Errno 38] Function not implemented
I'd guess the feature was removed from snekbox to protect it

#

Can't be certain though

cold island
#

(on main)

dim pelican
dusky shoreBOT
dim pelican
#

Essentially I am at a stand still trying to figure out whether to leave the command the way it is, with sending a link, or sending the text of the README section, or as Joe suggested, writing to a file and letting Discord preview it.

short snow
sinful knot
#

ah Iย noticed my code had bugs and fixed it but someone else is actually working on it smh

trail pilot
#

then other info

placid ermine
#

๐Ÿ‘

static canyon
#

But also link to since preview doesn't exist on mobile

sinful knot
#

it works afaik

dim pelican
#

Thanks @static canyon !

green oriole
green oriole
stable mountainBOT
trail pilot
placid ermine
#

that's perfect

trail pilot
placid ermine
#

nice

#

is this the first command on lance with menus/buttons ๐Ÿ‘€

glacial veldt
trail pilot
#

I might start adding buttons to other commands

#

like possibly buttons for tictactoe

brazen charm
trail pilot
#

at least making issues for it

brazen charm
#

what's the view button for when the title has the link?

trail pilot
#

Ohhh

#

It was on my PR

#

to add the link to the name along with the link button

green oriole
glacial veldt
#

From 1 to like 5?

patent pivot
#

think we went 6 or something in the end so that a multiprocessing pool worked

cold island
vale ibex
#

@brazen charm Just out of interest, since my knowledge on async is a little limited. What is the use of specifying a loop, if it'll just get the running one anyway?

brazen charm
#

The init tasks are started before the loop is started so they'd fail with a runtime error

vale ibex
#

ahhh right, so adding it to the bot loop means they'll wait until that loop is started?

brazen charm
#

yes, it creates a task bound to that loop and then it'll be scheduled when the loop is started

vale ibex
#

That makes a lot of sense, thanks

wild prism
#

@thorny obsidian did you do anything with the dddg issue? I can take care of it, I just haven't been paying attention and making sure you're not already sitting on something

thorny obsidian
vale ibex
#

@cold island What version of docker-compose are you running?

#

I don't get an issue with this compose file

cold island
#

Version? how do I check? the version of the compose is set in the file, isn't it?

vale ibex
#

docker-compose --version

cold island
#

1.25.5

vale ibex
#

Your terminal is complaining about lines 42-44, but it's valid syntax

#

hmm, I'm on 1.29.2

cold island
#

I suppose I can try updating docker

vale ibex
#

yea, but it's not a good sign that this is such a recent feature

#

since contribs might run into it too

cold island
#

If there's a simple backwards compatible solution then that might be good

vale ibex
#

could you try updating the version string in the compose to 3.9 and see if it complains?

cold island
#

sec

vale ibex
#

I'm hoping it'll give a nicer message saying you need to update

cold island
vale ibex
#

has 3.9 in the example so I had guessed that's the most recent

cold island
#

Hmm.. I guess since it's from 1.27 my version isn't even aware of it

vale ibex
#

yea, that mmakes sense

#

These topics describe the Docker Compose implementation of the Compose format. Docker Compose 1.27.0+ implements the format defined by the Compose Specification.

static canyon
# sinful knot it works afaik

From my testing this doesn't work with multi-line codeblocks, and it also doesn't taken into account pre-escaped markdown (the latter definitely being any easy fix).

Although honestly at this point I've got a working solution so unless you can come up with something better I'll just stick to what I came up with thanks to Zig's help.

vale ibex
#

The reason I want to keep this, as it's a very nice way to make containers wait for psql to be ready, rather than doing it in code

#

If we can't use these, I'd need to add health checks to site and metricity, since they don't wait for postgres otherwise

cold island
#

I don't mind being on the bleeding edge, I'm just wondering if there's no version of this functionality in 3.8

vale ibex
#

It looks like this was added in 1.27

#

rather than a specific compose spec version

cold island
#

I see

#

I'll just update then

vale ibex
#

I am wonder wtf the version string is for

#

ah

cold island
#

compose file version

vale ibex
#

There is no point

cold island
#

lol

gritty wind
#

I don't think asking people to upgrade compose is such a bad thing anyways

#

How else would anyone know they even have to update lol

vale ibex
#

!vote "If you run docker-compose --version what version is output?" "<1.27.0" ">=1.27.0"

stable mountainBOT
#
If you run `docker-compose --version` what version is output?

๐Ÿ‡ฆ - <1.27.0
๐Ÿ‡ง - >=1.27.0

gritty wind
#

(Doesn't docker windows force updates on you actually)

vale ibex
#

yup

#

docker desktop pops up on boot fit here's an update

sinful knot
cold island
gritty wind
#

Ahh

#

I like what chrome does

#

It displays a color in your address bar on the settings button, and it goes from green to blood red the longer you put off an update

static canyon
gritty wind
#

And I exist in the danger zone

vale ibex
#

lol

fallen patrol
#

.src gh

#

.....

#

at some point

#

i

#

can .src be whitelisted in these channels??

static canyon
#

.src

dusky shoreBOT
static canyon
#

.src src

dusky shoreBOT
#
Command: source

Display information and a GitHub link to the source code of a command, tag, or cog.

Source Code
vocal prairie
#

That would be nice. I kind of wish that command only took one word for an arg

fallen patrol
static canyon
#

.src gh

dusky shoreBOT
#
Command: github

Commands for finding information related to GitHub.

Source Code
sinful knot
trail pilot
#

by the way src can be weird sometimes

#

.src help help help help help

static canyon
trail pilot
sinful knot
static canyon
vocal prairie
dusky shoreBOT
#
That was a mistake.

Your input was invalid: Unable to convert test whattt. This fails to valid command or Cog.

Usage:```
.source [source_item]

trail pilot
vocal prairie
#

I don't get why this takes the whole sentence and that doesn't

trail pilot
#

yea^

sinful knot
vale ibex
#

.src help ping

dusky shoreBOT
#
Command: help

Shows Command Help.

Source Code
vale ibex
#

.src help some random

dusky shoreBOT
#
Command: help

Shows Command Help.

Source Code
sinful knot
fallen patrol
#

ah yeah

vale ibex
#

I mean it just uses the first arg right?

fallen patrol
#

@vale ibex check the source, it has a special check for help

vale ibex
#

.src ping ping

dusky shoreBOT
#
Command: ping

Ping the bot to see its latency and state.

Source Code
vale ibex
#

.src ping random

static canyon
#

@sinful knot
edit: doesn't have the dotall which is probs why

dusky shoreBOT
#
Command: ping

Ping the bot to see its latency and state.

Source Code
vale ibex
#

??

#

I don't see the issue

fallen patrol
vale ibex
#

well yea, that's not a valid cog

fallen patrol
vale ibex
#

ooga isn't a valid command

vale ibex
#

so you'd expect it not to error?

#

I might be missing something here, but if you give it an invalid command, then it'll error, if you give it a valid one it'll give you the source?

patent pivot
#

that's working as expected

static canyon
fallen patrol
fallen patrol
vale ibex
#

yea, but it only looks at the first arg right?

fallen patrol
#

that one got both

patent pivot
#

it looks for subcommands

#

it won't factor in arguments

#

that is working as expected, there is no bug

sinful knot
patent pivot
#

it resolved up to the last working command and returned the help for that

vale ibex
fallen patrol
#

then why

static canyon
fallen patrol
vale ibex
#

.src ping Check here for the source of the ping command

dusky shoreBOT
#
Command: ping

Ping the bot to see its latency and state.

Source Code
fallen patrol
#

does this error

#

hmmmm

vale ibex
#

because sdf isn't a sub command

fallen patrol
#

because ext is a command isn't it?

vocal prairie
#

ahh, it's subcommands

#

that makes more sense

fallen patrol
vale ibex
#

yea, but ping doesn't have sub commands

vocal prairie
#

ping has no subcommands, so it doesn't check for them

static canyon
#

They one you linked on Discord does but I copied from the one you linked on GH which doesn't @sinful knot

patent pivot
#

yeah it's fine, I'm telling you, this isn't a bug

static canyon
sinful knot
#

huh

vale ibex
#

@cold island @green oriole re bot#1817 this regex isn't behaving as I'd expect. See https://regex101.com/r/jCW2t4/1 it doesn't match for this string, even though I'd expect it too

dusky shoreBOT
vale ibex
#

For some reason changing the \b to \B works

sinful knot
cold island
green oriole
#

Huh

#

That's interesting

#

I'll have a look tomorrow

#

That and the robots.txt PR

static canyon
#

@sinful knot you also have to use *? instead of just * for the codeblock part, or it breaks when there's more than one

vale ibex
# green oriole That and the robots.txt PR

No idea how long regex101 links last, so here's the cleaned up regex if it's useful ```
(?:discord(?:[.,]|dot)gg|discord(?:[.,]|dot)com(?:/|slash)invite|discordapp(?:[.,]|dot)com(?:/|slash)invite|discord(?:[.,]|dot)me|discord(?:[.,]|dot)li|discord(?:[.,]|dot)io|(?:\b([.,]|dot))gg)(?:[/]|slash)([a-zA-Z0-9-]+)

vale ibex
cold island
vale ibex
#

Makes sense

cold island
#

So a word boundary doesn't really make sense

static canyon
vale ibex
#

Ah yea, it matches on dotgg/

vocal prairie
vale ibex
#

bleeeeeding edge there dawn

cold island
vocal prairie
#

yeah, I broke docker-compose a while ago so I started using it as part of the docker cli

cold island
vale ibex
#

yea that's all I had to do

#

Maybe it needs a reboot? shrugR

cold island
#

ugh, maybe

vale ibex
#

unless the old version is still there and your path env has it hoisted

sinful knot
cold island
#

It checks that there's no preceding slash

#

It's called a negative lookbehind

static canyon
# sinful knot I don't understand what this does, could you explain?
re.sub(
    r"(?P<code_block>`.*?`)|(?P<markdown>(?<!\\)[_|])",
    lambda match: "\\" + match.groupdict()["markdown"]
    if match.groupdict()["markdown"] is not None
    else match.groupdict()["code_block"],
    string,
    flags=re.DOTALL,
)```it's used in the markdown part, to essentially say "match `_` or `|`, but not if it has a `\` before it"
#

Aka don't match pre-escaped markdown

sinful knot
#

Ah ok got it thx

brisk brook
gritty wind
#

Shh don't expose me like this

static canyon
#
# By first matching everything within a codeblock,
# when matching markdown it won't be within a codeblock
MARKDOWN_REGEX = re.compile(
    r"(?P<code_block>`.*?`)"  # matches everything within a codeblock
    r"|(?P<markdown>(?<!\\)[_|])",  # matches unescaped `_` and `|`
    re.DOTALL
)

...
def escape_markdown(content):
    """..."""
    return re.sub(
        MARKDOWN_REGEX,
        lambda match: "\\" + markdown_group
        if (markdown_group := match.group("markdown"))
        else match.group("code_block"),
        content
    )```I guess this is the end-version that I'd PR if I go for this @sinful knot
#

Thoughts?

fallen patrol
#

if I had closed vsc it would have updated

cold island
static canyon
#

Right yeah

#

Move the re.DOTALL

sinful knot
fallen patrol
#

oh that's what the r is for

fallen patrol
#

regex

cold island
#

Considering just re-installing docker

cold island
fallen patrol
#

oh

cold island
#

Means, escape all special characters

#

so \n is literally slash-n and not a newline

fallen patrol
#

ah

static canyon
#

I'm a big advocate of walrus so use it pretty much wherever I can

sinful knot
cold island
green oriole
cold island
green oriole
#

Is it

cold island
#

Because of the slash

green oriole
#

Yeah, plus the slash

#

Oh wait

cold island
#

the or won't work with the slash though

green oriole
#

You don't want to add a slash if markdown didn't match?

static canyon
#

markdown has slash, code_block does not

green oriole
#

Doesn't re.Match.group return None if there is no match though

#

Oh nevermind, that works

cold island
#

You can switch it around I guess. Check if there is a codeblock

#

match.group("code_block") or "\\" + match.group("markdown")

green oriole
#

Eeeh, I feel like it should be a function with an explicit if. I find it very hard to understand as you may have guessed haha

#

That or works too

static canyon
#

The two statements aren't the same

cold island
#

We want the code block to still be in the escaped text, do we not?

green oriole
static canyon
#

What I'm saying is both code_block and markdown can be not-None

green oriole
#

Can we just use an actual function please

cold island
static canyon
#

Because it's an | (or)

cold island
#

Yes

static canyon
#

Wait nvm

cold island
#

So only one

static canyon
#

codeblock|markdown can only give one or the other?

cold island
#

Correct

green oriole
#
if markdown_match := match.group("markdown"):
    return r"\" + markdown_group
else:
    return match.group("code_block")
```and everyone is happy
cold island
#

If it matches one part, it won't continue to the next

gritty wind
#

Anyone know how the changelog blacklist works with threads?

static canyon
cold island
static canyon
#

r"\" doesn't work btw

green oriole
#

Fair

gritty wind
#

As expected is the answer

#

It's called that in the config

green oriole
gritty wind
green oriole
#

!remind 13h this

stable mountainBOT
#
I'll allow it.

Your reminder will arrive on <t:1631435885:F>!

gritty wind
#

It ignores threads is what I'm saying

green oriole
#

I mean

#

2.0 hasn't been merged lol

static canyon
cold island
#
# By first matching everything within a codeblock,
# when matching markdown it won't be within a codeblock
MARKDOWN_REGEX = re.compile(
    r"(?P<code_block>`.*?`)"  # matches everything within a codeblock
    r"|(?P<markdown>(?<!\\)[_|])",  # matches unescaped `_` and `|`
    re.DOTALL
)

...
def escape_markdown(content):
    """..."""
    return MARKDOWN_REGEX.sub(
        lambda match: match.group("code_block") or "\\" + match.group("markdown"),
        content
    )

Seems fine, assuming it works

gritty wind
#

Oh fair lol

static canyon
#

I'll test what Zig said and if it works I'll go with it

#

Otherwise I'll make it a function

green oriole
cold island
#

Threads shouldn't be blacklisted though

static canyon
#

It doesn't work

cold island
green oriole
#

Yeah, like threads in #admins should be blacklisted

static canyon
#

wait a sec

green oriole
#

Also #mod-log should have better messages than "channel created"

static canyon
#

It seems to work

#

So I'll go with Zig's message

cold island
#

Which is really just a combo of what Ryu and Akarys suggested

static canyon
#

Yeah

#
# By first matching everything within a code block,
# when matching markdown it won't be within a code block
MARKDOWN_REGEX = re.compile(
    r"(?P<code_block>`.*?`)"  # matches everything within a codeblock
    r"|(?P<markdown>(?<!\\)[_|])",  # matches unescaped `_` and `|`
    re.DOTALL  # required to support multi-line code blocks
)
...
    @staticmethod
    def escape_markdown(content: str) -> str:
        """Escape the markdown underlines and spoilers that aren't in codeblocks."""
        return MARKDOWN_REGEX.sub(
            lambda match: match.group("code_block") or "\\" + match.group("markdown"),
            content
        )```this look good?
cold island
#

You can include Ryu as co-author fwiw

green oriole
#

OK I didn't want any co-authoring anyway lemon_pensive lemon_pensive lemon_pensive lemon_pensive lemon_pensive lemon_pensive lemon_pensive

gritty wind
#

Can I get some quick reviews on

#

Just a change to config, shouldn't take much time

cold island
static canyon
#

Aight

#

And how exactly do I add a co-author?

cold island
#

Co-authored-by: username <email>

#

In the commit body

fallen patrol
#

so what is message changelog

static canyon
#

It can go in the description right?

cold island
brazen charm
#

Yes, at the bottom

gritty wind
#

Morged, thanks y'all

static canyon
#

username or @username ?

fallen patrol
#

i saw that pr but what even was it

gritty wind
#

Message change log is the dark place where edited/deleted messages get logged for moderation purposes

fallen patrol
#

ah

#

๐Ÿ‘€

#

and this channel is exempt

#

noice

gritty wind
#

The blacklist excludes certain channels from making it there, such as the admins channel

fallen patrol
#

lol

brazen charm
#

this channel is not excluded

fallen patrol
#

this channel is exempt

#

oh

#

wait

#

that diff confused me

gritty wind
#

Had to do it that way to maintain alignment

fallen patrol
#

why is it named core-dev and not dev-core

gritty wind
patent pivot
#

not voting on dev cores

fallen patrol
#

ah

cold island
#

Time for a new computer

green oriole
#

lol

#

What is the issue?

static canyon
#

bot#1822

dusky shoreBOT
green oriole
#

I'd usually just copy paste the author line from a commit of this user

#

Yeah, you forgot the ๐Ÿ“ง

#

Wat

#

The email

static canyon
#

It doesn't show the email on the github page though

#

So idk it

#

Unless I'm blind

fallen patrol
#

pretty sure caps: Co-Authored-By: username <email>

green oriole
#

Actually I'll use mine since it doesn't have any private information

#

My author line is usually Matteo Bertucci <matteobertucci2004@gmail.com>

#

So you can add to your commit Co-authored-by: Matteo Bertucci <matteobertucci2004@gmail.com>

static canyon
#

Ah, got it

#

ty

green oriole
#

If you are wondering how I got this link btw, you just have to find a commit from the author you want to co author and add .patch at the end of the url

static canyon
#

Yeah

#

I noticed

cold island
#

What horrible UI

green oriole
#

I think it makes sense

cold island
green oriole
#

Please tell me you aren't on windows

cold island
#

I am

green oriole
#

Gosh no

#

Could you just pip install it?

#

And pretend the docker desktop version doesn't exist?

static canyon
#

There we go, it worked this time. Thanks @green oriole ๐Ÿ‘

green oriole
#

No probs

cold island
green oriole
#

Sweet

brisk brook
cold island
#

@vale ibex hmmm how can I start the bot with metricity but assume site is already up

vale ibex
#

How would you start the bot now and assume site is already up?

#

Since bot depends on web now, I don't think you can, so we're not regressing on that

#

for these edge cases, you can make a docker-compose override file

cold island
#

The issue is that I want to test the whole thing, but I can't test your bot branch with the site main version

#

I need to use your site branch

vale ibex
#

Ah, if you build the site image from my branch

#

then change the image string in the bot compose to the name of the local image, rather than the url

#

IE image: ghcr.io/python-discord/site:latest -> image: site_web

cold island
#

yeah tried it just now, doesn't work

#

can't connect

vale ibex
#

did you stop the site container?

cold island
#

yeah

#

otherwise it would say the port is busy

vale ibex
#

hmmm

#

That's odd

#

What's the error?

cold island
#

Ahh I think I know, the config is set to running the bot locally

vale ibex
#

Which config?

cold island
#

the bot's

vale ibex
#

how so?

#

I run it all in docker fine

cold island
#

Nope, still not connecting

vale ibex
#

So the only change from my branch you've made is setting the site image right?

cold island
#

yeah

vale ibex
#

kk lemme try

#

kk, I've checked out my site branch and building that image

#

I then kill the container and do docker-compose down

#

checkout my bot branch and change site image to site_web

#

docker-compose up

#

site starts before metricty finishes migrations

#

hmmm

#

ah lol

#

line 49

#

I've got metricity pushing to pysite

sinful knot
vale ibex
#

kk that commit should sort it @cold island

#

nice catch, since I think had psql already migrated somehow when testing ๐Ÿ˜ฆ

cold island
vale ibex
#

lmfao

austere hornet
patent pivot
#

lmfao

cold island
vale ibex
#

Is it an error within docker, or a container

#

I only ask as that fixed worked for me, on a fresh setup

cold island
vale ibex
#

it looks like your config.yml is trying to connect to localhost

#

rather than site in docker

cold island
#

yyyes.. that's what I always used to run the bot

#

Should I change it to web?

vale ibex
#

Yea, this is my config for running in docker

cold island
#

ok great

#

I'll finish it tomorrow, need to now create a local image of metricity to use a different config

#

Also metricity logs are a bit noisy

patent pivot
#

true

vale ibex
#

yea lol

static canyon
#

!remind 9h add escaping to py-news titles

stable mountainBOT
#
Yeah okay.

Your reminder will arrive on <t:1631433862:F>!

fallen patrol
#

!src src

stable mountainBOT
#
Command: source

Display information and a GitHub link to the source code of a command, tag, or cog.

Source Code
austere hornet
patent pivot
#

!doc refreshdoc

stable mountainBOT
#
Inventories refreshed
austere hornet
#

Thx

fallen patrol
#

@patent pivot how can you use something as cursed as loguru

patent pivot
#

?

stable mountainBOT
#

loguru/_get_frame.py lines 5 to 12

def get_frame_fallback(n):
    try:
        raise Exception
    except Exception:
        frame = exc_info()[2].tb_frame.f_back
        for _ in range(n):
            frame = frame.f_back
        return frame```
patent pivot
#

what's wrong with that

fallen patrol
#

that runs on every single log method

patent pivot
#

the point of using loguru is so that loguru does that for me and I don't need to do it - it's doing it for a purpose, not for shits and giggles

fallen patrol
#

is that not cursed tho?

patent pivot
#

not really?

#

it's doing something that it can only capture that way

fallen patrol
#

!d sys._getframe

stable mountainBOT
#

sys._getframe([depth])```
Return a frame object from the call stack. If optional integer *depth* is given, return the frame object that many calls below the top of the stack. If that is deeper than the call stack, [`ValueError`](https://docs.python.org/3.10/library/exceptions.html#ValueError "ValueError") is raised. The default for *depth* is zero, returning the frame at the top of the call stack.

Raises an [auditing event](https://docs.python.org/3.10/library/sys.html#auditing) `sys._getframe` with no arguments.

**CPython implementation detail:** This function should be used for internal and specialized purposes only. It is not guaranteed to exist in all implementations of Python.
fallen patrol
#

it can do it a different way

patent pivot
#

yes... and it does

#

note the name: fallback

stable mountainBOT
#

loguru/_get_frame.py lines 15 to 18

if hasattr(sys, "_getframe"):
    get_frame = sys._getframe
else:
    get_frame = get_frame_fallback```
patent pivot
#

it uses the above method if the sys provided one is not present

fallen patrol
#

is there not a better way to get the frame if the method does not exist?

#

try/except just seems....

#

cursed

patent pivot
#

there isn't really a better way, no

#

it's not that bad

#

you generate an exception to grab you the frame, that makes sense in my head

#

but as the docstring above notes _getframe isn't present in all implementations, you are looking at a compatibility snippet, and yeah, they do get pretty weird sometimes, is it cursed? no.

fallen patrol
#

eh

#

i guess?

patent pivot
#

it's literally only fell back on for compatibility with a variety of interpreters

#

it's the best way to capture a trace

#

it guarantees you to have a frame without needing to be in the middle of an actual exception

fallen patrol
#

i guess... idk

#

it just feels like there should be a better way to get a frame

patent pivot
#

yeah

#

there is

#

it's _getframe

#

this is just for the environments where that's not implemented

fallen patrol
#

but in not-cpython pithink

#

it doesn't make sense to me that the only place to get a frame is in excepts

patent pivot
#

i mean, a good few of them still implement it, it's just not guaranteed

#

pypy does ```py
โžœ ~ pypy3
Python 3.7.10 (77787b8f4c49115346d1e9cbaf48734137417738, Jun 13 2021, 02:02:23)
[PyPy 7.3.5 with GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import sys
sys._getframe
<built-in function _getframe>

patent pivot
#

and _getframe is prefixed with _ because of that, it isn't a super public method

#

but it works for cases like this, and where it's not implemented the workaround there makes sense

fallen patrol
#

eh... still not convinced, will have to sleep on it ig

patent pivot
#

i will announce at some point

#

but i migrated all our internal docs to residing within github, and will be trying to add more for all tasks we have - stuff like adding new prometheus alerts

celest charm
#

The thing is, all more or less working Python implementations (CPython, PyPy, Jython, IronPython, GraalVM, Brython) have sys._getframe, so how would you even test this function?

patent pivot
celest charm
#

cython isn't an implementation

#

well, sort of

patent pivot
#

in terms of things loguru will support, it's an environment

celest charm
#

let me try

short snow
patent pivot
#

lol

#

I'm the only on call

#

I don't trust my alerting enough to wake others

celest charm
#

@patent pivot Cython does have sys._getframe, why wouldn't it

short snow
#

thankyou for the query section, makes my life easier to not go google and spend hours on docs ๐Ÿ™ƒ

celest charm
#

Cython runs on CPython, CPython has _getframe

stable mountainBOT
#

tests/test_get_frame.py lines 7 to 13

def test_with_sys_getframe(monkeypatch):
    def patched():
        return

    monkeypatch.setattr(sys, "_getframe", patched())
    get_frame_module = importlib.reload(loguru._get_frame)
    assert get_frame_module.get_frame == patched()```
short snow
#

btw look like wikiguess game didn't get change logged, might want to do that?

celest charm
#

it really seems like testing for the sake of testing

#

it would also happily pass this implementation ```py
get_frame = None

#

and what's the point of this patched function?

brazen charm
fallen patrol
#

i have no idea!

celest charm
#

it's monkeypatching the stdlib

fallen patrol
#

yeh

celest charm
#

I'm not confused about the monkeypatch, but why make a function that returns none and then call it right away?

sour viper
#

Hey ! If I were to start discussing something about contributing here, would I be interrupting someone right now or is there a channel specific or this the one ?

celest charm
#

it's okay to talk past each other here ๐Ÿ‘

#

well, with reasonable limits

sour viper
#

So I was going through the issues and found one interesting and maybe one I could implement, let me just quickly grab the issue

#

Oh god, I didn't see the comments but it is marked as closed, does that mean its implemented already ?

#

Was the ok for me ?

#

I dont see any PR for the Hangman command so I'm not sure if it is just gone or closed as in no one will do it

placid ermine
static canyon
#

I need to implement escaping into the titles of #mailing-lists posts; should I put it as part of bot#1822 or make a new issue+PR?

dusky shoreBOT
sour viper
short snow
#

you could put into the same PR tizzy imo since its basically fixing the escapes

#

jsut remember to update the pr descrition

static canyon
#

Oh yeah

#

ty

short snow
#

you are fast ๐Ÿ‘€

static canyon
#

lol

#

Being able to type 120wpm has its advantages

stable mountainBOT
static canyon
#

Already done :p

stable mountainBOT
vale ibex
#

Oh no, I just realised that everytime I start the bot I get an email from metabase saying there's a new login on my account

#

I have over 100 emails

cold island
#

Lmao

vale ibex
#

i didn't notice since they were put under the promotions label in gmail for some reason ๐Ÿ˜…

sour viper
#

Hey so I found an issue I think i will be able to contribute to ? Should I just comment in the issue, Id like to contribute and will it get assigned to me ?

#

Or is there any other procedure for assigning the items to yourself ?

molten perch
sour viper
#

Okay, thanks for the info !

static canyon
#

That way you just need a list of valid words, random letters for the user using itertools.permutations to make sure there's at least one valid word, and then for validation that's it's a valid word just check it's in the list

#

Or perhaps it would be better to randomly pick a word from the list of valid words, and shuffle the letters (random choice from the permutation or something)

sour viper
#

Looks interesting my approach was a bit straightforward Create a list of all anagrams which can be made (JSON file maybe)
Select a word which has anagrams from JSON at random and scramble the word so its letters are jumbled
Users will suggest words which are anagrams, check in JSON if they are valid anagrams if yes award points (still figuring out how to do that)

static canyon
#

All anagrams is going to be way too big to account for though

sour viper
#

i looked online

static canyon
#

Just store all valid words

sour viper
#

apparently small list

#

Not sure if this the exhaustive list

static canyon
#

Doesn't even have santa and satan smh

#

Lol

sour viper
#

Huh, can you point me in the direction where I could find an exhaustive list ? Or Google will be my buddy.

static canyon
#

Not just letters that can make a word

#

So e.g. pat --> tap
bpta can make tap but doesn't count since bpta isn't a word

sour viper
static canyon
#

And do you want one word things?

#

Or can funeral --> real fun be valid?

#

I suppose it'd interpret as real, fun (two separate)

sour viper
#

I was thinking of keeping it simple single word only, i saw some 2 words examples but thought implementation would be a bit complicated

static canyon
#

I mean you can just treat it as two separate entries I guess

static canyon
#

I mean do you really need to store all anagrams? I don't get why you do

#

hmm

sour viper
#

Im not sure how Id go on about, if someone enters anagram command, i cant just list out some random letters and expect them to make words it may or may not be possible. But if I have a list of preconfirmed anagrams

vale ibex
#

Have a long word list, when the command is invoked, choose one at random and shuffle the word

#

then when the user answers check if the answer is in the world list

static canyon
#

But there's no guarantee the shuffled word is an anagram

#

We're only counting as an anagram when the shuffled word is also a valid word

vale ibex
#

ahhhh right, yea forgot anagrams need to be valid words lol

short snow
#

is there a list of all dictionary words?

static canyon
static canyon
short snow
#

you can geenrate anagrams through that then

static canyon
#

But that's gonna take so long to generate them all

short snow
#

cap them at x anagrams

static canyon
#

My vote right now is just shuffle the word and give it whether it's valid or not

#

So bta --> bat counts

#

And you'd probably want it to be at least x chars

#

the more chars, the more potentially words

celest charm
#

I think you could make some clever algorithm with a trie so that the decision tree is smaller

static canyon
#

I think the start word should be like at least 5 and end word at least 3

#

So like great --> eat tea gear ear gate etc.

#

It's better to just have it allow any amount really

vale ibex
static canyon
#

By definition it needs to be all letters but then by definition it also has to be a valid start word

static canyon
#

Like it doesn't have santa and satan

patent pivot
vale ibex
#

Does it need to have all of them?

static canyon
vale ibex
#

just a bunch of known words that have valid anagrams, then use an english dict to check answers

static canyon
#

I might make a script later for generating anagrams and just see what happens

sour viper
#

Do let me know about it @static canyon I'd love to watch your approach on this

static canyon
#

๐Ÿ‘

#

Will do

#

It'll be a few hours/possibly tomorrow

#

!remind 8h do this if you haven't already

stable mountainBOT
#
I'll allow it.

Your reminder will arrive on <t:1631470305:F>!

patent pivot
#

ebic

#

I'm going to add more documents at some point, stuff like the list of components in our monitoring stack and how they are configured (an overview of my SD genius)

short snow
patent pivot
#

โœจ

#

for sure yeah, that'd be dope

short snow
#

Would love to get some reviews on bot#1634 bot#1446 sir-lancebot#745

short snow
#

@clever wraith on smart-resources PR, I am up to date with the branch

stable mountainBOT
#
You're the boss!

Your reminder will arrive on <t:1631473322:F>!

short snow
#

๐Ÿ™‡โ€โ™‚๏ธ

#

and this

#

one more, the tools page on the menu dropdown

#

and on no selection, shouldn't it just show all of the resources?

#

do it

#

oh i get it, he has your commits, but his commits overwrite yours

#

i think

#

cuz i see your commits in that

#

oh nvm

#

only some are there

cold island
stable mountainBOT
#
You got it!

Your reminder will arrive on <t:1631462969:F>!

short snow
#

good zebra ๐Ÿช

molten perch
#

Hey, could someone take a look at, api#16 ? ๐Ÿ˜„

dim pelican
#

Hey all, any tips for getting a markdown file to preview correctly?

#

This is for sir-lancebot#859

dusky shoreBOT
molten perch
stable mountainBOT
#

Hey @lone lava!

It looks like you tried to attach file type(s) that we do not allow (.md). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a.

Feel free to ask in #community-meta if you think this is a mistake.

lone lava
#

oops i wanted to see how a rendered file looks like

short snow
#

brad some of the wtf example don't follow that regex so just cross check over each of those once, according to my testing which was done about 5-6 months back:
16, 25, 26, 40, 43, 55 don't follow that order

molten perch
#

Oh, okay. I see.

dim pelican
dim pelican
molten perch
#

I'm not an async expert, but using open by itself, is a blocking call, isn't it?

#

(I just took a quick look at your PR)

brazen charm
#

Usually not blocking for long enough to be a worry

dim pelican
#

Hmmm...it likely is. But I was having trouble looking for an example or docs for a temp creation and attachment of a file in discord.py. The open call is the way I know how to create a file

molten perch
#

I'd prefer to use StringIO instead, though. It's a file like object, you can use it with discord.File.

#

But I might be very well wrong.

short snow
#

Not sure if that's something to be worried about but we could always use aiofiles

dim pelican
#

Time to do some more research

molten perch
#

I tried out using StringIO with Discord, it worked just fine.

dim pelican
#

Yeah that looks like it would be a straight oneliner lol

dim pelican
# short snow brad some of the wtf example don't follow that regex so just cross check over ea...

These are the ones giving me trouble:
-How not to use is operator: Doesn't work for .wtf is, but does work for operator
-+= is faster: Doesn't work for .wtf +=, but does for faster or --

Just so I'm on the same page with you:
16: โ–ถ๏ธ is not ... is not is (not ...)
25: โ–ถ not knot!
26: โ–ถ Half triple-quoted strings
40: โ–ถ Deleting a list item while iterating
43: โ–ถ Beware of default mutable arguments!
55: โ–ถ goto, but why?

short snow
#

I only had the serial number of them stored, so can't really tell but you can jsut quickly make the bot send all and speed run over each to verify them (starting and end)

green oriole
#

Alright, the 2.0a0 PR has been updated to correct mod-log and silence

static canyon
#

That has 869 words, all at least 3 chars

#

By no means all words but I believe it's a filtered down top 1k words

short snow
dim pelican
#

Having issues with this working for both .txt and .md files

molten perch
#

Indeed it does. ๐Ÿ™‚ That's why I mentioned it as one of the possible solutions, but I don't think it's worth to add a new dependency for such a small thing like that.

sour viper
#

@static canyon can you wait for like half an hour if you are still available
I think an easy way would be just to sort the words as per letters
And just find the same words with same letters and we have our anagrams

static canyon
#
import json
from itertools import permutations

with open("words.txt") as f:
    words = set(json.load(f))

amount_words = len(words)

anagrams = {}

done = {}

# words = ['santa', 'satan']

for index, word in enumerate(sorted(list(words))):
    print(f"{index+1}/{amount_words} ({word})")

    if word in done:
        print(f"{word} has already been done as part of {done[word]}")
        break

    for permutation in set(permutations(word)):
        permutation = "".join(permutation)
        # print(permutation)

        if permutation == word:
            continue

        if permutation in words:
            print(f"Anagram for {word}: {permutation}")
            if word not in anagrams:
                anagrams[word] = []
            done[permutation] = word
            anagrams[word].append(permutation)

    print()
```this is what I have right now
#

I'm just letting it run

sour viper
#

Huh that's neat

static canyon
#

I guess what you're suggesting would be```py

anagrams = {}
for word in words:
if (sorted_letters := ''.join(sorted(word))) not in anagrams:
anagrams[sorted_letters] = []

anagrams[sorted_letters].append(word)
#

Which is definitely way better complexity lol

sour viper
#

I don't know if mine would be faster ? Would it ?

static canyon
#

Then the anagrams are just things where the len(anagrams[sorted_letters]) > 1

sour viper
#

Yes right

static canyon
#

So yeah, I guess that's a smarter approach

sour viper
#

Which file are you running this on ?

#

The smaller one or the larger one ?

static canyon
#

larger

sour viper
#

Sure, let me know when it's done, interested to see how much time it takes

static canyon
#

Without any print statements

#

The part that lags is printing the dictionary xD

sour viper
#

Woaw

short snow
#

super computer

static canyon
#
>>> len(anagrams_builder)
326648
>>> len(actual_anagrams)
30022```
#

Out of 326k words, 30k of them are anagrams

#

Assuming the code works

static canyon
#

ah slight issue

#

So I might've tried to print over 350k items, each on their own line

sour viper
#

Ctrl + C

static canyon
#

It's not responsive lol

#

Just gotta wait for it to crash

sour viper
#

Call the big bois

#

C + A + D

static canyon
#

That doesn't work either lol

sour viper
#

Call the biggest boi
Off switch

Don't just kidding

static canyon
#

lol

#

Can my laptop survive this?

#

That would be a no

#

rofl

#

Attempt #3

#

ehh nope lol