#dev-contrib
1 messages ยท Page 78 of 1
but if u are not into your virtual enivornment?
Yeah it's based on your project
since, when u update your pipfile, u need to run pipenv lock
- You don't, it does automatically if you install
- It's based on the project, so as long as you are in the same directory as the pipfile, it'll work correctly
bump
An issue was opened for it from sentry
Feel free to tackle if you think you've got a fix
Hmm or maybe I'm misremembering
.issue 1369
[404] #1369 Issue/pull request not located! Please enter a valid number!
Right, uhh I think the error handler might've eaten this one then
In that case, do you wish to open an issue for it, or should I?
u can go ahead
oh i didn't, this is the one pipenv seems to have made
In that case pipenv should be available within the environment
Does running pipenv after deactivating work?
Let me try, one second
Vsc tells me that pipenv isn't on path
do i add the pipenv executable to path?
I guess you could try?
this worked
oh, i've seen people here have some issue due to line endings or something? what is it supposed to be? vsc says I'm using CRLF right now
That's windows' default
Most programs use LF
That being said
If you commit CRLF files, git will automatically convert to LF
and MacOS use CR because standards
It's just that the linting will change them all to LF as well, so it might appear as though you have changed all files
That won't make it to github though, it'll be fixed before then
You can set your git cloning settings so that it clones in LF
Oh right
iirc while installing git it had asked me to pick what to use
i have no idea what i picked
Then its probably a good idea you set it up now and reclone
before you start working
If you left the default, it is CRLF
Although it is a setting you can set per repo or globally
Alright
I'm not sure how it would even work per repo, because it is done at clone time, and you can't set repo overwrites till you clone
git config --global core.autocrlf input will use whatever the repo uses for all your git clones
alright done, thanks for guiding me through this :D
You can pass a --config argument to git clone, or change the checkout ending https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---configltkeygtltvaluegt
Oh thanks for telling me
is there no lancebot equivalent to !ping of @stable mountain ?
There isn't, I don't think there's really a need for it
fair enough
But there's uptime 
.uptime
I started up 2 days ago.
hmm why does isn't it more specfic
sir lancebot's enemies must never find out when he sleeps
.issue 1355 bot
I've commented here, could I get assigned? Looks simple enough
Are you anand2312?
yep
I've assigned you a while ago, but didn't know who to ping lol
Yeah go ahead and start
Oh, thanks (I've changed my nickname here now)
I have a doubt; how do I get the helper role ID?
is it constants.Roles.helpers?
Also, this is what I had in mind:
@staticmethod
def is_helper_viewable(channel: TextChannel) -> bool:
"""Check if helpers can view a specific channel."""
helper_role = channel.guild.get_role(constants.Roles.helpers)
overwrites = channel.overwrites_for(helper_role)
overwrites.view_channel ...
channels where the overwrites are either None or True are both viewable if I understand permissions correctly
do i check for both cases? or are all the channels explicitly set to one option (true/false)
That would work, but I'm unsure how discord handles implicit permissions
I'm assuming the moderation channels are invisible to everyone, with explicit read permissions for moderators
If it isn't explicitly set to either True or False, discord.py sets it to None - https://discordpy.readthedocs.io/en/latest/api.html?highlight=overwrites_for#discord.PermissionOverwrite
In that case that should work
oh, what would be the "neat" way to do write that though?
(overwrites.view_channel is None) or overwrites.view_channel is what immedietely came to mind but that doesn't look nice
If it's none, helpers can't read it, and we want to treat it the same as False, no?
Actually no that won't work
You'd have to check the overwrites for @everyone, and @helpers so it works in all channels helpers can see
but from there, you can just return
everyone.view or helpers.view
The intersection of those two permissions are the channels viewable by helpers
You can then group the none with the false
Right, let me try something like that
smh
Or at least that's why my pr on 1309 was closed
Did the issue occur again within the last 20 days?
yeah
Interesting, that might mean 1309 isn't a duplicate
but in that case you should have a pr ready to go ๐ค
Hmm yeah I don't see how 1016 solves the issue
I think this is how it works; and leaving it as None means the user can see the channel unless they have some role which is explicitly denied those permissions
Also, intersection of channels everyone can see and channels helpers can see - should just be the channels the helpers can see right?
Well here's how I believe the setup to be:
python general - everyone
staff-social - helpers
mod-social - mods
None of these channels have explicit permissions except for the role listed besides them. The channels visible to helpers explicitly are only the staff channels. If the permission returns None on the other two channels, there'd be no way to determine if the channel should be used or not
If you combine everyone and helper role, you can make it work for public channels such as pygen, and staff channels, but not mod channels
Right, so I'm just gonna do this. Thanks.
Also, should I be making a branch on my fork to which I commit these changes?
Yeah, that's usually a good idea
This gist does an alright job of explaining the fork-and-pull workflow
It's completely cli, but you can do most of the steps on the github page too
Oh alright
@patent pivot GH bot seems to not be detecting reviews again
oh yeah the bot is gone, we discontinued that
๐ญ
I think it was decided that if we wanted to do that we'd use actions
Well, I liked those labels
Seems premature to discontinue the bot when we don't have an alternative in place yet
If they were used I can certainly bring it back
When I run pipenv run lint, it said it failed flake8; how do I see what went wrong?
It should be printed with the rest of the error, how are you running it?
yeah
oh no I meant it is on my main py3.8 install, it doesn't work without the python -m, says pipenv isn't a recognized command
So the flake8 thing iirc just calls pipenv run flake8, so if it isn't installed it'll error out
How were you installing flake8 again?
Oh again was just a figure of speech
And flake8 was a brain fart lol
how did you install pipenv when you got it to work
Deleted my old python install, reinstalled 3.8, pip installed pipenv
Then set up pipenv environment in pycharm
Hmm in that case it should've installed the pipenv command to your base system
Is python installed on the user or system?
What's the difference?
Oh, I think I installed python now on the system (it's path is now in C:/Program Files/Python/python38)
does on user mean when it is installed in the Users/... folder?
I know where the pipenv executable is, should I add it to path?
Is it under C:/Program Files/Python/Python38/Scripts
Nah it's in the Users folder I think. Does this mean I have another install of python on the user as well
yep it's in User/.../AppData/Roaming/Python/python38/Scripts
Possibly, but the more relevant part is that it did the pipenv install on your user, not system, which is why it isn't added to path
You could manually add it to path, but that might cause issues
Do you see a pip.exe here?
pip, pip3.8, pip3 all there
Perfect, could you try running the install from that then
(in an admin cmd)
C:/Program Files/Python/Python38/Scripts/pip.exe install pipenv```
That should hopefully get it installed and added to path
Let me try that
After that would I have to do pipenv install and everything on the project again?
I think your pipenv environment will still exist
but you should hopefully be able to do pipenv command directly now, instead of adding python -m
Which should also fix the linting issue
do windows users need to use pipenv-win or something?
nvm, I think that's for pyenv
I'm using pipenv fine, but his problem seems to be not having it installed on sys
I think you are installing pipenv to the virtual environment
Ok i'm a bit out of ideas now, but you can try adding to path ig
The simple fix is to just add the user scripts directory to PATH... It doesn't matter if it's installed to the global site, the user site, or your desktop. Just add it to PATH and it would've fixed the issue.
and not as a global package
He's using the absolute path to the base pip
no idea what that means ๐
but does it install packages globally?
Not necessarily, but it's using his actual pip, so not a virtual env
Editing environment variables should take effect immedietely right?
Oh right lmao
Nice, that worked. Thank you!
https://github.com/python-discord/bot/blob/eccbebf8f29998dcee72b690ed405221363a984f/bot/exts/fun/duck_pond.py#L110
https://github.com/python-discord/bot/blob/eccbebf8f29998dcee72b690ed405221363a984f/bot/exts/fun/duck_pond.py#L83
Is it fine if I make the type hints uniform? There seem to be two functions where it's type hinted as discord.Message and the rest are Message
Actually, cc @hardy gorge, you mentioned we could replace the GitHub label bot with GitHub Actions, is that possible?
and if so, where do we start
It should be, depending on the kind of labels you want
same as we had before, needs 2 reviews, needs 1 review, waiting for author
Shouldn't be too difficult, although I've had a few glitches before. I'll write something tomorrow or so.
will it be merged then?
I think so, I am going to leave an approval and ask someone to squash the commits
do i have to create a new pr because it was disapproved and didnt passed the cases.
ok thank you for helping me in this
Sure thing
If you wish to contribute to our repos again, can you please have a read over these documents https://chris.beams.io/posts/git-commit/ ?
!pep8
PEP 8 is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide.
You can find the PEP 8 document here.
sure i will check it out
@green oriole lol I'll review this
also squash/merging is apparently not enabled in sir-lancebot
Hey @quiet gull it isn't mandatory, but have you considered adding this part too?
Additionally, you can add a try/except around the input section, to report invalid input and stop the bot from failing the game.```
@gritty wind can i do this like-
try:
return grid[number-1][index]
except:
return "invalid input"
Preferably you'd wrap it around the entire code that could generate an error, which is pretty much the whole function.
If you put it around line 262, you can wrap the whole function. Also, shouldn't be there, you should send a message to the player (you can see an example on line 247 and 248).
You can also see how to structure your try/except/else in that code block so you can ask for input again if the input is invalid
If you're not interested in implementing this suggestion, feel free to say so and we'll get your contribution merged ๐
Still looking for reviews on these two https://github.com/python-discord/bot/pull/1346 https://github.com/python-discord/snekbox/pull/88
The following race conditions were fixed:
User claiming a second channel while their first channel is in the middle of being claimed.
Multiple people claiming the same channel (this was accounted ...
A nice issue to familiarise oneself with the bot's code:
https://github.com/python-discord/bot/issues/1373
@gritty wind
should i ask them, which tokens would they want?
like react to ๐ ๐ต ๐ข ๐ด ๐ก etc.?
Nice
Hmm, sure go for it
also, i didn't understand your last review comment
The one about returning?
well if that would be good or not, since it would make the game longer and add another 30sec check per user
If you return at this point, you can simplify a large portion of this function. You'd be able to remove all the code that checks for a full column, and all the code that tries to break out of the loop, and the return at the end.
this one
Honestly that isn't even my main concern, instead it just feels like needless complexity, and I'm not sure how much of a demand there is for it
Use your better judgment here, I don't think its necessary, but if you want to do it, go for it
for row_num, square in reversed(list(enumerate(column))):
if not square:
self.grid[row_num][column_num] = player_num
coords = row_num, column_num
break
else:
await self.channel.send(f"Column {column_num + 1} is full. Try again")
full_column = True
if not full_column:
break
return coords
and
So here is what I'm thinking
There are only 2 things that happen here, you either return coords, or you loop in the while loop again
These four lines
full_column = True
if not full_column:
break
return coords
Are not really necessary
(As well as the break)
You can cut it down to:
for row_num, square in reversed(list(enumerate(column))):
if not square:
self.grid[row_num][column_num] = player_num
return row_num, column_num
await self.channel.send(f"Column {column_num + 1} is full. Try again")
Can you take a screenshot with that?
Take your time lol
theme?
You can call it that
fruits - ๐ฅ ๐
lemons -

ducks -

python -

What if you just take two optional emojis in the command?
That way you can pick your tokens, without adding any time to the game
what they put nsfw emjois? or emojis that the opponent won't like?
On the second part, that one feels a bit irrelevant, as the token isn't too big a deal, and if it bothers you that much, you just don't join the game
On the first part, can't the bot only send default emojis, and emojis from this server anyways?
If someone wants to be childish, let them
And I think this also hits some of the same points as ^
board size then emojis
I think it's easier to enter a number to get to the emojis, than it is to enter two emojis to get to a number
ok
the only problem: non server emojis
Yup, we don't want non-server emojis anyways
First check if the bot has access to the emoji
And if doesn't send an error
you were too fast, ty
lol no worries, always feel free to ask
For whomever merges lance#564, make sure to squash the commits
@tawdry vapor I'm looking over 1346. In terms of the channel getting closed at the same time as the dormant close, we were discussing the possibility of making the bot not close the channel if it detects typing (in #community-meta).
Would that be an alternative solution, and if so, wouldn't it be a simpler implementation?
No it just leads to a bigger 3-way race condition
The close task will be scheduled regardless so the typing event would be racing to cancel it
Right, but you don't have to cancel the scheduled event, you can add the check in the close function, and reschedule if it needs to
That still has the exact same race conditions currently present
Fair enough then
@gritty wind changes pushed
and changes mentioned
also, we could link them in the footer (The open trivia db)
Alright, thanks. I'll give it another look in a bit
Don't worry about those for now, its just a reference for later. I personally don't understand much about licencing myself so
aight!
to open issues on features, are we supposed to tell them here, or we can directly open issues?
or to make some commands, more better
feel free to open issues, it's nice to discusss on github
ok.
was thinking of:
- displaying summary of the options of wikipedia command.
- hangman game.
Those would be two separate issues, correct?
yeah
What are the options for the wikipedia command?
.wiki python
.wiki python
1 Python (programming language)
2 Monty Python
3 Burmese python
4 PYTHON
5 Ball python
6 Reticulated python
7 History of Python
8 Monty Python and the Holy Grail
9 Python (genus)
Enter number to choose
Oh like the results
Sorry, but you cannot do that, I will only accept an positive integer, You have 2/3 chances left
using paginator
Okay, go for it
Sorry, but you cannot do that, I will only accept an positive integer, You have 1/3 chances left
how do I exit this
Sorry, but you cannot do that, I will only accept an positive integer, Please try again by using .wiki command
ok its done
Hmm, why would it be saying that?
Well it's the bot env
Hmm it should be available when run then
I tried installing the precommit hook
can you try manually running it pipenv run pre-commit
or is it pipenv run python -m pre-commit
one of those
that is the command I used
The first thing that came to mind was an unactivated env but the first line looks like it is; did you install the dev dependencies?
I ran pipenv install
I believe it only does normal packages by default, try sync/install with --dev
Ah, in that case try following Numerlor's idea
Ok, that worked. Thanks! @brazen charm @gritty wind
Hey! This channel is for discussing the Python Discord repos. Feel free to claim a help channel ( #โ๏ฝhow-to-get-help or #discord-bots) if you need help ๐
Please review the #rules, especially 3 and 7, which pertain to following staff instructions and keeping channels on their respective topics. Thanks!
Can anyone give a PR review for any pull request?
yes
Okay
@eternal owl sure, will do that on the wikipedia, on mobile so no login to github.
๐
is there a issue open on the formating of the reddit webhook already?
whats wrong with the formatting ?
#reddit message the bold
the one with Im_joesph and it breaks the formatting of the others then
Damn @brazen charm that was fast haha
I should have marked the PR as draft
We are looking into the size issue
There is an issue for unescaped brackets in the post bodies, but solving that probably isn't going to be exactly trivial unless every link in them is escaped (and broken)
hmmm k
Normal styling Markdown should be simpler but it'll still need to handle escaped markdown etc. if it's done properly
can we get https://github.com/python-discord/bot/pull/1346 merged?
Thanks
When was the JSON check removed from pre-commit?
I was looking at
https://github.com/python-discord/sir-lancebot/pull/562/files
And these should not be allowed to pass linting as is
@Scaleios#8200 yeah even i did that, but if we keep the difficulty level to medium, then the questions which come out are relatively good
(sorry for ghost ping in media)
(for open trivia db)
Why no ping command for @dusky shore ?
what's the purpose of it?
we have ping on @stable mountain to do a rough infra check, and even then most of our infra monitoring is done through other tools
infrastructure
how about putting Loading... message before .spookify and such commands since they take time, and when they are done, the msg are just edited
!ping
88.663 ms
1.183 ms
116.843 ms
so atleast the user knows about that
@dusky shore Starts typing
that's where we use typing indicators
wew ks is too fast
Yes, this takes very long time to generate images
sometimes
I've been looking at constants.py in sir lancebot and am wondering, what are the benefits from inheriting from NamedTuple?
Is it to make the class immutable?
Its the same as collections.namedtuple
You create an immutable class that you can type hint, yeah
It's a pretty common practice for something like that
You also have typed dicts in the typing module
Makes sense, thanks ๐
Hey @pulsar salmon!
Our current setup should be working without any issue but here is the issue
We currently have around 27k infractions in our database, and if we try to search for something like " ", it will try to send back 15k or so infractions, and it won't work
Well, it would technically work but it will run into physical limitations first
So we need to make sure that we won't send more than 50 infraction back
If you want to test this, you can create 6 dummy infractions and try to limit the query to 5 infractions, and test that
Thanks @green oriole I will try doing that.
@gritty wind since the discord emoji check doesn't work for default emojis, i would need to implement it on my own which is a 4000 character regex
so should i still do the part or skip it?
The easier solution would just be to union it to discord.emoji, and one letter strings
Since that's what all emojis will fall into
If it's > 1 character, you can fail the conversion, and if it is 1 character, but like a letter or whatever, it isn't a big deal
(I'm also seeing a bunch of much shorter regexs, but this isn't such a crucial feature to warrant getting into that)
@gritty wind code pushed, the earlier one had problems in the emoji check
This needs a review please https://github.com/python-discord/snekbox/pull/88
#sir-lancebot-playground message this should be taking the full name right?
should we add this to http_cat?
like:
.http cat <error_code>
.http dog <error_code>
bump.
Dogs
I'd really like to see .http dog command.
the problem it is not included in python library, so we can use aiohttp and a regex to get them all
https://httpstatusdogs.com/img/200.jpg We can just change this status code
am checking for available ones
like when it is not available we say, that wrong statuscode
.http_cat 999
#bot-commands message for this
we check in the list of correct ones right?
.source http_cat
We can use same strategy
so similar, we would need to create our one list usng aiohttp, to get the codes
there are different from the cat ones
some are missing ig
should i open a issue on it?
or just make a pr
Sir Lancebot contributing guidelines requires issue
oh
https://github.com/python-discord/site/issues/391
is this still a go?
Hmmmm
Potentially not, since were splitting out the features that need subdomains into different apps
staff subdomain => logcord
api subdomain => separated API
What about the new apps using sub domains? Forms for instance
Iโm not aware of any using the siteโs auth though
that specific issue is just for removing site subdomains, yeah
we use a tonne of subdomains internally which are fine
but like, we don't want api.pythondiscord.com, pythondiscord.com and staff.pythondiscord.com to all be handled by the same app
because that's chaos
especially for local dev setups
weird all my cogs get loaded but the bot is offline
zeero errors
nah was my net problems
#discord-bots message hmm need some help in this, dunno why it happens
What are you doing when itโs raised?
nvm, found it, was using the for loop variable instead of the list to which the results were appended
Scaleios can u have a look at my pr when u are free of c4
Yeah, Iโm planning to get on that soon
hello fellow pythonistas
In #sir-lancebot-playground the command .scarymovie isnt working
please check it out yourself and see
should I open an issue in github? or wait until a response is given to the above messages?
Its in the halloween cog, so I'm assuming it just isn't loaded right now
it seems to trigger typing, and it's help command works, I don't think that can happen if the cog is unloaded.
Hmm, that's true
I can't test if there's anything broken with it because I don't have an API key, perhaps someone in devops can check sentry
yea its shown that "sir lance bot is typing..." and then after 2 secs it just disappears
the halloween cog only executes commands in October iirc
That's what I thought at first, but the cog is loaded, and there don't appear to be any seasonal checks in the scarymovie file
hmm ok so it's just the reactions that are limited to October
we don't seem to do logging for lancebot, so it'll have to be debugged
@gritty wind regarding the quiz questions, do you think it will be a good idea to use Open Trivia DB ?
To do so would be to trust the moderation of the people running it, and I can't make that call on my own
Hey, does anyone know how to implement LimitOffsetPagination to limit the number of queries returned? I am a beginner and trying to contribute to resolve an issue. I feel like I should use the paginate_queryset method but I am feeling abit confused navigating through the viewset code. Any advice/ suggestion will be great. Thanks
On GenericAPIView subclasses you may also set the pagination_class attribute to select LimitOffsetPagination on a per-view basis.
seems relevant from a cursory look
For the internal cog, self.interpreter is not being used, so why is it there?
most likely a missed line during a refactor
why do we even have helper interpreter?
not sure what you mean by that?
https://github.com/python-discord/bot/blob/abe439e801eac508cd1b4daa0b67dcd5c5ab549a/bot/interpreter.py#L15
Where are we even using this?
we probably aren't
then why does it exist lol
well, we probably were using it, then did a refactor that removed the need for it, but didn't get rid of it
dead code so to speak
can I open pr removing it?
sure
till when does a issue get approved/rejected?
It'd probably be worth looking at making int e use it, the cog is a bit of a mess and abstracting the run logic away would help
It'll depend on the issue, but usually things get approved once any discussion about their necessity or specs is out of the way
ok
had about porting commandnotfound suggestions, status dogs, and improving wiki command
If they both have issues open, they will be dealt with sooner or later
(cc @vocal wolf as our resident triager :D)
Sorry, I've been really busy lately, I'm getting around to issues/PRs though.
Lol it wasn't a dig, those are pretty recent issues
I've been focusing on reviving really old issues/PRs
working backwards lol
I'll check out the recent ones tho
ok np.
@vocal wolf there is a typo in the dog status issue. it is
Since dogs have some codes missing, we will use
and not
Since dogs have some comes missing, we will use, will fix that

does anyone have the regex for getting the message inside a single/block codeblock
need for the automatic linking issue on sir-lancebot
!source snekbox
Unable to convert 'snekbox' to valid command, tag, or Cog.
!source [source_item]
Can also use: src
Display information and a GitHub link to the source code of a command, tag, or cog.
is it not called that anymore? Anyways the source for !eval should have something like that
!source eval
Run Python code and get the results.
or do you mean linking to the snekbox repo
!src Snekbox
Safe evaluation of Python code using Snekbox.
ah
Would it be possible to support searching for comics by name?
No.
Well yes, it would. But it's not actually possible.
yeah...
Without like recording the names and their respective numbers
since no one even knows the real name of the strips
yea, we'd need to store a reference to each comic to allow that, since xkcd haven't implemented a search
We might be able to get that information from some website
Also, I'm not sure if XKCD titles are unique?
I think it would be just easier to go by number. That's what we usually reference them by.
I think they are unique, but not everyone knows their actual names
There is this though https://github.com/adtac/relevant-xkcd
which might be cool to implement
So rather than a title, it takes a concept
I feel like that would be unnecessary for one command.
oh yea for sure
this would be super cool :0
@rapid swallow If they do implement a search feature, I'll be sure to put that into the bot.
alright ๐
the current server command only shows online and offline members but this
https://github.com/python-discord/bot/pull/1166 pr, shows all online, idle, offline and dnd.
Do we really want to show all of those instead of showing only online and offline?
!server
Server information
Created: 4 years and 16 days ago
Voice region: europe
Features: BANNER, COMMUNITY, DISCOVERABLE, PARTNERED, VIP_REGIONS, WELCOME_SCREEN_ENABLED, VANITY_URL, MEMBER_VERIFICATION_GATE_ENABLED, PREVIEW_ENABLED, INVITE_SPLASH, ANIMATED_ICON, RELAY_ENABLED, NEWS
Channel counts
Category channels: 26
News channels: 8
Text channels: 154
Voice channels: 15
Staff channels: 61
Member counts
Members: 136,870
Staff members: 88
Roles: 86
Member statuses
32,583
104,290
The screenshots are outdated
right
@vale ibex ty โค๏ธ
I will take a look
What discussion is going on in dev-voice currently?
Was redis stuff, now it's just silence
keyboard silence 
do we want another reaction to cancel the game(call it a draw) before the game actually ends?
if it is User vs AI, then only the user needs to react, if it is User vs User, both of them have to react
@cold moon
Not sure is this necessary. Game will be cancelled after some time. This may be future improvement.
yea, I think 120s is kinda too long? its not a game where we would spend that long to think
?
Maybe then 60s?
I make change now
Change made
What yall dicussing?
approved @cold moon ๐
@cold moon anything else to commit? If not, we can merge.
Ready for merge
alright
Should there be ability to choose your tokens on the ttt command.
In dev-voice we canโt join but in media we can, hmmm
Y so?
so the player who invokes the command gets to play first
they are treated as player 1
dev-voice is restricted to contribs
the ppl with the contributors role
oh @Scaleios#8200 became a core dev but it wasn't stated in #dev-announcements
Hey why aren't we able to exit out of .ttt?
What do you mean? Cancel the game?
No cancel the game
It was a possible suggestion. Do you want to give it a shot?
Hey
`@client.event
async def on_member_join(member):
await client.get_channel('#795719602691637319').send(f"{member.name} has joined")@client.event
async def on_member_remove(member):
await client.get_channel(795719602691637319).send(f"{member.name} has left")
`
can i use this
for simple welcome message
?
Hey if you'd like help with your own discord bot, check out #โ๏ฝhow-to-get-help or #discord-bots
This channel is for pythondiscord projects
oke
Thatโs not what i mean, in the tt command, the tokens are default to x and o, how about making them be choosed by player (optional) for example: .ttt

Until vsc decides to co-operate and change the goddamn font, i can't work on anything.
So, I can work on it when vsc decides to co-operate if someone else hasn't already.
Hey, can I get the table creation query for the infraction table?
https://github.com/python-discord/site/blob/master/pydis_site/apps/api/models/bot/infraction.py
here is the model @late wolf
pythondiscord.com - A Django and Bulma web application. - python-discord/site
you can make out from the django model, right?
whats wrong with vscode, lol
I think keeping the default is nice, but I guess having the X and O be a different color from the numbers should make it better visually
Oh just got it fixed, i downloaded the font but didn't install it and i was getting mad at vsc for not changing the font, 
cant
just reinstall vscode and delete all the prev configs
I can't figure out the table structure from this
Hey i never requested review from @ks123#9814 but why did github automatically do that?
This is why I use docker for all the DBs but
-- auto-generated definition
create table api_infraction
(
id serial not null
constraint api_infraction_pkey
primary key,
inserted_at timestamp with time zone not null,
expires_at timestamp with time zone,
active boolean not null,
type varchar(9) not null,
reason text,
hidden boolean not null,
actor_id bigint not null
constraint api_infraction_actor_id_ed96dde9_fk_api_user_id
references api_user
deferrable initially deferred,
user_id bigint not null
constraint api_infraction_user_id_8714e9f5_fk_api_user_id
references api_user
deferrable initially deferred
);
alter table api_infraction
owner to pysite;
create index api_infraction_actor_id_ed96dde9
on api_infraction (actor_id);
create index api_infraction_user_id_8714e9f5
on api_infraction (user_id);
create unique index unique_active_infraction_per_type_per_user
on api_infraction (user_id, type)
where (active = true);```
still left to go through the full pr m_cht, but yeah did some part of it.
So before when we did !help tempban we didn't get a response back, but rn we do.
Why was this changed?
iirc previously if you couldn't run a command, it simply wouldn't give you help
now that info is in the help embed (that you can't run the command)
it is how help system works in d.py as well, if you can't run a command chances are you don't need to know it exists
That's how it was before, then it just didn't give the help embed, and now it's back to the previous behavior
#python-discussion message shouldn't !server command be whitelisted to bot commands and ot,meta only?
oh why doesn't help(list.append) work in snekbox but works in repl??
Right, I think it is because it is part of the site module, which isnโt loaded by snekbox
!e
import site
site.main()
help(list.append)```
@green oriole :white_check_mark: Your eval job has completed with return code 0.
001 | Help on method_descriptor:
002 |
003 | append(self, object, /)
004 | Append object to the end of the list.
There you go
oooh so we need to add site to snekbox allowed packages??
We use the -S option to not load it, so I assume that thereโs a reason for us to not load it
There are some details here https://github.com/python-discord/snekbox/commit/dd307c793588cdbfb5f759a91f337299a842f05d
@exotic ember has requested changes on https://github.com/python-discord/bot/pull/1372 , but the ensuing discussion seems to suggest that I don't have to be making any changes. Should I be doing something? Or have I misunderstood it, and I need to be making changes?
@balmy sparrow I misread the function, your PR is fine. Give me a bit and I'll get it merged
Cool, thanks :D
https://github.com/python-discord/bot/pull/1383
This is also ready to be merged
Merged!
Thx
What exactly is Sentry in terms of @stable mountains code?
Sentry is errors catching service
It is https://sentry.io !
thx, leme check it out
good service
For our redirect_output decorater why do we not use commands.check() but make it accept the function?
Also, why do bot about rather than just about?
The goup has only command, why use group if we are only gonna have one command?
and bot doesn't show up in the help command, why?
both of those commands are hidden
might be why
but why can we use them then?
hidden != usable
They are pretty useless tbh
to be fair, I haven't heard of bot group before
I think its a subject to be deleted
Right, why are they hidden?
Maybe instead of using group we could use subcommands?
as I just said, I haven't even known of their existence so its hard for me to tell
or just make it about
group is subcommand system
can't imagine what kind of info could go there to be fair
But it supports multiple subcommands, whereas subcommand only supports one IIRC
theres no difference
there is only one subcommand system in d.py
which is group
subcommand decorator means its a subcommand of group
group means its parent command and group of commands
group is bot subcommand is about
@balmy sparrow while testing I found another potential issue, sorry for the false promise of a quick merge 
my b
haha that's alright, i'll check in a sec
Can I open a pr, making the about command not hidden and not making it a group
I think should be discussed more in depth in an issue first, it's probably not necessary at all; I doubt it had a significant amount of uses recently
k
You could open it, but if weโre discussing removing it entirely, it probably wonโt be approved for a while, if at all
Iโm on mobile, so I canโt search it atm
What cog is it?
!src Utils
A selection of utilities which don't have a clear category.
I will wait until it gets discussed then.
Hey Guys , so i managed to run the docker
And the image is also running now
2021-01-25 14:17:18,964 | 9 | gunicorn.error | INFO | Booting worker with pid: 9
Now what to do , i mean where is the snekbox code
Thanks
If thatโs the snekbox container you started, the http end point is documented in the Readme
After docker this https://github.com/python-discord/bot/blob/master/bot/exts/utils/snekbox.py ?
it is running on http
Wait if you started the docker compose of the bot, you should be able to interface with snekbox directly or through the bot
i started the snekbox server
This
Ok, so what do you need to do now?
I just want a eval bot @gritty wind , so this is the only required file ?
Yeah, but youโd need to add a bot to load it and run
And if it has imports from the rest of the project, youโd need those too
The whitelist and channel stuff is needed, but it can be ripped out
Let me try to highlight the necessary parts
Ohh kk , thnx in advance ๐
Youโd need all the imports on lines 1 - 9 (12 if you want to reuse the discord components). 22-39 are input parsing so youโd need those too unless you want to write your own. 46-49. Youโd want most of the class itself, but you should remove line 283 (maybe even 282), and you should set the URL of snekbox on line 61. You can keep everything after the class too
This is only the cog though, youโd need something to start the bot itself
Happen to ping me if you guys reach to a conclusion on what to do with the bot about command
Hmm. Maybe a GitHub link?
!src
duplicate of ^
Yeah
#dev-contrib message
this too
Hello!
With reference to https://pythondiscord.com/pages/contributing/bot/#using-docker, I believe Docker isn't mandatory, right?
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.
Docker i not mandatory for any of the projects
That being said, it does make certain aspects easier
Like the databases, the site, snekbox, etc
But you can run everything on your host
The bot is probably the project where it helps the least, but the site can be a pain to set up without docker depending on the os
I would honestly recommend you to use Docker for all of our projects, at least when possible
๐
Nice to meet you once again!
With reference to https://pythondiscord.com/pages/contributing/bot/#environment-variables, is it fine if we use only the BOT_TOKEN and BOT_API_KEY variables?
If so .env file will become:
BOT_TOKEN=token
BOT_API_KEY=key
Also, how to acquire the BOT_API_KEY?
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.
For most features you technically only need to specify the bot token
I see, thank you.
that is assuming you're running the bot using docker
For now, I am running it locally
I assume I need to use all the variables then?
And that might be the reason for the cause of this error?
from async_rediscache import RedisSession
ModuleNotFoundError: No module named 'async_rediscache'
looks like you just don't have the package installed.
What is your reason for starting up the bot?
Oh this, I had this issue
There's something wrong in the dependency install step, I think, in the docs, because I got around this I believe by disabling the included redis setup. That, or there's something I missed, which is very likely
Hmm
I can restart into my linux if you're free to help troubleshoot?
Sure thing
kk, here goes nothing
alright, syncing up my system and its a slight bit of a mess so ~10m
resetting back to the original state
Currently getting an libffi.so error
just isntalled updates, so gonna reboot, see if I can force upgrade my python to 3.9 and try again
python's at 3.9 now so the reboot changed osmething, but still broken on libffi, so forcing a reinstall via pyenv
Well, this sucks
Why does pip install --upgrade pipenv leave me at pipenv 2018.*.* 
conflicting pipenv versions, fixing
Ok, I had to manually purge a version fo pipenv I don't know how got on my system >.> but its settup up now
Fighting virtualenv again ;-;
Why does it keep calling into python 3.8. My python 3.8 doesn't work.
Ok, after manually navigating into ~/.local and purging the broken virtual environments it seems to be working
reinstalling dependencies with pipenv sync --dev
Alright, I'm not getting the async redis error anymore for the moment, but I am throwing a "Connect call failed: cannot assign requested address" @green oriole if you have some insight here
I threw up a use_fakeredis last time I used this to get around it, but that feels wrong
Are you talking about the bot or lancebot?
bot
Also the bot uses 3.8 iirc
My 3.8 is broken, so I bumped the pipfile up to 3.9. Was getting this error before all that happened, so I don't think it's related
Why on earth is it still using 3.8 for the bot if I changed that
Might be related to your config file
I just realized the docker container is firing up with 3.8
that probably isn't related though
Yeah it's probably fine
The 3.8 error is a ctypes .so error and this is just a binding error
What is your config under the URLs section
Should be basically the default
web:8000, etc
The erroring bind is defined at the top, 6379, for redis
host localhost
If you're using docker then the only variable I can think of is the config. Maybe try copying the version on Notion
Where under notion would it be?
found it
Home expands, that was not obvious
ah, so the config has fakeredis on
ModuleNotFoundError: No module named 'arrow'
how do I force it to
TIL
And that will probably fix it
errored on api.localhost, which makes sense, let me reset that part of my config
Ugh, what did I do to fix that
It's searching for api.web:8000 which isn't dns-set for me
but it's no longer breaking on redis or arrow, which is good, thanks
Youโll have to start the site before the bot
The bot will start faster than the site, and error out
Hm? Why? It should start both
try dcoker-compose up -d web and docker-compose up --build bot
The startup sequence for the site is longer than for the bot
I opened an issue about that
Doesn't apply here, I'm getting a dns error despite starting the site manually first
Weird, I never had this issue
Hmm
cant connect to api.localhost:8000 basically
You are starting the site using GHRC container, right?
docker-compose up web
I'm on 134a2c61...
I changed the site: &domain to web:8000, but it continued to error
OK, this time it didn't
I changed nothing but now its failing with "improper token" and I at least know probably what that error is
Cool
I mistakenly erased my .env file, so time to fix that 
TIL if your window is too small there's no indicator that your token is cut off
alright, came up just fine
I'm sorry I did not understand your question.
I installed the package async-rediscache
I found a solution for this error. A new error seems to appear now and that is, from bot import api, constants ImportError: cannot import name 'api' from partially initialized module 'bot' (most likely due to a circular import)
Not sure where I am going wrong.
@green oriole "The Automatically linking issues using repo#number in messages" pr is ready for review.
Saw that, thanks!
one more question, for testing prs, like currently am testing iceman's, do we just copy paste their code into ours like on a branch called testing or something, and then test it.
or ...?
checkout their branch
what if it is not the main repo?
I use this git alias from Mark to do it quickly cpr = "!cd ${GIT_PREFIX:-.} && git fetch upstream refs/pull/${1}/head && git checkout FETCH_HEAD #", to do it manually you just have to fetch the pull head and checkout
and does it accept categories?
#bot-commands message the inline coceblock check fails here (from bot/filters)
You have the code
โfrom bot import ...โ
In a file titled bot, which causes a circular import
The bot package has to be ran as a module if you're not doing that
python3 -m bot or pipenv run start โคด๏ธ
What are you trying to use the code for?
If you just want to see how the bot works or write some feature, then I strongly suggest you do it with docker. It sets everything up for you
And there should be no reason to change the code just to make it work - it should already work as is.
They were repurposing the snekbox code for their own bot
So I donโt think this is applicable
Well, then you don't need all of the code and dependencies, just the eval cog.
!source eval
Run Python code and get the results.
You only need to use this file, although youโll have to change some contants and things like that.
Theyโve had that since yesterday, but they were struggling to decouple it from the bot
ig they are writing their own snekbox instead
and the messages below that, ๐
Can someone send me their bot config file for the bot test server? I lost anything that wasn't checked in when I wiped my computer.
I wish to write some features
And using docker right now
A question. I'm looking at the bot's code, and I see quite a few cogs with class attributes, but they are only used in the context of self. Is there any reason why they can't be instance attributes initialized in init?
It's not like we ever have two instances of the same cog
Do you have any example?
I donโt see any class attributes in incidents
defcon hasnโt been updated in a while though, and is bound to reach the sun
Well I'm updating it right now lol
Was this meant for me or... ?
I had a quick look, and it seems like the only class attributes are redis caches, which need to be class attributes
What are you doing to the poor defcon?
Why?
We use the attribute name in order to know their unique name
Finishing my open pr
Whose unique name?
The redis cache name
For example, if you have a cache assigned to Zig.zebra, it guess that it should load the cache of this specific entry
Ok
Does anybody know anything about this?
#dev-contrib message
Can you give a github link to the function?
And what is your proposed change?
I wasn't proposing a change, I was asking why do aren't we using commands.check() but rather take the command function itself
When I type docker-compose up, this error shows:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "docker-compose", line 3, in <module>
File "compose\cli\main.py", line 67, in main
File "compose\cli\main.py", line 123, in perform_command
File "compose\cli\command.py", line 69, in project_from_options
File "compose\cli\command.py", line 132, in get_project
File "compose\cli\docker_client.py", line 43, in get_client
File "compose\cli\docker_client.py", line 170, in docker_client
File "site-packages\docker\api\client.py", line 188, in __init__
File "site-packages\docker\api\client.py", line 213, in _retrieve_server_versi
on
docker.errors.DockerException: Error while fetching server API version: (2, 'Cre
ateFile', 'The system cannot find the file specified.')
[5156] Failed to execute script docker-compose
Do you have docker running?
I've gotten this error several times... every single time it was because I forgot I didn't have docker actually running
systemctl status docker to see if it is
systemctl start docker to start it if it isn't
(assuming linux)
I am on windows cmd
yea, that's from when docker-compose isn't able to connect to docker via docker socket
Do you have docker desktop installed?
Yep
Do you have it running?
No
That'll be why ๐
Yeah ๐
Just look out for the happy whale in your taskbar
It's not used on a command
when I do pipenv run start, a new cmd opens but the bot is not running. Why?
I double checked the bot token
Can you try running another command through pipenv
For example
pipenv run pip list
This is what I got
Package Version
---------- -------
pip 20.3.3
setuptools 51.3.3
wheel 0.36.2
No in the same window
The whole opening in a new cmd thing is weird, but the error may be caused by not installing. Try running pipenv install --dev
The result is still negative ๐ฆ
Does anything get printed?
Nothing
Ok hmm
Try pipenv shell to log into the virtual environment
Then try python -m bot
Error:
No module named bot .__main__; 'bot' is a package and cannot be directly executed
Inside acer and file named bot
Ok go the bot folder
Make sure you see Pipfile in that folder
(Also make sure to exit your current environment first by typing exit)
Yes, I see
Run pipenv install --dev and pipenv run start in that folder
:incoming_envelope: :ok_hand: applied mute to @wraith kayak until 2021-01-26 19:16 (9 minutes and 59 seconds) (reason: chars rule: sent 3252 characters in 5s).
Hey mods, can we get that lifted
!unmute 728987928591728802
:incoming_envelope: :ok_hand: pardoned infraction mute for @wraith kayak.
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
This error is caused by not having redis running locally
You can either run it through docker
Or use fakeredis
We could default to fake_redis, and make it an env var :D
+1
If you want to do this right now, make a copy of config-default.yml, call it config.yaml, and change use_fakeredis on line 10 to true
(How to setup your config file is explained here: https://pythondiscord.com/pages/contributing/bot/#configure-the-bot but it's pretty much what I just said)
True is case sensitive?
I don't think so
not in yaml, no
Looks like that is solved now but now I get this error
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.pytho
ndiscord.local:8000 ssl:default [Connect call failed ('127.0.0.1', 8000)]
For reference:
config.yaml
urls:
# PyDis site vars
site: &DOMAIN "pythondiscord.local:8000"
Yup, that's because the site isn't running
The easiest way to get all the dependencies running is to use docker
(You can manually set everything up, but that would take a bit of time)
Do you have docker?
I tried installing in linux but not working successfully so decided to do it manually.
Well docker can be a bit of a pain sometimes, though I admit I haven't heard of it not working on linux. Either way, the only other app that needs to be running for the bot to start is site
Setting up the site project is detailed here https://pythondiscord.com/pages/contributing/site/, though if you want to give docker another shot, we can try and help you debug it
Let me try to setup docker again on linux and will get back right here. Thanks for helping me ๐
The main error when I write this command is:
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
Error:
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 12, in <module>
from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 28, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
What OS are you on, and what steps have you run so far?
I haven't setup docker on a linux distro before, but I'm looking at this page https://docs.docker.com/engine/install/
Ubuntu 18.
I am currently in the 3rd step under SET UP THE REPOSITORY
I had a similar issue, I solved it by used the automatic install
I guess another solution would be to check the apt_pkg install
So apt install python3-apt
might need a sudo or two in there
Oh I successfully installed. ๐
Now I think set up a path to the bot files and do docker-compose up --no-deps bot?
Well the whole reason we went through the trouble of installing docker was so you can use the deps
Doesn't make sense to disable them now
you should be able to start everything up with docker-compose up
You can add -d to detach it from your terminal too
Ok, thanks ๐
I think that's mentioned under the bot only section
so its fine there
https://pythondiscord.com/pages/contributing/bot/#site-and-bot
The one above it doesn't mention it
Hmm I see
Hi, I'm working on Infraction result limit. I'd setup the server and ready to roll, but getting confused regarding db structure, like how to update db with dummy data.
tried with admin panel but didn't figure out
I would say the easiest way would probably be to hand out actual infractions if you have the bot setup.
If not, the data in the DB is probably not too important, just that you have a few infractions. Are you familiar with SQL and inserting into tables at all?
In the API administration user can't be added
Opened an issue for it, but left it in planning stage for now. Added a couple solutions there
What if you go to https://api.localhost:8000/bot/users
Hmm if you set the Auth header you can do a post request from here
There are total 6 infraction and the default page size is 4
Successfuly installed docker in linux and is running but now I get the following error :
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
I think that is it or something else need to be changed
Try:
sudo service docker status
If it says offline, sudo service docker start
I just did sudo docker-compose up and looks like it worked
But this the output I get at last
System check identified no issues (0 silenced).
web_1 | January 26, 2021 - 21:35:24
web_1 | Django version 3.0.11, using settings 'pydis_site.settings'
web_1 | Starting development server at http://0.0.0.0:8000/
web_1 | Quit the server with CONTROL-C.
```Is it?
You're up
but the bot isn't online ๐ฅฒ
I'm not sure if this is looking at the full container, or just the site one
disconnect your terminal and check the status
It says active running in green
For all the containers? Is the bot listed there
Oh that's the docker enginer, not the actual containers
docker container ls
oh
STATUS PORTS NAMES
e23a19f89b0e ghcr.io/python-discord/site:latest "python manage.py ruโฆ" 8 minutes ago Up About a minute 127.0.0.1:8000->8000/tcp bot_web_1
b39417e58c7e postgres:12-alpine "docker-entrypoint.sโฆ" 8 minutes ago Up 2 minutes 5432/tcp bot_postgres_1
8589936a46cf redis:5.0.9 "docker-entrypoint.sโฆ" 8 minutes ago Up About a minute 127.0.0.1:6379->6379/tcp bot_redis_1
0bc29b6c54d4 ghcr.io/python-discord/snekbox:latest "gunicorn -c config/โฆ" 8 minutes ago Up 2 minutes 127.0.0.1:8060->8060/tcp bot_snekbox_1
Hmm yeah the bot itself is missing