#dev-contrib
1 messages ยท Page 86 of 1
I escaped the markdown
ehhhhhh
there may be some
I don't know of any, though
Filtering specific characters before requesting from a website
so there's no possibilities of injections or something
also just a good practice tbh
sanitization
this should be done in most of such commands then
oo, you are streaming, lemme join
ok, (Review my pr, of wiki command, and update ttt on sir lance if u get time, and they need update in the labels too)
That embed looks pretty cool, well done Vester
@obsidian patio great work. bot#1429 has been merged.
Awesome!
Short PR, quick revisions. Nice when things are moving
Still looking for some reviews on bot#1014 if anyone has maybe an hour or two free
is bounty board visible for contributors?
Yep
@vale ibex Mentioned changes in c4 pr :D
!remind 23949s connect 4 PR
Your reminder will arrive in 6 hours, 39 minutes and 9 seconds!
Dang, 2 seconds off 6pm ๐
I updated the bot test server yml on notion with @obsidian patio's change, not sure if its worth a dev announce or not
<insert Ralph I'm helping meme here>
Cool, thanks!
I really like the language used in the DM too, nice job ๐
Thanks ๐
Question
How does one use the Redis cache to store message object or message id?
preferably message object, if that's even possible
would it be cache.set(key, value)
Using self.bot.redis_session?
Where cache is async_rediscache.RedisCache(namespace=foo)
ah
Don't think you can really serialize a message in any other way
Have a look at this two.
A Discord bot started as a community project for Hacktoberfest 2018, later evolved to an introductory project for aspiring new developers starting out with open source development. - python-discord...
help channels and dm log come to mind
We use it quite a lot
voice gate, silence, branding
On top of my head, we use it for people who got the ping in #voice-verification, branding state, silenced channels, defcon state (soon)
What are you using it for again?
xith was asking for in the stream on twitch, we were doing it for the ^
Well, I'm presuming you want it to edit it, yeah?
yeah
I think you can store just what you need to recreate it and get discord to edit it
Without storing the whole thing
(kwzrd suggested use of redis)
Are you planning on ditching persistence, or?
I'm thinking about it
I mean it would be neat to have it
But is it necessary for this?
i had the same thinking, of not using redis, but when xith told that a big contributor told about it, there must be some reason
Would it take more work to use the redis cache, or just search for the message?
That person being kwzrd
redis cache would probably be neater i think
I mean it's like one extra API call, which we don't exactly want
My verdict: yes on the Redis cache
Editing an uneditable message
I'm looking at the message edit src code, and all you'd need to inject is channel ID and msg ID
webhook messages are uneditable?
ok, so what are u doing rn then? Making the bot send a message and then edit it on claiming channels?
if message exists, edit message. otherwise, send message, set dynamic message to that message, save in cache.
ah right
skipped some parts, but that's a tldr
yeah understood
Made a POC for editing a message from a channel id + msg id
but it became a bit esoteric
import discord; from types import SimpleNamespace; msg_props = SimpleNamespace(_state=SimpleNamespace(http=self.bot.http), channel=SimpleNamespace(id=776836333208600591), id=813748314746912819, _update=lambda x: x); await discord.Message.edit(self=msg_props, content="test")
oh god
It doesn't look too bad when you expand it
but I'm too lazy to expand it
What have you done
Expanded version
I will slap you if this makes it into a PR though lol
!e print('\n'.join('import discord; from types import SimpleNamespace; msg_props = SimpleNamespace(_state=SimpleNamespace(http=self.bot.http), channel=SimpleNamespace(id=776836333208600591), id=813748314746912819, _update=lambda x: x); await discord.Message.edit(self=msg_props, content="test")'.split('; ')))
ffs
@vocal wolf :white_check_mark: Your eval job has completed with return code 0.
001 | import discord
002 | from types import SimpleNamespace
003 | msg_props = SimpleNamespace(_state=SimpleNamespace(http=self.bot.http), channel=SimpleNamespace(id=776836333208600591), id=813748314746912819, _update=lambda x: x)
004 | await discord.Message.edit(self=msg_props, content="test")
lol
eheheheheh
now I want to
I mean we do something similar with docs
but that's because a better solution doesn't exist there
@gritty wind unfortunately objects cannot be put into the cache
but maybe I could serialize them
would that be overdoing it?
Yesh, hence the hack with IDs above
But yeah that's overkill
just save the IDs, and fetch them
The channel should be available, the message should be fetched
thing that came up between me and @gritty wind trying to get @vocal wolf bot dev setup working in docker compose:
what are the opinions on putting restart: always on the bot service? This would allow to bot to restart by itself if it crashes because the site hasn't loaded yet.
personally, i would also like to add a config for the log-storage as to prevent logs file from growing to horrendous sizes when leaving the bot running for a while.
๐ from me, but I'd also like this only as a temporary solution, as there are other docker errors that indicate a problematic config.
I think the bigger fix here, and it's something we talked about at various points but never implemented is to have the bot wait for site on startup. I'd also like better startup errors, but we have an unapproved issue pending for that
We should do something like site do for waiting PostgreSQL
Should we be able to bypass that? I often start the bot without the site running for features that do not require it
Doesn't the bot error out on start if site isn't running?
i made a draft PR for it: https://github.com/python-discord/bot/pull/1430
(tell me if the tags are wrong)
So it's probably not CI because we don't use compose in CI but it doesn't matter
It didn't last time I ran it like that but it has been a while, something may have changed that makes a request before the bot starts fully
I think we also have enhancemnet
defcon
That was wrapped in a broad except last time I checked so it shouldn't stop startup
Looks like it doesn't work now because of await self.cache_filter_list_data() in the bot login, which can be deleted to work without the site running
right, but its still a issue for people that want the site running/need site features, and just do docker-compose up -d
Hmm it shouldn't be except for very specific issues, because the site will be ready when they go to use it
But startup features that fetch from bot won't work
So a waiting solution would still work better imo
Waiting sounds good for me, just also would like something to bypass that, although I'm not sure if there even is a good way of doing that (maybe handling a single keyboard interrupt)
#bot-commands
I think they want to run code from links, but currently the snebox doesn't support it
like we paste a pastebin link, it gets the code from there and then runs it
Ah lol, I sent that message before they started typing
It probably won't be a snekbox thing, but a bot thing
But hmm
I'm not sure if we want to fetch code from unknown sources
Your reminder will arrive in 1 hour!
like:
!e
link=<link>
only python discord pastebin links
and also support to run .py files, like your message contains a attachement
that's a hard no
we don't allow attachments on the server yeah
yeah I'm fairly sure we decided against running from the pastebin
it isn't the intent of snekbox or the eval feature
there is an issue somewhere, but I'm on mobile
either organisation or meta
or maybe bot
think so
now on laptop 1 sec
open I guess
but yeah I'd rather not
bot#1133
open
@patent pivot
Here's your reminder: readiness checks.
[Jump back to when you created the reminder](#dev-contrib message)
I was about to ask someone to investigate that :D
!remind 1h actually readiness checks
Your reminder will arrive in 1 hour!
@patent pivot
Here's your reminder: actually readiness checks.
[Jump back to when you created the reminder](#dev-contrib message)
Hey @patent pivot @green oriole @subtle kraken @vocal wolf @gritty wind! It's just about time for the meeting. Wanna join dev-vc?
hello
(hello)
Heyo, the fuzzy matching for the commands suggestion seems to pick up any additional text that come with it as well
Saw something happen where a super large text block was also added to it, leading to a large embed reply from the bot
!pste test 1 2 3 4 5
Should I be making an issue for this? (the suggestion embed gets deleted but you can test it with ^ )
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
wait nvm there are still suggestions for tags
@vale ibex
Here's your reminder: connect 4 PR.
[Jump back to when you created the reminder](#dev-contrib message)
how is the command typo fixer coded?
it's similar to the tag system
ah, so the typos are manually coded in?
no
why do you guys make a cog for every command?
https://github.com/python-discord/bot/blob/604c9b6ff1ac169235adbf89a596bcca5f28f7cc/bot/exts/backend/error_handler.py#L180
you can see the source code for getting similar command here
we don't
cogs are made for related commands
thanks
no, for sir-lancebot
Why is that under the tag function anyway
Basically, we merged a feature where the first message from the user in the help channel was sent to them in DMs (check out #changelog)
the issue is when they just sent an image. That means there was no message, so the bot tried to send an empty message, which throws an exception
yeah, and bumped the count up to 3, but i'm guessing that was a config change
ohhhh
Since there's an exception before the new channel is moved up, we'll be left with one less available help channel
so now I assume it will attach the image in DMs
Scaleos fixed it. Not sure how it handles that edge case now
would I get in trouble for testing?
No
Seems like it just logs the exception and ignores it atm
Not optimal, but it works
can confirm, works
testing
oh hey it didn't crash
Yep, scal fixed it
Well, I tested to see if it would crash if it deleted the message via the spam filter
so I attached a message.txt and filled it with useless text
We have resources for that! First off, here's the repo for for Sir Lancebot:
https://github.com/python-discord/sir-lancebot
Take a look through and see if there are existing issues that you want to work on. If you have a specific thing you want to implement, that's fine too. We just want you to make an issue about it first so we can assign you to it.
We do have some contributing guidelines, you can take a read through them before you work on your contribution/feature: https://github.com/python-discord/sir-lancebot/blob/master/CONTRIBUTING.md
And the contributing guide on the sir-lancebot repo and site
Finally, here's a helpful wiki for how to get Sir Lancebot up and running locally so you can test your feature and all that good stuff: https://pythondiscord.com/pages/contributing/sir-lancebot/
We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.
Feel free to ask here if you want to bounce ideas off of us or have issues getting Sir Lancebot running
You need to have a good understanding of discord.py for contributing to sir-lancebot.
Bump
do u guys use cogs? because i dont
yes, please do make an issue
i am sfupid so i do not know how to make cogs
yes we do, this could be a great opportunity to learn about cogs and use them
oh ok
cogs are great because all my commands are in separate files
i know how to do the usual @client.command thing
why do you guys make cogs for pretty much for every command?
pretty confusing 
Because we can then unload/reload them and it keeps it fairly structured. If you want to work on a specific command, you only need to alter a few smaller files and not massive ones
I don't think it's confusing
@thorny obsidian thursday sounds good. What timezone are you in?
EST but with your sleep schedule does that matter? =P I'm functioning at 8am and my cutoff is 10pm
@vocal wolf #community-meta message
Given it's a Thursday and I have Calculus I won't be available until like 1130 PST, 230pm your time
oh that's perf
Those two
mmmmmm I don't know, people can insert offensive names
itd be for internal use only ยฏ\_(ใ)_/ยฏ
besides, you don't think they can submit offensive questions already?
I've already seen pretty wack posts
This was the reason i gave for it
This way someone could get updated with their question got added
I mean I guess it's so we can contact the user if we have questions
And i never fixed the typo, *when
Have you made an issue in the sir-lancebot repo?
It would be much easier to keep track of progress there
No, i haven't coughs
@thorny obsidian we shall be productive.
I wasn't sure if i make a meta issue and a sirlancboe issue
sir lancebot issue will do
perhaps she'll tell me what she uses for git eventually
Ok
Unfortunately i can't make it right now and probably not uh, until thursday
I have a thingy tomorrow so that's out. ๐
Yee, it should go well, not that big
oh god damn
You have teh powah!
Anyways
There's a lot of stuff in #community-meta soley about the topic command not having a lot of topics on it and ppl saying no one looks at the stuff
!remind @thorny obsidian 39h Meet for thing
Your reminder will arrive in 1 day and 15 hours and will mention 1 other(s)!
Wut you can do that
ye
tbh I think #community-meta is for suggesting the idea, and then you go to the repo and make an issue after getting approval from others in that channel
that channel's like for staging I guess
What is it all about? 
cleaning up the topics in the .topic command
adding more, editing, deleting, etc.
A'ight
@short snow Sorry I just realised that my comment on your connect 4 PR lost the context of the other comment I was replying too, so might not have made sense. I've updated the comment, hopefully it makes more sense now ๐
Cool thanks will have a look it
ah an guild check, that's what was missing
๐ฌ
uhh, i will do that rn
should i hardcode the channel, or use constants?
If you're just trying to prevent it from running in DM, I think there's a check for that
Or are you trying to do something else
yes that's what i am doing
Right, so what needs hardcoding?
lemme see if there is a check for that
I think the commands.guild_only() check would be enough
the community commands channel id
That's already done for you
i don't think that it takes a message argument
That's in constants.py afaik
You just need to stop it from running in guild
All commands in sir-lance run through the whitelist_check, which passes on guild, and checks for very specific channels otherwise
It doesn't provide the sir lancebot chanel here
you can pass a channel kwarg to the whitelist check, which will output the channels
although the check doesn't seem to be running
The whitelist check wouldn't help here because it only affects on-server things
yea, true.
One option is to use the commands.guild_only() decorator and then catch NoPrivateMessage in an command error handler
but something more generic may be useful for the bot
We already handle it globally
(Example the ttt command pic i showed)
Ahh right, so just the decorator is needed then
can i edit the embed sent out by that error handler pointing towards #sir-lancebot-playground
That's good to know for future and probably invalidates the point of sir-lancebot#581
That could be useful
@gritty wind whats your say?
should i jsut do it with c4 pr
since it is just a line change
Sure
okie dokie
Looks good, how come you added a new import for guild_only, instead of using commands.guild_only, since you already have commands imported?
uhh, i just hovered over the error and pycharm did that lol
Ahhh ๐
should i change it?
another reason why notepad is the one true editor
I'm going to approve your current changes anyway, up to you if you want to change it
I can merge it in a bit
ok 
soonโข๏ธ
It's only a matter of time until the owls take over brother
We should change the annotation for bot from commands.Bot to bot.Bot to fix the http_session annotation errors
@gritty wind do you mean commands that need to be invoked in the server, or commands that will require DMs?
The original issue was about commands being invoked from DM
The code chris posted will only affect that, not the bot using DMs
Right, there shouldn't be any commands that need to be invoked in DMs then
sweet beans
I think minesweeper uses DM commands?
only input
Ideally we should move all that to the server
But for now I think none of those require you enter commands into DMs
uhh, that could be a bit spamming, and would loose the board, since even others use the channel
loose board meaning go up in message history
Battleship and minesweeper are the only games affected by this?
We can have the bot delete the messages
And the sir-lancebot channel does not move as fast as bot-commands
uhh, just allow inputs in DMs, and not "invoking" the command
But input is also susceptible to breaking
And it's already difficult enough to investigate some bugs
If we can reduce the complexity, that would be awesome
hmmm, so we can do it like the sal command
true
sorry for breaking the discussion, but:
there are two annotations issues in the sir-lancebot dunno about bot.
We should change the annotation for bot from commands.Bot to bot.Bot to fix the http_session annotation errors
in a lot of places in the sir-lancebot code this happens:
def func() -> None:
return await ctx.send()
but it should be
def func() -> None:
await ctx.send()
return
Maybe we can make global DM disable, but decorator that bypass this.
That would be easy, but why?
Like minesweeper should stay in DMs
That would be unrelated to this
The change to make commands invokable only from the server won't affect message handlers getting messages in DMs
So there is no need for an override
I don't understand now. Do you want disable commands in DMs?
like i said in my comment on the github
you can get messages from DMs, but not start a command or "invoke" it in the DMs
Which is what we do with @stable mountain
But .ms reveal|flag commands is meant to be executed in DMs
Which is the difficult part in this
I want it moved to the server
But the concern is that it would flood the chat
So I'm thinking we delete the message after the action is done
The sir-lancebot channel does not scroll that fast
it could, you never know
@gritty wind Done! Also why did the lint and status embed run twice?
Hmm Iโll check it out in a bit
#sir-lancebot-playground message ๐ ๐
!source
so all of your bot code in the repo is in the bot folder you see. The way we use our bot is with extensions and cogs, so for most things you go to the exts folder
ah i see
yeah i see a folder named "moderation"!
utils is for useful functions used in multiple parts of the code, resources is for things like json files and the like. rules is to help with some filtering things.
Moderation is typically our moderation system. For things like invites and the like, we put that under filters
ohhhh so filters filter out all inappropriate content
filters is for things our bot will check for and usually just straight up remove
or notify the mods
yes, i saw that it's written by you Akarys42 lol
mhm, we have filters for tokens, webhooks, spam (which uses our rules which is the other folder I mentioned earlier), and then just other filtering. So you can see that we filter for invites, blacklisted domains, too much zalgo, etc
I have probably made the last modification of this file, but not everything is written by me ๐
ah ok lol
sickkkk
im looking into it right now. tysm @thorny obsidian!
no problem~ if you anymore questions feel free to ask here
alright! :))
If you are curious about how a specific command is implemented @dry folio, you can use the !source command like this
!source rule
Provides a link to all rules or, if specified, displays specific rule(s).
!source pypi
Provide information about a specific package from PyPI.
ooh, thx for the shortcut!
im still trying to understand the anti-spam function lol, this is my first time seeing real good code made by other devs and it's rly cool
is there a way to put emojis, and webhooks into the server templates?
There is not afaik
adding them seems a tedious task
Cool, maybe we can have a different solution for time being make a config file containing emoji name and its raw github link and adding it through code
similary for webhooks
Webhooks should come included
at least mine did
emoji is only one that's mandatory
I don't think it warrants much effort while we wait on smart config
do we have a fixed style on how imports should be?
example:
from discord.ext import commands => commands.command, commands.Cog
or
from discord.ext.commands import stuff
Depends how many things you have to import
py-gen have so high activity that nobody see this actually.
wut is py-gen
imo, i don't like the idea of sending a random fact to python general
i like the idea of appending a fact to the file though
gotcha ๐
how do I append a line to the file again?
riiight
Would it be worth using aiofiles here, if we're doing file io in a command
@eternal owl @clever wraith This is not possible anymore, because file persisting was removed with migration to Kubernetes.
we have redis though!
Yes, but using files isn't option anymore
we try avoid it for persistence
Is redis persistent?
Yea, that's safer
I mean, we do consider it as more or less persistent now
What do we use to persist otn?
It is Lance anyway
database
the database
postgres
meh, joe is faster
Ahh yea the Web is a thing
Having a discussion and manually updating is probably good enough for now
This is so sad that we can't have DB in lancebot
I think not having a DB is a primary goal of the project
lancebot is our project to inspire open source contribution
I think that having a simple setup process with no other moving components is the goal
and that's why we make redis optional and stuff
Honestly, will we ever loose the redis cache
ยฏ_(ใ)_/ยฏ
At worse we have the backup
yeah
But you can't have tables in Redis
sure
but that's just a limitation we deal with
because that's a better downside than having contributors having to set up a whole database or docker
If we could get Redis hash tables then this would partially give something like table
It isn't bad honestly, you can work around that
seasonalbot being KV at core is very simple for new contributors
and async-rediscache makes it super easy to add pseudo-persistence
Don't we already have hash maps with async-rediscache?
But each namespace is hash table
oh :/
can i have the trash can emote?

Can just replace them with ordinary emojis if it's for your test server, not like they come up much
Currently i do that, but sometimes it is needed for the look, how does it look? And maybe u need that emoji while writing some code, so i just thought of adding them all
No need of adding style.icons right?
And to use eval we would need to host it right?
And how do we see if a issue is approved to work on or not in bot
Yes, you need to host snekbox to use the public eval. I believe it is included in the bot's compose
Which issue are you interested in?
Am just going thro the code of bot rn, will let u know soon
Issues that don't have the planned tag should be ready afaik, but it'll always be clear after you ask to be assigned
Alright
What is BOT_API_KEY? And https://github.com/python-discord/bot/blob/d71ac9f6e240ffd2d4195d9dbbf5740a0c2413a1/docker-compose.yml#L43 needs to be replaced right? So why doesnโt it be taken from .env?
BOT_API_KEY is what the bot uses to authenticate with the site's api
And how do we get that?
The development key is the badbot one
So there's a development site for people to use when making development environments for @Python?
Or you gotta host the site as well.
You host everything yourself
Ah okay
I did docker-compose up -d but the bot isn't online
all the images are build
Logs have no errrors
lemme see if the site is up
site is up
hmm, everything except the bot is up
the token is correct
what else can be the problem? 
Try starting the bot container now that everything else is up, if it's not already running. I personally have an issue where bot starts before site is running, so bot can't quite start
docker-compose up --no-deps bot ?
I've done it using the ui
ubuntu has no docker ui ๐ฆ
Hmm, I don't know how it'd be done with the CL. Just try to run the container if it's not already running, assuming that the other containers are running already
I believe you'll need to change the hosts in your config
"redis.default.svc.cluster.local" into "redis" etc.
lemme try that
done done odne ๐
ty
here this works and sends a webhook
butt
here it doesn;t
same id being used
am just messing around to check whether the setup is correct
--
and i get this:
According to the API, your request is malformed.
after every!clean
fixd , had to put my server id in config.yml
even this got fixed ๐
the onl problem, i found with !ping command
running the bot like this: docker-compose up -d bot
yeah, the ping command wonโt work locally
whats the issue, i can try to fix it
It isn't approved
The fix is ready
but
I actually don't remember why it isn't approved
bot#1407
Or maybe not? Akarys quietly removed the planning tag
https://github.com/python-discord/site/pull/443 feel free to review, ~~soothe me from my devops headache ~~
@gritty wind I did this in my current deployment but it's not working again ๐คท๐ปโโ๏ธ
o no
did something change about the website?
even the site api would change to api.web:8000 if that's what u mean
I copied everything for good measure but the problem is presumably at the end https://paste.pythondiscord.com/uyuzaqusay.properties
@eternal owl Done ๐ , mentioned the required changes in improve wikipedia pr
I c
try docker-compose up -d web
then docker-compose up -d in a few seconds
also what's in your redis setings
trying to set up bot?
lines 6 to 10 are exactly
redis:
host: "localhost"
port: 6379
password: null
use_fakeredis: true
The d is just so it doesn't lock you in the console
You can omit it if you want
more importantly you need to start the site before the bot
Because @patent pivot didn't add readiness checks >.>
this is what i did:
docker-compose up -d # Will get the site, redis and eval running
docker-compose up -d bot # Will re run the bot, since bot starts before site is running, so bot can't quite start in the first command
And
I believe you'll need to change the hosts in your config
"redis.default.svc.cluster.local" into "redis" etc.
He's already using fake redis, so that won't affect it
it's just the startup readiness here
ah ok
how do you do it lol
hmm, i tried it once again but the bot doesn't come online
- run
docker-compose up -danddocker-compose up --no-deps bot--> Cannot connect toapi.web:8000
- run
docker-compose up -danddocker-compose up -d bot-->
bot_redis_1 is up-to-date
bot_postgres_1 is up-to-date
bot_snekbox_1 is up-to-date
bot_web_1 is up-to-date
Starting bot_bot_1 ... done
``` But doesn't come online
hmm, seems like i need to do this:
- docker-compose up -d bot
- docker-compose up --no-deps bot
and i don't get a startup message in #dev-log
(my dev log)
try this
alright
without any commands before that?
jason@devlab:~/PycharmProjects/bot$ docker-compose up -d web
bot_postgres_1 is up-to-date
bot_web_1 is up-to-date
lemme stop them and do it again
Ok, nothing seems to work now, even the earlier thing
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.web:8000 ssl:default [None]
``` on doing `docker-compose up --no-deps bot`
what's the schema set to?
# PyDis site vars
site: &DOMAIN "web:8000"
site_api: &API "api.web:8000"
site_api_schema: "http://"
site_paste: &PASTE !JOIN ["paste.", *DOMAIN]
site_schema: &SCHEMA "https://"
site_staff: &STAFF !JOIN ["staff.", *DOMAIN]
should i shift it to http
for site_schema
yes
That's causing the SSL errors
There's no certificate or TLS route exposed locally
although
I wonder why it's using site_schema at all
However, it does mention SSL (the error)
So it's worth a shot
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.web:8000 ssl:default [Connect call failed ('172.22.0.5', 8000)]
same
@cosmic moat great job so far, do you think you think you can finish this off?
@short snow Alright, change the site_schema back in that case
It supposed to be for the outside world website, I think
uhh, it worked now
i changed it back to https
and ran docker-compose up --no-deps bot
and tada
Alright, that's a bit odd.
The local schema for the API you're connecting to internally should be http, since there's no TLS/SSL locally
should i show the web part of my config, rn? the one which is working rn?
fails on eval
that's a weird configuration
It looks like it's looking for a kubernetes cluster address
Are you running snekbox locally?
I believe mine did that as well, before I changed something in the config file
I don't think you get snekbox by default with our docker-compose, but I haven't actually checked it in a while
Which just means the eval command doesn't work, as you can't use the remote one
You need to change the snekbox API URL in the config. I think http://snekbox:8060 works if you're using docker
It is http://snekbox:8060/eval
Ah yes
You do get it by default in the compose setup
yeah doing docker-compose up -d, gets the snekboxbuild from github
lemme see
ty everything works now
i will go through the code and then start contributing to bot too
https://github.com/python-discord/bot/pull/1028 needs reviewing
Hi am reviewing your PR (bot#1392)
how are we skipping fuzzysearch with changing it to True?
At best we skip command suggestion which uses difflib and not fuzzy
Can you explain it to me?
i can take over the left behind prs if u want to
on sir lance and bot.
you ppl seem to be on ๐ฅ
@vocal wolf ^
ak, xith and senjan
u missed part 1 of the ping
yeah am reviewing stuff because more than 20prs and it gets terrifying
am trying to close as many new PRs as possible so we can focus on old ones, which am also looking into reviewing
@vocal wolf 
list them and I'll see
I'll go over all the PRs in sir-lance and label them accordingly
you can start on those
alright thanks.
but don't do like, all of them
in fact, let me take an even closer look
alright let me know which can be taken
and sir-lancebot#600 needs another approve, iceman gave first one
@subtle kraken I heard you want to increase your streak 
This PR needs reviewing
Do I look like I review sir-lancebot smh
I'll put it in my asyncio.Queue
haha
This invoke see's if the given command is a tag by trying to invoke it
Currently if the tag is on cooldown, that function returns False, which makes this check think it doesn't exist
There were two options that I saw implement a 3 state system of exists, exists but on cd and not exists. or return true even if its on cd
since the return of that specific function I changed isn't used anywhere else, changing it to True there means anything that calls invoke gets told it exists, but the tag still doesn't run as its on cd
@vale ibex yeah but I don't see that point to fuzzy search at any point in either case of return
so its just more of a misnaming of PR?
it looks good otherwise
So if the invoke returns false, the error handler thinks it isn't a tag, so carries on and tries to fuzzy search
But since the invoke returns true, the error handler sees that its a tag and doesn't do anything
but within the invoke it still doesn't run the tag, since its on cd
Currently if a tag is on cd, and a user tries to run the tag as a command, this error handler will be hit, try to invoke the tag, the invoke will return False (since its on cd) so the error handler will think its not a tag and try to fuzzy search
By making the invoke return True even if its on cd, this error handler sees that its a tag so doesn't do the fuzzy search
or am I missing the point of your question? ๐
am not quite seeing that being False go into any sort of fuzzy search
if it's False it will just go and invoke send_command_suggestion
yea, which is the fuzzy search for a command
or at least that's what I've heard it be called
Alright, might be my misunderstanding of it then, I've just heard it be called fuzzy search ๐
maybe it was fuzzy search before
if similar_command_data := difflib.get_close_matches(command_name, raw_commands, 1): is what searches for commands at the moment
well either way I can approve it, looks good
๐
sorry to butt in, is this somehow related to bot#1400 ?
No wait
I meant 1432, it's an issue with the "did you mean..." Embed catching any extra words
not quite
I saw some cases where it could lead to quite large embeds
that PR I talk of simply means suggestion won't be sent on cooldown
Ah right NVM then, thought the fuzzy matching would be related
how are tags to issues assigned?
Am I supposed to set them as I make an issue, or will some staff member do it?
Submit a proposal on the tag discussions, get it approved, then you'll be assigned to an issue
I think I'm not using the right lingo here
I'm talking of those little color bubbles with stuff like "status: planning"
Ah right ๐
might want to look into this
only saw this behaviour in #discord-bots , remember seeing the old embed in help channels
There is a fix incoming for that :)
sure, i'll have time tomorrow afternoon
commented on your issue btw
@vocal wolf on my PR for the empty-json tag. Sorry I was under the impression I already merged the requested changes from the review. I guess I forgot those. They are merged now. Will wait for a review
bot#1393
fuzzy wuzzy is weird sometimes
@vocal wolf @thorny obsidian
Here's your reminder: Meet for thing.
[Jump back to when you created the reminder](#dev-contrib message)
mmmmmmmmmm
postpone?
no problem~ ping me when you are less sad, also do something else to distract yourself!!!
like sleeping
@thorny obsidian I have recovered. Shall we meet sometime today?
yeah! I have a meeting in 90 minutes, but can chat anytime before then
You feeling any better?
whoo! Don't make me bully you into letting me mail you cookies 
@patent pivot do you wanna chat about the .topic command?
๐ค
my internet isn't being healthy
.topic
What are you guys talking about
updating topics
Ohk
@thorny obsidian topics have been pushed.
nice, I see a majority of my suggestions in that commit lol
pls review :)
@vocal wolf Thanks for doing all the work and just letting me chat about random things~~
ok
Thanks. It was fun contributing to the bot. How long does it take on average for an update to be pushed?
It really depends
Some PRs are absolutely massive and take months to get merged
others are small and can take as little as 5 minutes
So given the size of the tag in this case, I'd say usually a day or two, maybe up to 5 days?
Not too sure though
Fair enough. Iโll wait and see when we get the #changelog message
oh yeah I can post that
The bot redeploys almost immediately after a pr is merged if everything went correctly if you were asking about that
!empty-json
When using JSON, you might run into the following error:
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
This error could have appeared because you just created the JSON file and there is nothing in it at the moment.
Whilst having empty data is no problem, the file itself may never be completely empty.
You most likely wanted to structure your JSON as a dictionary. To do this, edit your empty JSON file so that it instead contains {}.
Different data types are also supported. If you wish to read more on these, please refer to this article.
Right. Yeah I was wondering about that. Fair enough
we need one for connect 4 too ig
@gritty wind https://github.com/python-discord/sir-lancebot/issues/602#issuecomment-785991958 I got a question on the issue you opened about WTF Python
alright, so if the message it long, i will just paginate it, cool thanks for the quick response
just paginate everything
if it fits in one page, the paginator should already handle that
yeah, the paginator would manage that
so api is separate from site now?
that is under active development
@gritty wind does my answer in the PR make sense? not sure if that's what you meant
So what I'm thinking is
If it isn't an actual error
It shouldn't be printed and treated as such
It'll make it to sentry, and it will error out on local dev
Especially with fakeredis which does not maintain state across restarts
the exception print is actually a request from Akarys https://github.com/python-discord/bot/pull/1262#discussion_r577765331
Keep in mind also that the try-except is suppressing any errors, so it's not gonna make it to sentry
I don't necessarily agree with that sentiment that errors in it should be relayed to sentry. Imo, exceptions should only be raised when you have an unpredictable, or uncatchable error.
which framework is being used for the api?
That info will be available once the repo is made public
Ah okay
In that case, I don't see what we're talking about
It's just the difference between a try-except and if-else
Well, it's an unpredictable behavior that we need to address at that moment
So it pings mods because they need to see if the settings should be changed, and devops so they know there's an issue
Yeah that's what I'm hoping it would do
I just don't see the value in a sentry error
But if that's not in the question
Then I'm good with it
Hmm that I'm unsure of
Primarily because it will be confusing on local development
And I don't see what a KeyError traceback will provide over a customized message
or no message at all, and a discord warn
by printing I mean to Discord
Ah lol
to the channel
In that case, don't mind me
Ahh, am not sure if stackoverflow thing is needed, since if a cheatsheet query is not available to them, the send back the result of a stackoverflow search
If there is no cheat sheet for a programming language query (and it is almost always the case), it is generated on the fly, based on available cheat sheets and answers on StackOverflow. Of course, there is no guarantee that the returned cheat sheet will be a 100% hit, but it is almost always exactly what you are looking for.
Bot errors out on
!e
from random import random while True: print(chr(round(9585 + random())), end='')
in #bot-commands
I think it's currently having a bit of a problem with infinite loops
@patent pivot ^
yeah we're working on a fix internally
!e ```py
from random import random
while True: print(chr(round(9585 + random())), end='')
Sorry, an unexpected error occurred. Please let us know!
ClientResponseError: 500, message='Internal Server Error', url=URL('http://snekbox.default.svc.cluster.local/eval')
yeah that's the one
will hopefully have something together by the end of the weekend, if not earlier
Hmm, I dunno but another bot with snekbox woks with this using lxc containers, it keeps it simple and doesn't coomplicate it our current implementation is. Run on a linux server
uses nodejs now, but can be done with python too
and using lxc containers, it implements half security for us
I don't think this will help in this case
But more details once we actually fully debug it and fix it
yeah, but it is about simplifying the current one, maybe if i get time, i can share a detailed implementation of it.
I guess if this is a general thing, you'd want to talk to @tawdry vapor about it too
(I am not sure about how it is implemented currently, just basic information ik, so I could be wrong)
wouldn't it run out of memory or run out of time by that point?
so
yeah
it runs out of memory
okay so
hm let me try describe how this all works
but shouldn't there be a limit on the memory usable by the process?
no yeah that is the limit that is being hit
this isn't an escape that is causing us to run out of memory or anything
when you start an eval on snekbox, the server actually creates two cgroups (which are there to limit resource usage)
we create one, nsjail then creates one inside that
once we are done, we delete the one we created
the issue is you can only delete a cgroup if there is nothing inside it
when nsjail exits normally it cleans up the cgroup it created, it does not do that if it exited due to a memory error or other cgroup limit hit
so basically we are trying to delete a cgroup which is "busy" because it has a child cgroup that had a process that got killed
there is no security compromise, it's just that nsjail isn't clearing something up which we need it to clear up in order to run our clear up tasks
ah
by the time the error above has hit the actual python execution has long finished and we are in the stages of cleaning up and sending the data back to @stable mountain
ok
ah thanks, i Think using lxc would be much simpler than this, i will talk to Mark about this.
lxc will not work for us in terms of devops
we don't want to set up a whole new container runtime, it works well enough in docker with the security policies in place
hmmm, alright i will think about it, but still think if lxc is worth it, i will talk to mark about it
how do u ppl delete codejam teams?
and this should be caught, no two team names and one person should be in one team only
We don't really use this frequently enough for it to be a big deal
yeah
but open an issue for it
for both of them?
I don't know if it's worth adding the functionality
I'm not quite sure what the exact setup will be for the next code jam
The current command has served us fine so far, but I'm not sure we'll be using it again in the future
I'm intrigued, why do you think a different container type would be better for us?
I don't know if this is the right channel to ask this but what would cause a Something went wrong. error when pasting in paste.pydis.com?
I keep getting that
That's odd. I'm not getting anything like that. When do you see that error?
when I try to paste my code
it works when I write a small string like abcd
but not for my code
I'm not sure we'll be using the code jam set-up code exactly as it is currently. There are a lot of lessons learned for how we'll run it and there are definitely aspects we're going to change.
alright hastebin resolved, firewall got greedy
I haven't looked at the exact code and functionality yet, but plan to in April
how were teams removed till date?
internal eval
ah
#bot-commands message
got a problem
Same issue as
start reading from here if you are interested for an explanation, otherwise we are working on it
I'll open a PR on snekbox when I get home
I wonder why this problem has only just manifested
Might be upstream
When did you make the cgroups change?
Wasn't that yesterday or something when it got merged?
Yesterday we merged a PR making a unique cgroup for each process, but it seems to break in prod
That's what I meant, yeah
So, I don't think it's a problem that only just manifested because of upstream
But rather it manifested because we merged that PR
And it only does this in certain specific circumstances
Oh was that only yesterday
so
I wonder what the thing is
is it having large stdouts?
!e import time; ' ' * 100_000_000; time.sleep(0.1)
@patent pivot :warning: Your eval job timed out or ran out of memory.
[No output]
riiiight
yeah that's probably something I didn't test, I tested memory & PID limits, forgot that huge stdout wreaks havoc at times as well
this is my patch that fixes it for stdout as well
I wonder why it did work two days ago, but not now anymore
I don't think it did work two days ago
did we test huge stdout on the dynamic cgroups PR?
Well, we did have some users running infinite loops, it never broke
I can see if I can reproduce locally
infinite loops or infinite loops with prints?
!e ```py
a = [1]
while True:
a.extend(a)
@patent pivot :warning: Your eval job timed out or ran out of memory.
[No output]
!e ```py
a = [1]
while True:
a.extend(a)
print(a)
Sorry, an unexpected error occurred. Please let us know!
ClientResponseError: 500, message='Internal Server Error', url=URL('http://snekbox.default.svc.cluster.local/eval')
that's where the error manifests
Alright, let's see
I do get a 500 on your branch
OSError: [Errno 16] Device or resource busy: '/sys/fs/cgroup/memory/snekbox-dae49828-a99f-4696-926d-7a963487250d'
yeah
Building the image takes a long time man
Okay, it did work before the merge @patent pivot
You can do that if debug is enabled, but I'm not sure if it is worth the trouble
How do I check that?
smh straight up ignoring my message
constants.fake redis
Hello folks, it would be much appreciated if someone could review bot#1436
Yeah I can add that
Alright lemme have a look
You mean me?
do we use bulma calendar anywhere
Hmm, never seen anywhere
Ok now my deleted msgs are useful, why did ak merge pr with only one approval
Because you approved it, and I do trust your judgement, the PR is quite simple either way
Ah ok. Thankyou 
thank you for your review, appreciate that!
cc @late wolf @short snow that bug should be fixed in https://github.com/python-discord/snekbox/pull/94, please feel free to test your snippets again
how is my PR?
Alright cool, i will test it
Not my idea, had being purposed by someone on gurkbot so thought it would be good here too, a way to get random challenges from codewars.
On sir lance
Their image
Ooh boy, i forgot the issue for pet bot, i will open it
Oh, apologies.
Please review rule 6
Okay.
so.โฆ
why the abstraction layer?
what advantage does it bring to have a layer between the database?
What are you asking about?
The Python Discord API is an internal API that serves as an abstraction layer between our Discord bot and our PostgreSQL database.The API is not publicly accessible, but only reachable from within our Kubernetes-cluster.
Well, there are certain advantages to using an API over SQL statements in general

