#dev-contrib

1 messages ยท Page 12 of 1

midnight jasper
#

what shld i name the forked repo

static canyon
midnight jasper
#

i feel like bot is too ambiguous but i want it to still obviously be a pydis bot repo

midnight jasper
static canyon
midnight jasper
# static canyon ^

kk. One last thing. where is the error handler in the pydis bot? does it use a global handler?

austere hornet
#

!src error_handler

stable mountainBOT
#
Bad argument

Unable to convert 'error_handler' to valid command, tag, or Cog.

stable mountainBOT
#
Cog: ErrorHandler

Handles errors emitted from commands.

Source Code
static canyon
#

There's a couple other ones too, but that's the main one

midnight jasper
midnight jasper
#

ah

#

wait a minute. couldnt someone just clone it and use it for their bot?

#

@static canyon

static canyon
#

If you setup all the necessary config, sure

#

But the bot is heavily tied to this server's structure, so that's not a very feasible thing to do

midnight jasper
#

Wouldnt i need to do that so that I could test what ive made before i make a PR?

static canyon
#

Yeah

#

Well

#

Depends on the feature

#

For something like the issue you want to do you don't need the server structure

#

But there should be a server template somewhere you can use anyway

midnight jasper
#

ye but if i try running those server structure commands, wouldnt i get an error?

midnight jasper
#

its a template of this server?

static canyon
#

Make sure to do the configuration too -- which is also detailed on that page

midnight jasper
#

I totally forgot, what did u contribute to to get it?

static canyon
#

#roles gives the formal explanation, but it's basically continued contributions

midnight jasper
#

ah cool. did u contribute to pydis or lancebot

static canyon
#

Both

#

& bot-core & site

midnight jasper
static canyon
#

python-discord/bot-core#1

dusky shoreBOT
static canyon
#

It's basically a repo for utils across all the bots

midnight jasper
static canyon
static canyon
midnight jasper
#

hm i c

#

well tysm!

timid sentinel
#

Oh, just noticed the bot repo hit 1k stars, nice!

vale ibex
#

@timid sentinel @clever wraith bot-core 9.4.0 is what added the auto-syncing of commands, it's in sir-lance's main branch but the PR will need to rebase onto main to pull that in

clever wraith
#

Yeah, it works on my machine because I had installed the beta you released back then

#

Alright, rebased

#

I need to merge it, then I'll push the changes

#

Done ! ๐Ÿ˜„

#

@timid sentinel How does this look ?

#

But I'm not sure what to do about that "Sending command" message that hangs there :/

timid sentinel
clever wraith
fossil veldt
#

Need one more review and the eval file system should be ready to merge, if anyone has time :3 bot#2326

dusky shoreBOT
midnight jasper
#

Holy there is so much setup

#

๐Ÿ˜ญ

clever wraith
#

Not all of it is needed though

#

Setup what you need first

#

Then gradually add all the rest

static canyon
midnight jasper
static canyon
#

That's a good thing lol

midnight jasper
#

but i just wanna code ๐Ÿ˜ฆ

#

Idk how ppl enjoy doing front end

#

Its painful

#

having to make the user like it

#

Its more fun to make the features

#

ik its unrelated but idk

static canyon
#

For what you're working on, you shouldn't even need most of the config stuff

#

Just set the admin role and give yourself it and you're good to go

#

Some cogs will fail but you only need the bookmark one

sharp crag
midnight jasper
#

Is there a time I have to finish it by.

static canyon
#

We're all volunteers so there's no timeline

#

If it's taking months then we might ask for an update etc. but generally no timeline to worry about

midnight jasper
timid sentinel
#

@vale ibex thanks for merging that PR, netlify checks were just ignoring me lemon_angrysad

vale ibex
#

I need to go make dinner now, if you wanted to play whack a mole with the green button on these PRs

timid sentinel
#

Two left, I think they'll need a devopser to merge

vale ibex
#

hitting github api ratelimits now :P

#

all merged down

vale ibex
#

site#847 is another dependency pr

dusky shoreBOT
dim pelican
#

Hi, please don't post unapproved advertising.

clever wraith
#

Ok

dim pelican
#

Are resources added to the site repo?

#

We don't have the python org's tutorial linked in the resources

#
#

Nevermind, found it! site#852

dusky shoreBOT
vale ibex
#

@timid sentinel I'm thinking of closing site#839 so that dependabot re-opens when a version with the change is released

dusky shoreBOT
timid ember
#

Hello. As I posted yesterday I'm a self taught developer who wants to contribute to open source development. I'd be happy to help with anything anyone needs. ๐Ÿ™‚

sharp crag
timid ember
sharp crag
timid ember
#

Great I'll start with Sir Lancebot first to build experience and confidence.

sharp crag
#

So, unrelated but - should be perhaps test how well slash commands could work for our community by migrating !tags to a slash command?

#

I think it'd be a great candidate if we use autocomplete

outer oasis
#

We'd have to rethink how we do tags

sharp crag
#

Not sure what you mean by that

#

A lot of the logic will remain the same

#

(All the part where you actually fetch the tag from the database / wherever, for instance)

outer oasis
#

The parsing in the error handler

sharp crag
#

There will be no need for an error handler

#

Discord will force you to pick only a valid tag

#

Only the "frontend", as it were, would really need changing

#

We should be able to just hook into existing functions so the test suite won't be disrupted

outer oasis
sharp crag
#

i think it'd be great as a test run to see how people react to it

#

we are falling a bit behind tbh

static canyon
# sharp crag There will be no need for an error handler

The current implementation doesn't have registered commands for the tags, there's just handling in an on_command_error so when you invoke an unknown command, it'll do a tag lookup.

My understanding is that with slash commands you have to have everything as a preregistered command, which means rewriting that logic

stable mountainBOT
#

bot/exts/backend/error_handler.py lines 66 to 71

if isinstance(e, errors.CommandNotFound) and not getattr(ctx, "invoked_from_error_handler", False):
    if await self.try_silence(ctx):
        return
    if await self.try_run_eval(ctx):
        return
    await self.try_get_tag(ctx)  # Try to look for a tag with the command's name```
cold island
#

It's also a command

#

!help tags

stable mountainBOT
#
Command Help

!tags [tag_group] [tag_name]
Can also use: t, tag

Show all known tags, a single tag, or run a subcommand.

Subcommands:

!tags get [tag_group] [tag_name]
If a single argument matching a group name is given, list all accessible tags from that group
!tags search <keywords>
Search inside tags' contents for tags. Allow searching for multiple keywords separated by comma.

cold island
#

But wasn't there something else we started doing already?

static canyon
# cold island It's also a command

Right, but if you made !tags a command (with the current implementation) you wouldn't get auto-complete and wouldn't be able to do /f-strings etc.

#

Shouldn't be too difficult to update though I guess, cause all the tags are stored in the tag cog

cold island
#

Oh you mean like that

#

No, like that it wouldn't work

#

But that part can remain the same

#

It can also be a hybrid command

sharp crag
sharp crag
#

I thought we just had regular commands for tags

#

(Why don't we, btw?)

#

Parsing tags in the error handler seems strange

outer oasis
outer oasis
sharp crag
sharp crag
#

Just as dynamic

outer oasis
#

Someone has to make each one

sharp crag
#

Nah

#

We need one common callback for all the tags

outer oasis
#

It'd just be a giant series of duplicate commands changing nothing but the file name

sharp crag
#

!d discord.ext.commands.Bot.add_command

stable mountainBOT
#

add_command(command, /)```
Adds a [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") into the internal list of commands.

This is usually not called, instead the [`command()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin.command "discord.ext.commands.GroupMixin.command") or [`group()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin.group "discord.ext.commands.GroupMixin.group") shortcut decorators are used instead.

Changed in version 1.4: Raise [`CommandRegistrationError`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CommandRegistrationError "discord.ext.commands.CommandRegistrationError") instead of generic [`ClientException`](https://discordpy.readthedocs.io/en/latest/api.html#discord.ClientException "discord.ClientException")

Changed in version 2.0: `command` parameter is now positional-only.
outer oasis
sharp crag
#

Yeah just for loop over each tag

#

.add_command it

#

Easy as that

#

The parsing will then be done in the callback which we pass into add_command

#

Feels more idiomatic

vale ibex
#

so if a command isn't found, but a tag with a close name is, the tag is output

#

with a slash command, we could have /tag <tag_name> and fuzzy match the suggestion/autocomplete

sharp crag
final geode
#

Sir Lancebot's minesweeper is broken. In dms it says I should use command in #sir-lancebot-playground, in the channel it says I'm not allowed to do it. I played its minesweeper a few months ago without problem

#

Oh, I scrolled and it was more than "a few months" when I last played. It was in August 2021... So something between now and then broke the command.

cold island
cold island
# final geode Sir Lancebot's minesweeper is broken. In dms it says I should use command in <#6...

hey, thanks for bringing it up ๐Ÿ™‚ I think it's the same issue as in https://github.com/python-discord/sir-lancebot/issues/1003

GitHub

Description PR #953 explicitly blocked all commands which run in DMs, but minesweeper was missed in testing. Minesweeper commands only work in DMs, which makes the game unplayable. Steps to Reprodu...

sharp crag
final geode
slim widget
vale ibex
#

Bot seems to have been getting a bunch of 503's from discord around that time

#

very likely related

sharp crag
cold island
#

I forgot, how do I re-run only the tests that failed?

outer oasis
stable mountainBOT
#

pyproject.toml lines 72 to 73

test = "pytest -n auto --cov-report= --cov --ff"
retest = "pytest -n auto --cov-report= --cov --lf"```
cold island
#

looks like it ๐Ÿ‘

vale ibex
#

--ff runs the failed test from alst run first

#

--lf is only the ones that failed last run

cold island
#

if you can't that's fine just let me know ๐Ÿ˜„

sharp crag
cold island
#

Is there a way to run site tests inside the container? running poetry run task test gives me Command not found: task

#

I guess it's because the Dockerfile does --without dev

#

yeah that was it

clever wraith
#

@sharp crag Can I ask you to review sir-lancebot#1176 ? :B
There were some comments brought up by wookie, especially the one where the first invocation of the command hangs
Would you happen to have an idea on why that might happen ?

Thank you ! ๐Ÿ˜„

dusky shoreBOT
cold island
#

doesn't work for some reason... I swear it worked when I tested it ๐Ÿ˜…

clever wraith
#

Strange

#

It's working for me

cold island
#

hmm I'll try restarting

#

works now, weird...

sharp crag
#

Yeah seems to be working for me now too

#

Is there still something that needs to be fixed or can we just leave it?

#

!e

class MyClass:
    var: int
    def __init__(self, var: int) -> None:
        self.var = var

cls1 = MyClass(10)
cls2 = MyClass(20)

print(f"{cls1.var}")
print(f"{cls2.var}")
stable mountainBOT
#

@sharp crag :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | 10
002 | 20
sharp crag
#

This seems to be expected hehaviour

cold island
#

hmmm

sharp crag
#

Doesn't look like any state is being mutated across instances

cold island
#

very weird

#

also TIL, it works different from how I remember

#

I remembered self.var would just refer to the class attr

sharp crag
#

As opposed to the newly-set instance attribute?

cold island
#

!e

class A:
    a = 0
a = A()
print(a.a)
A.a = 1
print(a.a)
stable mountainBOT
#

@cold island :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | 0
002 | 1
cold island
#

But apparently setting a.a will make it stop using A's value

sharp crag
#

That is expected, isn't it?

cold island
#

didn't remember the last part

sharp crag
#

The latter set variable would overwrite the previous one

cold island
#

yes, but it won't be a class attribute anymore

#

apparently..

sharp crag
#

Ahh

#

It just becomes an instance attribute?

cold island
#

I guess....?

sharp crag
#

Sort of weird behaviour if you ask me

#

Though this behaviour still seems to be constrained within the instance itself
I don't believe it should affect other instances

cold island
#

yeah

#

so I'm not sure what's the issue with the view

sharp crag
#

It seems to work and stop working intermittently

#

Do you have access to logs?

#

well now it just out and out failed lol

#

(tried removing lovefest role btw)

cold island
sharp crag
#

ah yeah

#

i had it open for a while

#

Worth doing something about that?

cold island
#

that's fine, it's set to expire after a few minutes

sharp crag
#

Looks to be working fine again
I suppose just leave it be and keep a close eye on logs

#

Not sure what the deal is there

cold island
#

I don't see any logs in the code that would be useful here

sharp crag
#

Should we PR some in? Just to debug the issue

cold island
#

hmm let's try something, sec

#

@sharp crag try pressing the button now

sharp crag
#

let me try

#

Working as expected

#

What did you change?

cold island
sharp crag
#

Works like a charm. Added and removed all 3 roles once

cold island
#

huh ok

#

So it's not what I thought it was

#

then I have no idea lol

sharp crag
#

Seems to be working fine now
Wish I could repro it again

cold island
#

alright, let's just leave it at that for now

sharp crag
#

I don't even know if it's still a problem, might have just resolved it after a restart

#

With that being said.. if anyone comes across that bug do let us know :P

timid sentinel
#

Wait so what was the issue that was happening?

cold island
tawdry vapor
cold island
#

I might be able to later this week, although I don't know much about snekbox's API

tawdry vapor
#

Thanks. I do not think this will require much knowledge of the API as this is mostly focused on the "front end", but certainly feel free to ask if you need context on the API changes.

pine bane
#

hallo, can i ask something about python project or we have other room discussion? Sorry i newbie in here

clever wraith
clever wraith
#

Does bot not have access to messages in closed posts ?

It's either that, or I'm doing something wrong in my bookmark command here
#sir-lancebot-playground message

gritty wind
#

This is more of an issue for the d.py library not really our bots, since we just use a very thin wrapper

#

!docs discord.ext.commands.MessageConverter

stable mountainBOT
#

class discord.ext.commands.MessageConverter(*args, **kwargs)```
Converts to a [`discord.Message`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Message "discord.Message").

New in version 1.1.

The lookup strategy is as follows (in order)...
clever wraith
#

I wonder if there's a workaround, it's a shame to not be able to do this

#

I'll have a look

vale ibex
#

We could use a partial message converter instead, so if the message isn't in the cache we still send the bookmark, just without the message text

clever wraith
bleak temple
#

Is anyone implementing bot#2360, or can I start making it?

dusky shoreBOT
clever wraith
clever wraith
#

Already done

shrewd basalt
#

!d csv.DictWriter

stable mountainBOT
#

class csv.DictWriter(f, fieldnames, restval='', extrasaction='raise', dialect='excel', *args, **kwds)```
shrewd basalt
#

is this a bug?

#

feels like it should manage to get the summary text as well

brazen charm
#

The first paragraph is too long, and it only splits at tags that are directly under the description's tag

shrewd basalt
#

maybe it should truncate

outer oasis
#

plus1 for truncation

brazen charm
#

it was remade from simple truncation because it butchered the Markdown at the end, but it falls short in these cases

hoary haven
#

the new #roles button is super nice!

clever wraith
hoary haven
#

yup works great

clever wraith
#

Because we've had some issues the first time as we rolled it out

#

But now it seems to be fine

sharp crag
#

But if it ain't broke don't fix it

shrewd basalt
stable mountainBOT
#

bot/exts/info/doc/_parsing.py line 159

if rendered_length + element_length < max_length:```
brazen charm
#

I think the text attribute is without any markup, so it's for the length of the text that'd actually be shown to the user

shrewd basalt
#

if so won't applying the markup violate the length constraint then?

#

or is the limit lax enough that you have a bunch of margin?

brazen charm
#

it will intentionally violate the length constraint as it's just for the text the user sees and there technically could be a lot of markdown, but it also does a hard truncation if it wouldn't fit into the embed (like it did above, with only basic checks for markdown)

shrewd basalt
#

is this hard truncation also susceptible to break markdown?

#

I assume yes, otherwise just doing the hard truncation would work

brazen charm
#

I think it tries something basic to not be too horrible if it has to use it, but yes. IIRC the intention behind breaking at the tags was also to keep the context instead of cutting off at the start of some sentence etc.

#

Though if it cuts off the whole thing then it's not really better. I briefly looked into recursing into the tags but then there are tags for random formatting that aren't particularly relevant and probably didn't have much time at the time so it didn't go anywhere

clever wraith
sharp crag
#

Huh. Color me confused then

clever wraith
#

Same! :B

bleak temple
#

Anyone available to look over bot#2388

dusky shoreBOT
sharp crag
#

Hey @clever wraith !
@midnight jasper actually brought up a decent point here: <#python-discussion message>
Is there a reason that I'm not aware of why we didn't go with select menus over buttons?
(I'm not asking we change it right now, but just curious)

Thanks!

midnight jasper
clever wraith
clever wraith
stable mountainBOT
#
I'll allow it.

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

stable mountainBOT
vale ibex
#

If it does, seems fine to me as a suggestion, I'd like to see a demo though

#

This channel is for Python Discord project discussions. If you need help you can ask in #1035199133436354600

late birch
#

no i mean i need a teammate

#

i want a contributor

vale ibex
#

We don't allow recruitment on this server

late birch
#

Ok

midnight jasper
#

@vale ibex Yo, what is devops?

sharp crag
outer oasis
#

join us!!

sharp crag
#

Our devoops people are the ones responsible for actually keeping things running

outer oasis
#

Embrace the devoops!!

sharp crag
#

Scary ๐Ÿ˜จ

#

Me personally I just write the code

outer oasis
outer oasis
#

Oh, sorry, ๐Ÿค

sharp crag
#

Everything

midnight jasper
#

Like what does the devops in this server do.

#

Pydis bot?

sharp crag
#

They manage our k8s stack

midnight jasper
sharp crag
#

Kubernetes

sharp crag
outer oasis
# midnight jasper Pydis bot?

Maintains the hosting and the deployments for the bots yeah, but also the databases and the reporting services and the website and other assorted stuff

sharp crag
#

It's all connected and runs smoothly thanks to devops

midnight jasper
sharp crag
#

Nah

midnight jasper
#

Or is that transferring to the .md

sharp crag
#

Im responsible for making common tags in @stable mountain now

#

The main chunk of the project is done

midnight jasper
#

then u will return back to a regular helper ๐Ÿ˜ญ

sharp crag
#

I am looking for a few hands on that part, let me know if you're interested ๐Ÿ™‚

midnight jasper
sharp crag
#

Thanks! Let me put together some info and put out an official call for volunteers here

midnight jasper
sharp crag
#

Let's make an issue first

midnight jasper
#

And then I got a preview for him?

sharp crag
#

I'd hate to walk all over Bellaluma's work like that unless the replacement has those details mentioned

sharp crag
#

Do make an issue first for discussions

#

If it's approved I or another staff member will assign you

midnight jasper
bleak temple
#

@odd hill Updated the PR according to your review, and added some details. Whenever you are free you can review it again.

cold island
#

Well that's annoying, I added this line just for safety but now test coverage complains there are no cases where it's False

#

So coverage encourages me to write worse code ๐Ÿ™ƒ

clever wraith
#

When contributing to @dusky shore, are you allowed to use UI's like buttons?

clever wraith
#

Like the bookmark command

clever wraith
clever wraith
bleak temple
#

Anyone else have input on bot#2388

dusky shoreBOT
plush birch
#

Seems a bit lengthy to me

bleak temple
vocal prairie
#

example: #bot-commands message

#

i don't think it's horribly long, but it could definitely cover a screen

bleak temple
#

On mobile you have to scroll a little bit, which may be a problem

vocal prairie
#

yeah, it wouldn't be nice if it floods the chat

#

perhaps collapsing the code blocks into one might do some good? not sure how much that'd hurt understandability.

bleak temple
#

I'll shrink it as much as I can without taking vital parts out, once im home

stable mountainBOT
#
Absolutely!

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

cold island
#

There's quite a bit of rewording that can be done here

#

The information looks good, but there are sentences which don't help relay it and can be removed

stable mountainBOT
#

@bleak temple

It has arrived!

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

bleak temple
still comet
#

This might make the tag a bit too long, but a codeblock like this showing how to correctly use them could also help:

# Correct:

# Using in-place `list.sort()`
list_to_sort = [3, 1, 2]
list_to_sort.sort()
print(list_to_sort)

# Using out-of-place `sorted()`
unsorted_list = [3, 1, 2]
sorted_list = sorted(unsorted_list)
print(sorted_list)
cold island
stable mountainBOT
#

pydis_site/apps/api/viewsets/bot/role.py lines 18 to 26

>>> [
...     {
...         'id': 267628507062992896,
...         'name': "Admins",
...         'colour': 1337,
...         'permissions': 8,
...         'position': 1
...     }
... ]```
timid sentinel
#

json.dumps(obj, indent=4)?

cold island
#

I guess I could print it and then paste it back and copy

gritty wind
#

That's just formatting supported by DRF

#

It doesn't really have an automatic tool afaik

#

Your IDE may be able to automatically add them for you, otherwise you could probably just do it with multi-cursor

cold island
#

hrmph, okay

#

I might just.. create a script for this....

timid sentinel
#
def fmt(obj):
    print(">>>" + "\n".join("... "+l for l in json.dumps(obj, indent=4).split("\n"))[3:])

one step ahead ๐Ÿ˜Ž

cold island
#

lol ty

#

I wanted to take it one step above though and replace subsequent list elements with ...

timid sentinel
#

ah lol

cold island
#
def fmt_lists(obj):
    if isinstance(obj, list):
        if len(obj) > 1:
            return [fmt_lists(obj[0]), "replaceme"]
        elif len(obj) == 1:
          return [fmt_lists(obj[0])]
        return []
    if isinstance(obj, dict):
        new_dict = {}
        for key, value in obj.items():
            new_dict[key] = fmt_lists(value)
        return new_dict
    return obj

def fmt(obj):
    print(">>>" + "\n".join("... "+l for l in json.dumps(fmt_lists(obj), indent=4).replace('"replaceme"', "...").split("\n"))[3:])

Something like this I guess

cold island
#

some good website to draw a database scheme?

gritty wind
#

Dbdiagram has served me reasonably well

#

I like it since itโ€™s declarative

outer oasis
# cold island some good website to draw a database scheme?

Are you asking for one?
I'm partial to PyCharm. The database features in the pro version includes a visual generator, which fills out all the details automatically, and can export into various formats, including Mermaid, which GitHub markup supports directly

outer oasis
gritty wind
#

A lot like mermaid now that you mention it

#

Table A {
โ€ฆ
}

Ref A > B
โ€ฆ

#

Then it renders it for you

outer oasis
#

icic

clever wraith
#

@cold island
Big ouf!

#

Kudos for the work already, I'll need to sit-down for this one ahahah

clever wraith
#

Can we have some sort of a "fallback converter" to discord messages ?

#

Meaning, we first try to resolve a message by using a MessageConverter, and if that fails, we try with a PartialMessageConverter

cold island
clever wraith
#

I tried that, but it didn't work

#

I was still getting None

cold island
#

Then that means the partial converter failed as well

clever wraith
#

Whereas when I used the partial one by itself, I got an instance of PartialMessage

#

Ahaha, nope

cold island
#

What

clever wraith
#

AH, WAIT

#

I think i know what happened

#

Let me verify

#

Ok so the issue was that I had used it on 2 different threads

#

by mistake

#

An old one, which isn't in cache anymore --> That's normal

#

And a new one, that's cached

#

Which is why I got contradicting results

#

That's a shame

#

Because sir lance doesn't bm messages in old threads, which aren't cached

#

We thought that a PartialMEssage covnerter would solve it

#

But, apparently not

#

So we either keep it the way it is (e.g. not possible), or we fetch that message, but that's an API call so idk if we want to do that

cold island
clever wraith
#

Alrighty then, I'll file a PR for it

timid sentinel
#

doesn't MessageConverter already fetch the message if necessary?

clever wraith
#

But if that fails (like what's happening in my case), it'll throw

#

So it won't reach the code that fetches the message

timid sentinel
#

Hmm, it seems like a fair argument that discord.py should change MessageConverter to try and fetch the channel if it wasn't found.

clever wraith
#

True

stable mountainBOT
#
No problem.

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

clever wraith
#

Done, let's see if Danny approves it

stable mountainBOT
tawdry vapor
#

I'm having a problem with the GitHub website on Firefox. Hovering over links to issues or account pictures shows a box with more information, but that box gets "stuck" as being shown for a while after I stop hovering over it. Is anyone else experiencing this issue?

timid sentinel
#

Yep

tawdry vapor
#

Thanks. Tried searching for it but I found it difficult to phrase, so I came up short.

bleak temple
#

@vocal prairie Resolved all your requested changes feel free to rereview the PR (bot#2388)

dusky shoreBOT
fossil veldt
dusky shoreBOT
fossil veldt
#

feel free to ping me for questions on getting it running correctly

thorny obsidian
midnight jasper
#

Hellooo. Well, I was conversating with the rust addict ||Robin|| and we both agree that even though migrating to app_commands isn't a big priority, migrating to them for tags is beneficial. Right now I can lay out one ground point: When referencing tags, it is easy to forget what the tag is called, even if you know just two letters. The autocomplete can refresh your memory, and that will help us help others more easily.

#

Another point which is helpful to be considered is helping members learn new things! With autocomplete, the will see many new tags they haven't seen before. In bot commands, they can try them out, and learn and research the new things they learn. I know that just that feature alone would have a real impact on the learning of others here.

sharp crag
#

I get what you're saying - but I think by "helping members learn you things" you probably mean more "increasing discover-ability of tags"

#

Currently users would have to go into #bot-commands , and type in !help tags or whatever the command is (even I don't remember the exact command, lol)
Even before that, they'd have to !help first and realize that we even have a tags command.
I think a /tags and then being able to see all the tags we have and fuzzy filtering as you type would be pretty helpful

midnight jasper
#

I mean aren't they synonimous?

sharp crag
#

Depends on how one looks at it

midnight jasper
#

It helps people find new tags to learn new things. I think it would be rlly helpful to migrate that command.

midnight jasper
sharp crag
#

!help tags

#

!tags

stable mountainBOT
#
Available tags

ยป pathlib
ยป pep8
ยป positional-keyword
ยป precedence
ยป print-return
ยป quotes
ยป range-len
ยป regex
ยป relative-path
ยป repl
ยป return
ยป return-gif
ยป return-jif
ยป round
ยป scope

midnight jasper
#

it gave me interaction failed

#

!tags help

sharp crag
#

I mean, this only shows 14 at a time and you'd have to use the clunky reaction pagination

sharp crag
midnight jasper
#

mhm

bleak temple
#

Is there anyone who can review / merge bot#2388

dusky shoreBOT
vale ibex
jolly parcel
#

are there any things pending with snekbox that need help? i was interested in helping implement File IO but I never got around to that and it seems like Ionite has that covered.

midnight jasper
vale ibex
#

It's the usual process of create an issue with the proposal, get it approved and then start working on it

#

Not sure if the issue has been made already though

jolly parcel
#

python-discord/bot#2362

dusky shoreBOT
vale ibex
#

I'd recommend keeping the scope much smaller. We wouldn't want to review a 8k line review to migrate all commands to slash commands.

jolly parcel
#

Fair

vale ibex
#

So if someone wants to work on moving something to slash commands, make a specific issue that proposes an implementation, and we can discuss it until we're at a point that a suitable implementation is found, then someone can start working on it.

jolly parcel
cold island
vale ibex
#

lol

cold island
outer oasis
sharp crag
dusky shoreBOT
vale ibex
#

I'd say we can just close that issue

#

it's not something we need to track in any way

vale ibex
#

We're not migrating all commands to slash commands

#

so each change can be dealt with as individual enhancements

outer oasis
#

Ah, I see, makes sense

sharp crag
#

Sad life

sharp crag
outer oasis
#

I helped

#

What does that say about me?

sharp crag
#

Both of us live sad lives

outer oasis
#

Oh wait

#

That was @humble leaf
I read "Robin" and assumed @sharp crag

#

Hey that brain I ordered you -- Give it back

sharp crag
#

No takebacksies birdhyper

outer oasis
midnight jasper
#

Do I need to layout my issue any way? @sharp crag

sharp crag
#

I don't believe we have a standard issue template

midnight jasper
sharp crag
#

Sounds alright

midnight jasper
sharp crag
#

Not sure on that

bleak temple
#

Anyone available to review / merge bot#2388 pithink

dusky shoreBOT
outer oasis
#

Any fancy developers want to merge a one line typo that's already got it's approvals?
sir-lancebot#1202

dusky shoreBOT
timid sentinel
#

I am a fancy developer

#

Earth

#

Heart

#

Yay

fossil veldt
# jolly parcel also, would you have an answer for this?

Yeah just waiting on some help in reviewing bot#2326, (the snekbox side PR is already ready for merge). You can ping me if you need info on getting snekbox built to test it with bot. (the actual diff is not as scary as it looks, mostly just moving snekbox.py to a submodule folder along with the new component files)

Essentially you need to use the snekbox from this branch https://github.com/python-discord/snekbox/tree/bytes-output

If you have both repos in one root folder, you can just make this change in bot/docker-compose.yml to use the local snekbox

repos
  |- snekbox
  |- bot
  snekbox-311:
    << : *logging
    << : *restart_policy
-   image: ghcr.io/python-discord/snekbox:3.11-dev
+   build:
+     context: ../snekbox
+     dockerfile: Dockerfile

Then if you run bot it should just work. You can write / read files in !eval, or save files in the output folder for the bot to upload it back.

clever wraith
#

Monsieur @vale ibex, your comments for bot#2323 have been addressed ๐Ÿ˜„

And @sharp crag, sir-lancebot#1176 is still waiting for you.

Wookie & I have had noticed that the command hangs the first time and you can see it hang while displaying "Sending command", but I don't reproduce anymore

clever wraith
#

Thanks !

potent garden
#

I'd appreciate some help in #1071806229623623852 from y'all who have been coding on @stable mountain (since the part i need help with is similar to a solution implemented in python's src code)

jolly parcel
#

Also I had another idea

#

I was thinking about the ability to run python code in different python implementations (CPython, PyPy, etc). But that does sound like something that would be a bit complicated to implement.

fossil veldt
#

currently we call python3, could be anything else

jolly parcel
#

ah ok

#

perhaps through the eval command it could be controlled through an impl arg (defaults to python3 of course)

#

like !e impl=IMPL

trim cradle
#

@hybrid pumice what are you trying to test?

hybrid pumice
#

bot autoclose message

trim cradle
hybrid pumice
#

there was a report that it wasn't being sent.

slim widget
#

@tired wolf How does this relate to the channel topic?

trim cradle
#

Hmm okay

slim widget
tired wolf
#

oh i thought it was for Contributing in general

#

where to post collab requests?

jolly parcel
fossil veldt
#

will have to see what mark and devops think though

jolly parcel
#

ye

jolly parcel
dusky shoreBOT
fossil veldt
#

we could just install pyenv on the nsjail container or something, and then send different commands for versions

#

currently we run 2 entire snekbox servers for 3.10 / 3.11

#

seems inefficient

jolly parcel
#

does pyenv support other implementations?

#

or was that just a general suggestion for an improvement

#

seems like that could be part of python-discord/snekbox#158

dusky shoreBOT
sharp crag
#

WindowsWarning LOOKING FOR HELP WindowsWarning

The #discord-bots pin migration project's specifications have been updated!
We want tags that primarily go over common pitfalls or gotchas in relation to discord.py bot development.
I'm looking for either hands to help add these tags, or more ideas on what tags we can add.
The tags themselves are quite easy, involving mostly markdown and little technical knowledge of the library.
Feel free to ping me either here or on GitHub if you want to help with anything or have ideas.
Thanks!

still comet
cold island
#

@fossil veldt going over your snekbox bot PR, I'm wondering whether we should allow the output to be a file that users can't normally upload here

#

We filter text using the filtering cog, but that setup doesn't handle files

fossil veldt
#

it looks like we currently disallow text files as well?

#

that might be a common case to demonstrate write / read examples

#

or like zips I guess?

cold island
#

hmm.. this actually creates a pretty interesting issue. Once my rewrite is merged it will filter file outputs from snekbox out of the box. Which is just me assuming that snekbox output will only ever be text

#

So it will have to be addressed in at least one of our PRs

cold island
#

mhm

#

It merges the antimalware cog into the main filtering cog, so sending the snekbox output message to it will cause it to also filter attachments

fossil veldt
#

you could filter only the text extensions that discord will embed probably

#

otherwise it'd be filtering binaries like .png .jpg as well

cold island
#

it won't, since those are whitelisted

#

to be clear, it doesn't filter file contents, it filters file names (the extensions specifically)

#

I guess you're right that demonstrating file writing might be a common use case, but the goal of filtering snekbox output is to prevent users from bypassing our filters through eval (for example assembling the n-word without writing it explicitly). So it's a bit of a head scratcher

fossil veldt
cold island
#

no

#

and it won't do that anytime soon either

fossil veldt
#

we could add the filter to run on the content of text file extensions which discord will embed I think

#

though that might be expensive

cold island
#

Do we get the contents of the file out of snekbox?

#

or is it stored in some way that requires downloading it

fossil veldt
cold island
#

what is the file size limit?

fossil veldt
#

on the bot side there's also a 8MiB per-file limit (which is normally the max a bot can upload), and up to 10 files

#

but we can technically raise it to 50MiB per-file since our server is boosted

cold island
#

I guess I could make an exception for specifically text files coming out of snekbox...

#

But I also don't want my PR to block yours...

cold island
#

Which sends the output to be filtered

#

Currently it doesn't filter attachments because the part that does that is in a separate cog

#

My rewrite merges that extra cog into the main one, so that means that sending the output to be filtered will filter the attachments

#

text files are not whitelisted, so the output will be blocked

fossil veldt
#

oh the filter_cog.filter_snekbox_output(msg, ctx.message)?

cold island
#

yeah

#

sorry, I marked a line but I guess it didn't update the URL

fossil veldt
#

though...

fossil veldt
#

does that still filter the eventual attachments?

cold island
#

well, before this PR, there were no attachments

#

so there was nothing to add

stable mountainBOT
#

bot/exts/utils/snekbox/_cog.py lines 311 to 319

    filter_triggered = await filter_cog.filter_snekbox_output(msg, ctx.message)
if filter_triggered:
    response = await ctx.send("Attempt to circumvent filter detected. Moderator team has been alerted.")
else:
    allowed_mentions = AllowedMentions(everyone=False, roles=False, users=[ctx.author])
    view = self.build_python_version_switcher_view(job.version, ctx, job)

    # Attach files if provided
    files = [f.to_file() for f in result.files]```
fossil veldt
#

I mean like, the files are attached after the filter call, so the ctx.message should have no attachments when the call is made

cold island
#

Then if we decide to filter attachments this would need an update

#

Like a list of file names as another argument

fossil veldt
#

would it be better if it was called during the parsing files stage

#

currently it can show the name of files it failed to upload and such

#

just showing Attempt to circumvent filter detected. Moderator team has been alerted. for a user that tries to upload a example.bin seems a little confusing

cold island
fossil veldt
cold island
#

Not at the moment

#

It could do both

#

As in, DM and also give a reason in the snekbox output

fossil veldt
cold island
#

yes

#

hmm.. snekbox output can't create embeds right?

fossil veldt
#

not currently no

#

well, discord "inline" shows image attachments

#

but it's not a bot embed

cold island
#

that's ok then.. I might need to exempt it as well just in case

fossil veldt
stable mountainBOT
#

bot/exts/utils/snekbox/_cog.py lines 310 to 313

if filter_cog:
    filter_triggered = await filter_cog.filter_snekbox_output(msg, ctx.message)
if filter_triggered:
    response = await ctx.send("Attempt to circumvent filter detected. Moderator team has been alerted.")```
fossil veldt
#

since currently it doesn't seem possible to tell that the filter was triggered due to extensions

cold island
#

I can make it return the blocked extensions

#

If you want to wait until the rewrite is merged, I can make the necessary adjustments on my end. I don't think you'll have to do any changes then. Otherwise you might need to do some work to make it work with the Antimalware cog which I'll have to overwrite anyway

fossil veldt
cold island
#

You could always help review the rewrite to speed things up ๐Ÿ˜‰

fossil veldt
#

I'll have a look yeah

#

I think you went through most of it last time in voice

cold island
#

Were you there?

fossil veldt
#

I joined like halfway through? firT

cold island
#

hm, ok. I went mostly over the site PR. I can do another session focusing on the bot PR

stable mountainBOT
#

bot/exts/filtering/filtering.py line 264

ctx = FilterContext.from_message(Event.MESSAGE, msg).replace(content=snekbox_result)```
fossil veldt
#

where does it check the sender of the eval here, within FilterContext.from_message?

fossil veldt
cold island
fossil veldt
#

so file extension exclusions will still be able to send the eval message without those files + the allowed formats message. And any positive from filter_snekbox_output will still not send the entire message

stable mountainBOT
#

bot/exts/filters/antimalware.py lines 55 to 57

# Ignore webhook and bot messages
if message.webhook_id or message.author.bot:
    return```
fossil veldt
#

the only issue now would be there is no file extension filter for eval output

cold island
#

Bots, staff, specific categories

cold island
fossil veldt
#

it shouldn't be removing snekbox outputs since on_message excludes bots

cold island
#

no yeah, I'm saying that if you want to filter the attachments based on something in the AntiMalware cog, you'll still need to check for staff and categories

#

Generally speaking what you want is actually _get_disallowed_extensions + the validations in on_message

fossil veldt
#

I don't think the other ones really apply for eval

#

there's just the codejam channel override but I don't see why eval restrictions should be different in codejam

#

I currently have this

async def _filter_files(self, ctx: Context, files: list[FileAttachment]) -> FilteredFiles:
    """Filter to restrict files to allowed extensions. Return a named tuple of allowed and blocked files lists."""
    # Check if user is staff, if is, return
    # Since we only care that roles exist to iterate over, check for the attr rather than a User/Member instance
    if hasattr(ctx.author, "roles") and any(role.id in Filter.role_whitelist for role in ctx.author.roles):
        return FilteredFiles(files, [])
    # Ignore code jam channels
    if getattr(ctx.channel, "category", None) and ctx.channel.category.name == JAM_CATEGORY_NAME:
        return FilteredFiles(files, [])

    # Get whitelisted extensions
    whitelist = set(self.bot.filter_list_cache['FILE_FORMAT.True'].keys()) | TXT_LIKE_FILES

    # Filter files into allowed and blocked
    blocked = []
    allowed = []
    for file in files:
        if file.suffix in whitelist:
            allowed.append(file)
        else:
            blocked.append(file)

    if blocked:
        blocked_str = ", ".join(f.suffix for f in blocked)
        log.info(
            f"User '{ctx.author}' ({ctx.author.id}) uploaded blacklisted file(s) in eval: {blocked_str}",
            extra={"attachment_list": [f.path for f in files]}
        )
        
    return FilteredFiles(allowed, blocked)
#

^ as a function on Snekbox(Cog)

#

actually maybe I'll just return a tuple of both allowed and blocked

cold island
fossil veldt
# cold island lgtm

do you know of some way to bypass this if hasattr(ctx.author, "roles") and any(role.id in Filter.role_whitelist for role in ctx.author.roles): for testing purposes

#

oh or I guess I can remove my roles minus superuser

fossil veldt
#

is this too long of a message or

tawdry vapor
#

Yes, I think it is.

#

Let's not include the list of allowed extensions. We can revisit this if users give feedback about wanting that information at hand.

fossil veldt
#

example with both failures due to file size and extensions

fossil veldt
#

so

#

together with successful files

tawdry vapor
#

That looks good. On a similar note, there is room for improvement in the future for that message to be explicit about the file name and number of files. Basically like what the file size limit error does.

fossil veldt
tawdry vapor
#

But I suspect just listing the blocked extension will clue users in on which files failed. So I think it's fine as is too

#

We'll see what feedback we get

fossil veldt
#

yeah I don't think you really need to know which file failed, unlike the size one

#

maybe we could add the number at least

tawdry vapor
#

I'll leave that up to you. I am happy with how it is.

fossil veldt
fossil veldt
hoary haven
#

really nifty stuff, amazing

cold island
# fossil veldt

Looks really nice. Can you match the wording on the last two lines though? ๐Ÿ˜

"Failed to upload 1 file" vs "1 file was not uploaded"

fossil veldt
#

I thought it would look weirder if it matched

#

Failed to upload 1 file (test.bin). File sizes should each not exceed 8 MiB.
Failed to upload 1 file due to disallowed extensions: .exe

#

maybe we can bullet point it...?

cold island
#

Easier to read if it's in a pattern I think. I know where to expect info such as number of files, file names, and the error

fossil veldt
#

failmail emoji maybe?

cold island
#

Hmm maybe

fossil veldt
#

currently seems like they're referring to the same failed file though

#

I feel like removing the number of files for extension disallow makes it more distinctive that they're 2 separate things

cold island
#

Ok, then how about a warning instead: "some files had disallowed extensions and can't be uploaded:..."

#

Got to go, but will catch up later

fossil veldt
#

kk cya

#

I swear the message phrasing is harder than the coding itself ๐Ÿ˜”

tawdry vapor
#

How about

1 file upload (x.y) failed because its file size exceeds 8 MiB.
1 file upload failed because it has a disallowed extension: .exe

#

For plural

2 file uploads (a.b, c.d) failed because each file's size exceeds 8 MiB.
3 file uploads failed because they have disallowed extensions: .exe, .abc

#

Is that too too verbose?

#

I think that resolves the feedback about consistency but it's also clear that each error is for separate files

rapid swallow
fossil veldt
#

I could put a doggo I guess

tawdry vapor
#

Could be like failmail but with a file icon instead of a envelope. Though if you want just failmail seems okay too

rapid swallow
fossil veldt
#

fail_file 2 file uploads (a.b, c.d) failed because each file's size exceeds 8 MiB.
fail_file 3 file uploads failed because they have disallowed extensions: .exe, .abc

tawdry vapor
#

Maybe red is too strong of a colour or it's just me

fossil veldt
#

these also maybe

tawdry vapor
#

Nah first one was the best I think.

#

Are we allowed to use those

fossil veldt
fossil veldt
#

so free for commercial use with attribution of the author I think?

tawdry vapor
#

How would we attribute? A link in our read me?

#

Someone in #dev-branding possibly can make something similar from scratch

cold island
tawdry vapor
#

I was assuming it would not report all reasons for failure, just the first check that fails

cold island
#

We could do that, but I imagine that'll be a bit more annoying if it happens

#

Since you'll have to run it a second time to find out it was never going to work anyway

#

We could prioritize the extensions over something like file size if we wanted to keep it at one error per file

tawdry vapor
cold island
fossil veldt
#

an invalid extension-ed file over 8MiB will only show as the file size failure

#

since it happens earlier at the POST response where we skip parsing files with size parameters larger than the threshold

#

we still know the names of the files that failed due to size though, when we do the extension check

#

hm.. maybe we can show the total number of all failed files for any reason, then list the reasons with names?

cold island
fossil veldt
#

you can see in the server example I even had to do chunked writing to get 8MiBs out in the time limit

#

oh nvm I think I was thinking of 48MiB on snekbox

#

8MiB is pretty easy to do with a string

cold island
fossil veldt
fossil veldt
#

if not I wonder what it should say

#

currently does this which is a bit weird

cold island
fossil veldt
#

not sure if your PR will change it

cold island
#

I just copied it verbatim

fossil veldt
#

slightly darker !

#

_

#

fail_file_alt_2 2 file uploads (a.b, c.d) failed because each file's size exceeds 8 MiB.
fail_file_alt_2 3 file uploads failed because they have disallowed extensions: .exe, .abc

fossil veldt
#

file count limit + extension

#

1 failed size, 1 fail ext

#

single no ext

#

normal

#

single ext

#

mixed disallowed and no ext

desert imp
#

yo i'm following the contrib guide

#

now im tryna run the bot

#

i installed all the dependencies with poetry

#

there was still some dependicies missing

#

like coloredlogs for example

#

then when i tried to run the bot

#
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\\Downloads\bot-main\bot-main\bot\__main__.py", line 78, in <module>
    asyncio.run(main())
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "C:\Users\\Downloads\bot-main\bot-main\bot\__main__.py", line 59, in main
    redis_session=await _create_redis_session(),
  File "C:\Users\\Downloads\bot-main\bot-main\bot\__main__.py", line 32, in _create_redis_session
    return await redis_session.connect()
  File "C:\Users\\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\async_rediscache\session.py", line 136, in connect   
    pool_constructor = aioredis.create_redis_pool(**self._session_kwargs)
AttributeError: module 'aioredis' has no attribute 'create_redis_pool'
gritty wind
#

It sounds like your dependencies arenโ€™t in sync with the actual codebase, one is older than the other

#

Did you download and install dependencies today?

desert imp
#

yeah

vale ibex
#

how are you running the bot?

desert imp
#

python -m bot

vale ibex
#

The errors in that traceback doesn't sound like it's running under a poetry venv

#

run poetry run python -m bot instead

desert imp
#

ill try poetry run task start

vale ibex
#

Yea that works too, it's an alias to the above command

desert imp
#

poetry : The term 'poetry' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path
is correct and try again.

vale ibex
#

did you get that error when you were running poetry install?

desert imp
#

nah i just did python -m poetry install

#

now i just did python -m poetry run task start

#

and got a diff error

vale ibex
#

ah, installing poetry like that isn't recommended by Poetry devs.

#

The "proper" installation steps are on their website, which we link to at the start of the guide

desert imp
#

hm ok

gritty wind
#

While you do that, could you post the new error

desert imp
#

gonna need to do that in chunks

vale ibex
#

!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.pythondiscord.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.

vale ibex
#

works too

desert imp
#

forgot about that

cold island
desert imp
gritty wind
#

Thatโ€™s good, it means you got through most of the setup process

#

At least with dependencies

desert imp
#

i did docker as well

gritty wind
#

The error is due to not having the redis database running

#

Ah yeah

#

Did you update the address?

#

Itโ€™s pointing to our production server address

desert imp
#

oh waitt

#
bot.redis.use_fakeredis to true
#

i forgot this

gritty wind
#

Thatโ€™ll fix this error too

desert imp
#

there it is

#

now its doing site connections

#
raise ResponseCodeError(response=response, response_json=response_json)
pydis_core.site_api.ResponseCodeError: Status: 401 Response: {'detail': 'Invalid token.'}
gritty wind
#

Iโ€™m guessing that variable isnโ€™t set either in your config

desert imp
#

i dont know tbh

#

i made .env with my bot token

#

and im following this

#

i did exactly what it says

#

i didnt go through the hastle of setting up my own server so i just coppied the template

vale ibex
#

It's the first bullet of this section

gritty wind
#

The guide and setup is rather tedious, but itโ€™s a pretty complex project

#

Follow the bullet points Chris linked, those should resolve your connection errors

desert imp
#

ok i think it works now ?

#

no errors but that is worrying me ๐Ÿ™‚

gritty wind
#

Startup takes a few seconds, but you should be able to run commands if it worked

#

Try !ping

desert imp
#

oh yeah i forgot to invite the bot

desert imp
#

bro what ๐Ÿ˜ญ

vale ibex
#

Could you paste the full output of the bot here?

#

all the way back to when you ran the start command

desert imp
#
Found `config.yml` file, loading constants from it.
2023-02-09 12:01:31 | pydis_core.utils._monkey_patches | DEBUG | Patching send_typing, which should fix things breaking when Discord disables typing events. Stay safe!
2023-02-09 12:01:31 | discord.client | WARNING | PyNaCl is not installed, voice will NOT be supported
2023-02-09 12:01:32 | bot | INFO | Attempting site connection: 1/3
2023-02-09 12:09:39 | discord.ext.commands.bot | ERROR | Ignoring exception in command None
discord.ext.commands.errors.CommandNotFound: Command "ping" is not found

vale ibex
#

Seems like it's stuck connecting to site

#

Do you have the site running?

desert imp
#
bot-main-web-1  | "GET /api/healthcheck HTTP/1.1" 200 15
bot-main-web-1  | "GET /api/bot/filter-lists HTTP/1.1" 200 19160
vale ibex
#

I would have expected far more output if it connected to the bot

#

That's strange

#

Could you kill the bot and start it again?

desert imp
#

yezir

#

same thing

vale ibex
#

Could you add BOT_TRACE_LOGGERS=* to your .env?

#

and start it again

desert imp
#

yep

#

when it wants to exit

#

nothing changed

#

why aint it working damn

#

i think its getting stuck in __main__.py

vale ibex
#

Yea, that's what it looks like

desert imp
#
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\\Downloads\bot-main\bot-main\bot\__main__.py", line 78, in <module>
    asyncio.run(main())
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 603, in run_forever
    self._run_once()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 1868, in _run_once
    event_list = self._selector.select(timeout)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\selectors.py", line 324, in select
    r, w, _ = self._select(self._readers, self._writers, [], timeout)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\selectors.py", line 315, in _select
    r, w, x = select.select(r, w, w, timeout)
KeyboardInterrupt
#

when i ctrl c it takes a while

#

before it exits

vale ibex
#

yea, that'll just be the async loop being killed

#

Are you familiar with running debuggers?

desert imp
#

not quiet

vale ibex
#

The next thing I'd suggest doing is stepping through the code and seeing at what point it gets stuck

#

if you goto bot.py and in the setup_hook

#

add some log lines before/after each line, to see where it gets stuck

#

I am going to imagine it'll run line 73 and then get stuck in line 77

desert imp
#
scheduling.create_task(self.load_extensions(exts))
#

ur right

vale ibex
#

something deadlocking in there for some reason

#

not sure why it's effecting you and no one else though

desert imp
#

where is load_extensions

#

so i can log the extensions being loaded

#

and see where it stops

vale ibex
#

it's in the class we're subclassing from

#

pydis_core.BotBase

desert imp
#

ah

vale ibex
#

Did you update the guild_id to be the id of your testing guild?

#

in the config.yml

desert imp
#

im back

#

was having lunch mb

desert imp
#

there it is

#

now it worksi think

vale ibex
#

Nice

#

Yea, the firs thing that load_extensions does is wait for the guild to be available

#

so if the guild id isn't set correctly that'll never pass

desert imp
#

yup makes sense

#

that was my issue

#

i just ignored this

#

that is a lot of configuration i must say

vale ibex
#

Yea, there is a lot of configuration with our bot and it's quite complex

#

Mostly because there are so many cogs that need specific information about the guild

desert imp
#

hm i think the first thing im gonna work on is a automatic setup for local development

#

people that want to work on the python bot without having to go through the hastle

thorny obsidian
#

There is autoguild that Hemlock made that bootstraps a server for you to make it easier

outer oasis
cold island
# fossil veldt

failed_file ![failed_file](https://cdn.discordapp.com/emojis/1073298441968562226.webp?size=128 "failed_file")

fossil veldt
fossil veldt
cold island
#

Yep

fossil veldt
cold island
#

you'll have to restart the bot

fossil veldt
#

๐ŸŽ‰

#

I think we can merge snekbox#159 first? It's backwards compatible with our current eval

dusky shoreBOT
fallen patrol
#

you can dm me for details

#

directly, modmail won't work

#

lmk here before you dm tho

vale ibex
fallen patrol
#

i'm thinking that's not something to say in a public channel

#

but sure, if you want to say that

timid sentinel
#

rip lol

fallen patrol
#

its every single bot that runs dpy that be crashed with a single gif sticker.

vale ibex
#

lol yup

timid sentinel
#

can we bump to main? or monkeypatch?

vale ibex
#

Yea, pinning to a github zip is probably best for now

sharp crag
#

What's the issue with stickers?

fallen patrol
#

7 bots to pin... lol

fallen patrol
sharp crag
#

Discord changed their format for payloads?

fallen patrol
#

so the bot receives what it believes to be a gateway error and hard crashes because it made some assumptions

#

nah they just added gif stickers

sharp crag
#

Similar to the emoji incident a while ago? Lol

fallen patrol
#

like that's not a gif

#

but if i were to send a gif it would error and crash every bot here

#

payload is the same, just dpy doesn't expect them

sharp crag
#

Ah gotcha

#

Monkey patchable?

#

Or PR to discordpy

fallen patrol
#

disnake doesn't crash on these since v2.6 which was released in october ๐Ÿ˜”

sharp crag
#

We do a lil copy pasting

fallen patrol
sharp crag
#

Mm. Are these gif stickers a new feature?

fallen patrol
#

yeah

fallen patrol
sharp crag
#

I'm sure discordpy will have it fixed soon enough then

vale ibex
#

it's already fixed in dpy

#

they just haven't made a release

sharp crag
#

Oh alrighty

vale ibex
broken marsh
#

seems a little weird to have a dict containing all options within the enum that contains all options

fallen patrol
#

@vale ibex yknow

#

you don't actually have to patch the bots ahead of time

#

just turn off external stickers until they get patched kek

#

it probably is just switching the toggle for the everyone role

vale ibex
fallen patrol
#

just modmail honestly

vale ibex
fallen patrol
clever wraith
outer oasis
fallen patrol
vale ibex
fallen patrol
#

yay

gleaming jay
#

@sharp crag

#

got here first

#

loseer

#

LMAOO

sharp crag
#

@gleaming jay I'm on my way home I can assist further then if you don't mind

gleaming jay
#

Yep, sounds good

sharp crag
#

Give me 15

gleaming jay
#

Alright, gonna go out for some lunch then in the meantime

sharp crag
#

@gleaming jay

#

am here

#

do you have a fork or branch or something i can look at?

gleaming jay
#

sorry, just got back from eating

#

give me a moment

sharp crag
#

no worries take your time

gleaming jay
#

hmmm, looks like all my work is gone

#

fun

sharp crag
#

this is not a bing chilling moment

#

Oh well
What was your plan for how it was going to work?

gleaming jay
#

Y'know what Robin

#

I might've just solved it

#

I'm being a dumb

#

uhhh

sharp crag
#

What did you do firEyes

gleaming jay
#

Recontextualization

sharp crag
#

Ah yes
Big word solve problem

gleaming jay
#

Excuse me while I finish writing something I should've done ages ago

sharp crag
#

Lol ๐Ÿ‘
Feel free to request a review from me when you're done

gleaming jay
#

mmmyep. Now I gotta go fix my environment since the whole shit is bonked