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.
#dev-contrib
1 messages · Page 89 of 1
i will read it. thanks.
Yea, that's the one I linked above 😄
scroll up
Like up
thanks a bunch for help.
i invited bot to server. he is in there. tho im getting some error in docker stuff
pywintypes.error: (2, 'CreateFile', 'The system cannot find the file specified.')
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_version
docker.errors.DockerException: Error while fetching server API version: (2, 'CreateFile', 'The system cannot find the file specified.')
[15168] Failed to execute script docker-compose
Do you have docker running?
🎉
i checked contri.RD file, there is no stuff about api call errors. am i still missing something?
What do you mean by api call errors?
You don't have the emoji on the server you're running it on
Ah, that's likely going to be the
emoji
You'll need to add the emoji or replace it in constants (or env if that was added)
As a note, we should probably make that an env var in lancebot
The cross emoji?
Where else do we use it lol
It's going to be the incident_unactioned emoji 
There are actually quite a few cross emojis
Yea, some use unicode emoji
\u274C, \u274e, incident_unactioned
!pban 786650529690157066 Self bot
:incoming_envelope: :ok_hand: applied ban to @warm musk permanently.
Okay, turns out I DO have to use the real Redis in order to properly test this PR. Running into this error still: https://paste.pythondiscord.com/kumaloxepa.py
It looks like bot is starting before redis is ready?
unless you're starting that seperatly first?
I think the implication here was that he has to switch from fake redis to real redis
in which case
that won't matter
Though admittedly it is trying to connect to redis, so I may have misunderstood
I started them separately
i have put \u274C, its fine right?
tho what can be permanent solN?
Just have it as a constant at the top of the file
okay so in pull, im supposed ignore these changes?
I'm a little confused, what are you doing?
future pull
I don't understand still. Are you trying to solve conflicts with the master branch?
Here are the steps I did for this:
- Tested using
fakeredis, realized I needed regular - Did
docker-compose downto spin the containers down - Changed the config file to have the redis configs be
host: "web"anduse_fakeredis: false - Ran
docker-compose up -d web redisand waited until it was running. - Ran
docker-compose up botand encountered the error almost immediately
yes. as i have made this change because i was having this issue, is it acceptable if this change comes on master as well?
Its hard to resolve the conflict without knowing the actual content of the files haha. Are you chaning which emoji is used?
Hi @gritty wind , would you mind quickly going over my pr on sir-lancebot?
Sure, I can give it a look over in a bit
Thanks
yeah
i have that already, just asking
Ah, fair enough
gah docker builds take forever
I run the bot locally and use localhost, but shouldn't the host be redis?
but what are you working on that requires it?
The stream permissions thing
The host for the site should be web and the host for redis should be redis
Got it, I'll correct it
fair enough
I'm testing to see if the PR properly removes the role after if it applied the role then had to restart before it could remove it
And I can't do that with fake
Okay, that fixed it. I'm double checking to make sure I just missed something in the contrib guide or if we need to tweak it
I think it's not on there, at least not in the config section
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.
Yeah it's not
Okay, I don't feel as dumb now
Would you mind adding it to the first section 
I will in a bit, have to use the little nerd's room
idea: can we make @stable mountain use fuzzy matching for the docs command?
There is an issue for partial matches
You can reload the extension
!reload ext_name
wdym partial matches?
Though not on sir-lancebot if that's what you're working on
Or
maybe it is
can't remember
.help reload
Query "reload" not found.
Should also be in lancebot
I'd guess the src doesn't see the root alais
okay that worked
thanks
@brazen charm how i'd imagine i would be useful is, you were talking/helping about something like overwrites, and you don't know the exact name of the class/object. you could just !d overwirtes
that would probably make the docs command much slower than it already is 
It should be possible, but there are considerations on how to achieve it as there are around 100k symbols which could result in many unwanted results with common keywords
The matching shouldn't be very intensive, currently it's slow because of an unnecessarily small cache and making requests to pages for every single item it has to fetch, a more robus solution is implemented in bot#1014
I don't know what the plan is for gathering facts
.topic
Do you know who originally opened the issue?
i did
I'd suggest linking the discussion Joe setup in the embed footer
i can't set a url in the footer
Yea, you should be able to
set_footer("[link text](https://link.com)")
hmm
nope not working
Ah, maybe just add another line at the end then
ok
.src topic
how do I reload en extension?
ok
huh
AttributeError: 'NoneType' object has no attribute 'cancel'
pretty vague 
That's the aoc
aoc
It is pretty broken
oh
I believe @hardy gorge was looking into this
oh wait, I don't think sir lancebot support root aliases, until my PR at least, so it looks like its a copy-paste oversight 😛
or a hidden feature
ok
This is nothing to do with your issue by the way, just something I noticed with extensions reload
what's this mean?
bot/exts/evergreen/pythonfacts.py:24:121: E501 line too long (144 > 120 characters)
bot/exts/evergreen/pythonfacts.py:25:9: E128 continuation line under-indented for visual indent
first one is your line is too long. Second is your continuation line isn't indented enough
Separate the long line into different lines
And indent the line to match up with the other indents
Into which part?
Markdown doesn't work for footers
In making sure that the aoc cog was properly unloading and could only get accessed during December
yeah apparently not haha
Right
I forgot about that
The changes currently required are fairly minimal
There's one command that requires an event to be ongoing that doesn't check it
And a task has changed names which wasn't properly applied to all references
I'd have to suggest making an addition field
riight
why didn't I think of adding a field to the embed?
@hardy gorge alright, do you still want to take care of it? I can do that this weekend otherwise
why can't i get under 120 characters
What does your line look like?
.topic
You could remove the first sentance
It'll be consistent with this then.
Otherwise I'd suggest soemthing like ```py
value=("Want to suggest more facts? "
"Suggest more facts here!"
)
@clever wraith honestly don't blame you at all for all the format changes haha
the docs are a pain
ok
Because having a consistent and healthy code style is important
ok
@green oriole Which command was the broken one again in AoC?
Hmmm
Not the None error
.aoc join
The Python Discord leaderboard for 2021 is not yet available!
I can't refresh actually
:x: Unable to fetch leaderboard!
I think it's actually on startup
It logs a missing token error
But I may be misremembering
I can't, I'm not on my computer, sorry
id review if I was a contributor 🙃
ok
Actually you are still welcome to review
oh?
it helps other reviewers, even if doesn't count
You may have seen @short snow's reviews around
You can, but not your own PR haha
It tells other reviewers that you think the PR is good
which is a helpful sign when looking over something
We sometimes even merge using a contributor review
oop
If you're failing on code length
you could extract ?utm_source=sir_lancebot&utm_medium=referral into a variable
Sounds like something you can store as a constant and use an urllib function to create
I don't mind storing it as a constant though
@gritty wind the lint passed
Hmm I'm not sure it complies with the style guide
the \?
nah
it would be name on a new line, and the closing parenthesis on a new line too:
add_field(
name="Author",
value=f"Photo by [{username}]({profile}" + rf + ") \
on [Unsplash](https://unsplash.com?" + rf + ")."
)
Also you're already using f-strings, I think you don't need to do string concat with plus
👍
I'm not sure if this is in the style guide or not, so I'm not going to enforce it, but I'd prefer if you avoid the break
you can built the value on another line, it doesn't have to be in the function
author = f"Photo by [{username}]({profile}{rf}) on [Unsplash](https://unsplash.com?{rf})."
add_field(name="Author", value=author)
that took too many edits haha
Alrighty, that works for me
awesome
I will ask you to fix the extra space in the embed description though because that is user facing
thank you
no problem, i thought i got that there
i cant believe how much things i messed up doing that!
Gonna spin it up locally to test, but other than that I think it's just getting the API approval now
lol I'll take partial blame for that
Off-topic channels
There are three off-topic channels:
• #ot0-psvm’s-eternal-disapproval
• #ot1-perplexing-regexing
• #ot2-never-nester’s-nightmare
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
!topic
Off-topic channels
There are three off-topic channels:
• #ot0-psvm’s-eternal-disapproval
• #ot1-perplexing-regexing
• #ot2-never-nester’s-nightmare
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
.topic
there
@clever wraith i don't understand your review
its for the styling of embeds
oh, 1, these are facts, not topics
f***
hang on
there
the add_field, not the entire embed
@clever wraith congrats! 🎉
Once @dusky shore says its rejoined in #dev-log you should be good to go
should be less than 1 minute
👀
exciting!!!
it's pretty much just waiting for the actions to run
hmm if things break
blame Joe
lmao
@gritty wind so how's my PR?
lol haven't had a chance to look at it, I was doing the earth one
I'll try and get to it before I head to bed
oh yeah, you're located in saudi arabia
ok
woohoo!
its on
lol sometimes it gives an image of an egg #sir-lancebot-playground message
I got a globe haha
something with people categorizing their images on unsplash
im happy with it
For future reference
Your PR stated closes issue 147 which didn't actually close the issue
It'd be something like closes 147 or resolves 147
@green oriole are you free/available to review my PR?
I am not until this weekend
oh ok
@clever wraith awesome job, thank you for the PR!
no worries
Thanks!
@clever wraith good job!
It was pretty fun!
thnks for the review too
no pron
prob*
@clever wraith merging the earth PR caused conflicts on the contants haha
haha
could you resolve them?
You can try and merge master into your branch, which would make git prompt you to resolve
Or you can do it online
so what do I click?
You need to go down to the area highlighted in red
and essentially remvove the >>>>>
Make sure the content of the file is correct, which in this case means adding the extra constant from master
sorry that it messed something up!
not your problem
well, git
whhops
haha the github conflicts menu can be confusing
I don't think I've ever actually used it, just used my local setup
that's been changeloged
hopefully we'll get a full unspash token soon so we can changelog earth
it takes 5-10 days is what ive seen
just a reminder that .earth is an alias, i just use it cause its shorter
The full command is .earth_image, yeah?
i believe so
.pyfact
Python Facts
If you type import antigravity in the Python REPL, you'll be directed to an xkcd comic about how easy Python is.
Suggestions
Suggest more facts here!
nice
is there a link to all the pyfacts
i'm going to clear the comments of the discussion and edit it in
.earth_photos @gritty wind
hmm it's in a text doc right now
oops
Alrighty, that's all I got in me for tonight. Grats to both of you, and keep up the good work 🥳
Night @gritty wind , and thanks!!!
how much time does pipenv run test take? Earlier when u used error out at RedisCache it took 30 seconds
but now when i fixed it
it is running from 20 minutes
Maybe a couple of minutes at worst
Hmmm, even if I re-run it, it takes the same amount of time
this only happened after i added id attribute to all MockMessage instances
......................................................................................................................./usr/lib/python3.8/unittest/mock.py:2030: RuntimeWarning: coroutine 'Infractions.apply_voice_ban.<locals>.action' was never awaited
Coroutine created at (most recent call last)
File "/usr/lib/python3.8/unittest/async_case.py", line 88, in _callMaybeAsync
return self._asyncioTestLoop.run_until_complete(fut)
File "/usr/lib/python3.8/asyncio/base_events.py", line 603, in run_until_complete
self.run_forever()
File "/usr/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
self._run_once()
File "/usr/lib/python3.8/asyncio/base_events.py", line 1851, in _run_once
handle._run()
File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
self._context.run(self._callback, *self._args)
File "/usr/lib/python3.8/unittest/async_case.py", line 102, in _asyncioLoopRunner
ret = await awaitable
File "/usr/lib/python3.8/unittest/mock.py", line 1342, in patched
return await func(*newargs, **newkeywargs)
File "/home/user/PycharmProjects/bot/tests/bot/exts/moderation/infraction/test_infractions.py", line 134, in test_voice_ban_mod_log_ignore
self.assertIsNone(await self.cog.apply_voice_ban(self.ctx, self.user, "foobar"))
File "/home/user/PycharmProjects/bot/bot/decorators.py", line 153, in wrapper
await func(*args, **kwargs)
File "/home/user/PycharmProjects/bot/bot/exts/moderation/infraction/infractions.py", line 366, in apply_voice_ban
await self.apply_infraction(ctx, infraction, user, action())
setattr(_type, entry, MagicProxy(entry, self))
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
....................................................
``` it displays this and then stops
If add id=123 to line 553 and 533 of test_incidents.py it stops
otherwise it doesn't
give me a ping if anyone knows
https://github.com/python-discord/bot/pull/1446 we need to stop this, the check is running from quite some time now
it is gonna eat up your github action minutes
waitt, nvm, we have unlimittted minutes
but why is this happening

Yeah, samething happened to me locally, look just above the link of the pr
^
Find out which tests are the culprits
here are the culprits Mark
Ok I don't see anything obvious but I can try to look closer tomorrow
Alright thanks
Right now the docs command group when invoked without subcommand just calls the docs get subcommand right?
Yes
@short snow It's related to events loops and the RedisSession object
I'm not exactly sure what's going on yet, though
But, I have a work meeting starting in a few minutes
Yeah no hurries, just ping me when u get back so I can be here
Basically, just not having to type out the entire name
I think you can suggest this idea on the on-going doc improvents
something like !doc search
was hoping to catch numerlor here. i'd suggested something similar before
bot#1014
They are here 🙃
It has already been suggested, was asked yesterday #dev-contrib message. I'll probably take a look at it after 1014 is merged but there are more things to consider with the amount of inventories present in the bot
alright 👍
@hardy gorge free now?
No, still working.
The issue is that the setup is creating another event loop while the RedisSession was originally initialised in a different loop.
It may seem like you're creating a new RedisSession here, but a RedisSession is a singleton to make sharing sessions within an application more easy
Another way of handling this would by using the asyncSetUp method of the test class
but it means that it would run before each test method
However, I've tested it, and it doesn't really come with all that much of a performance hit.
Which different loop?
There are two different testing modules that set up RedisSession in this way, right?
@clever wraith first thing before developing, please do git pull 😄
wat
If that’s what u mean
ok
So should use asyncSetUp of the test class? and how should i use it. Any parts of the doc i should refer to
Aight
Do you know how to fetch updates from an upstream origin?
@hardy gorge
Yep
I pulled last night, but there were 3 commits this morning
@vale ibex can u fix the merge conflicts on sir-lancebot#597
That should do it
@sleek steppe re you comment on the above PR, I've tried adding @commands.max_concurrency(1, wait=False) to the group command pfp_modify, but spamming .pfp_modify prideavatar 5 times still outputs all five
I send all 5 commands before the bot even responds to the first
@clever wraith the campaign's should be in yml, just a note
hmm?
oh right
ok
we should do reactions
That's what I was thinking, yeah
b/c sending a message every time for the path would be bad
@hardy gorge does the bot have perms to manage reactions?
Yee
.help
The way sir lancebot does the .help command
Campaign's will go in bot/resources/evergreen/adventure_campaigns if that's ok
ok
so, first things first, what's the story line?
My idea was heading into the temple of(insert name here) to steal the holy python idol(just a statue of the python logo) kind of like an Indiana Jones thing
But you can write a different one if you want
I made support for multiple campaigns
@vale ibex what's with the huge number as your status?
I'll give you a hint, 0x at the start of a number denotes a hex value
Hex isn't just for colours, it's just another way to represent a number
Try and convert it to text
Rick Astley's official music video for “Never Gonna Give You Up”
Listen to Rick Astley: https://RickAstley.lnk.to/_listenYD
Subscribe to the official Rick Astley YouTube channel: https://RickAstley.lnk.to/subscribeYD
Follow Rick Astley:
Facebook: https://RickAstley.lnk.to/followFI
Twitter: https://RickAstley.lnk.to/followTI
Instagram: https:/...
😄
Hey @clever wraith!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
oh
Usually the pastebin is the best choice
its too long for the pastebin somehow
huh, what are you uploading lol
It was a link to this https://dis.gd/threads /s
ok
nice idea!
let's get started
can I have write access?
I sent a contribution invite
@clever wraith not yet walking home I'll let you know
Sent contrib invite
It was a hexadecimal containing the entire bee movie script
lmao
ok
Pastebin didn't like
@clever wraith i didn't get it, or I don't know how to check
Interesting, it worked differently for me.
it might be due to the monkey patching we're doing for root aliases
I'll give it a go on a fresh bot when I get a chance
Check email
Odd, I just removed the monkey-patch and it still isn't limiting concurrency
So I'm guessing i'm doing something wrong somewhere
out of interest, are you running it on my PR, or on your own bot?
oh I think I can see the problem because I didn't have invoke_without_command=True
Now when I set it to True the checks don't actually work
hmm
I can work with that
So the interesting thing with this, is that there's a top level group, with some commands, but it also contains a subgroup, with some commands itself
the concurrency at the top level group seems to impact the commands against it, but not the sub group
Yeah but when it isn't True it actually runs the code inside the group plus the subcommand invoked.
I think, but let me try it out some more.
Yeah I think a custom check would be more suitable for this
How can I get add an emoji to the code like that? 🤔
https://github.com/python-discord/bot/blob/b34da23b925bcee132b98d5aa5e953ab6b4fe94e/bot/exts/fun/duck_pond.py#L211
If you’re on Mac, there’s a “Text” menu where you can select Unicode characters
On other OSes, I don’t know about the specific tools available. However, you can always copy paste emojis into the code. They behave just like any regular Unicode characters
If I copy an emoji from Discord it will display it as the name between colons
Yeah, discord is weird in that sense
Just put a \ before sending it on discord, and it should show up as the “actual” emoji
😄
\😄
ah, that worked, nice
Perfect 😄
thanks
Happy to help
but only if on pc it gets tough on mobile
Yeah, it’s not always consistent
That was a long PR.
Hey @short snow, how's it going?
I have some time now
I had to finish some work yesterday and It was finished a little bit too late
Gimme sometime, lets say 10 minutes and i will get back to you. Kinda busy with some work
No problem.
Ok am back.
Alright
Instead of what you're currently doing, we can also solve it in a different way
In your TestCase class, you add this:
class ...:
async def flush(self):
# Flush everything from the database to prevent carry-overs between tests
with await self.session.pool as connection:
await connection.flushall()
async def asyncSetUp(self):
self.session = RedisSession(use_fakeredis=True)
await self.session.connect()
await self.flush()
async def asyncTearDown(self):
await self.session.close()
you've named both the methods the same?
in TestIncidents?
shouldn't this be added to the setup? loop.run_until_complete(redis_session.connect())
How will it behave with fakeredis in this case, do you get a fresh / clean cache for each test?
i think so, since when there was no redis session in test_incidents.py it was getting redis intialize something something errors
looks like i need to update the discord message link on my repo
(#community-meta message) is also there
Thanks, oversight
No, you won't get that. I'm thinking of adding a subclass of IsolatedAsyncioTestCase to the package to simplify testing
That sounds like a good idea
oh to the package itself, even better
so this way the store would persist for the whole testing "session"?
There's already one in there, but it's not packaged with the package
it's only in the test suite that the package itself uses
what if we could add a main class to the tests which would contain all these sessions like Bot class, won't that also simplify stuff?
and these two questions about your code
shouldn't there be a if statement on the tear down function if the session is not initialized
That would be an odd thing to happen, because the set up method should take care of that
and about this and the question below it?
No, we don't have to create and run a loop because we can await connect here
this is already a coroutine that gets run before each test method
oh ok. And this should be added to TestIncidents right?
This is currently a solution that needs to be added to all test classes that rely on an actual (fake)redis backing
oh ok.
need some help with regex here
message_links = DISCORD_MESSAGE_LINK_RE.findall(str(message.content))
``` how i get it
@hardy gorge No class TestCase
u meant commandtestcase right?
No, just the testcase in which you need it at the moment
I don't think we need to do this for every test we have that doesn't rely on Redis
Just in your class where your tests are currently having issues with Redis
hmm, I think the way those tests are designed is that TestIncidents is a superclass that already provides some setUp methodology to the children
so you can put it there, but then you may be getting a redundant session that you won't use for each test
if you put it in the subclass, make sure that the superclass doesn't also have an asyncSetUp that you may have to call manually (because you'll be overriding it)
test incidents is child class of unittest.IsolatedAsyncioTestCase
oh now i get what u are doing
yes, but it doesn't have any tests of its own, it's only to provide the setUp to the children
so that they don't have to duplicate
but looking at it, it doesn't have an async setup, so it should be safe to just add it where necessary to the children
in this specific case maybe we could make the redis async setup a mixin, I don't know
well mock_session is a unresolved attribute, not there in the parent class
time to run the test...
@hardy gorge 🎉 Works like a charm!
welp one problem @hardy gorge 
ah thought so, we needed thatn if statement
Uhhh
https://github.com/python-discord/bot/actions/runs/627160537 shouldn't this be ignored?
why should the lint test be ignored?
not the lint test, it should ignore test/* dir ig (it is there in the tox.ini) and asyncSetUp iis the parent class function which we need to over-write so can't really fix it
Looks like the other instance of this function in the codebase has a # noqa: N802
But you should lint before you push smh
i thought it wouldn't be required since it is a change in test/ dir
you should still write good code in tests 🙂
run pipenv run precommit and it just won't let you commit if it fails to lint
Ok PR is up for review! And i have commented on 1/2 of your comments i don't were needed zig
how do u add commit body with git (CLI tool, not gh)
git commit -m "title here" -m "body here"
Or just don't write a commit message and it'll prompt you in a text editor
very small PR that won't affect many people but will make my day https://github.com/python-discord/bot/pull/1449
Just don't use -m at all, like @cold island mentioned. It will open a text editor for you to write your commit message in.
If you want, you can even configure git to use the text editor you want to use
or best, pycharm git commit tool 😄
That;s what I use
It has a summary line length checker (50 chars) and hard warp commit message body (72 chars) options built in that you can enable
where can i enable them from?
That's built in for my Vim installation as well, which is pretty nice
File -> Settings
Version Control -> Commit -> Commit Message Inspection
Limit Body Line -> 72 chars + wrap when...
Limit Subject Line -> 50 chars
Do u need to approve once again if someone made changes?
not really, it still would've counted my approval
But its probably good practice if there have been major changes
Or if you don't approve, you could dismiss or rerequest review
because you technically signed off on the old code, not the new
So in joe’s case there is no need. Since it is not a big change
I did it anyways, it doesn't make much of a difference
No need now lol
Just more of a: I continue to approve of this
on the PRs?
Depending on the project, I usually go with 72 on the subject too, as 50 is quite limiting and github will display 72 without wrapping
yeah I go 72 for the title as well
that's a configurable setting
Or do you just mean the labels in general?
on some of our repos new changes will dismiss reviews
Yes, like on pr changing status needs review to wip, etc.
where are you hitting it 👀
on the right
do we still use those?
yes
Haven't been active much this week, I now have time to do stuff
ty on update tho
Np!
@cosmic moat please stop playing factorio for a couple seconds and finish up this PR lol
@gritty wind poke https://github.com/python-discord/sir-lancebot/pull/595
sir-lancebot#595
ah
we never figured out what to do with that PR
it's a style change
I don't know if it works or not
into needs review it goes
Also tic tac toe is disabled now, so ¯_(ツ)_/¯
why's that?
Blocking things and stuffs
I see
@short snow everything has been updated. Bask in the glory that is, updated labels.
later today or tomorrow™️ i promise
ty
i've been without my dev environment for a couple weeks, which helps me procrastinate
awesome job
@vocal wolf i will tak over sir-lancebot#485
@short snow if you comment on that PR I'll assign you to it
done
If any coredev is here, need assignment here https://github.com/python-discord/sir-lancebot/issues/446#issuecomment-791545350
(Hello scal)
done
Cool thanks
https://github.com/python-discord/bot/issues/1059 Has good first issue and staus:planning, both are contradicting labels ig
Why do you think they're contradicting?
Well good first issue is something like a new contributor can start wokring on
but status planning is like it still planning and u can’t work on it
status:approved means you can start working on it
good first issue is just a difficulty gauge
It can still be a good first issue during planning, as new contribs can contribute to the discussion or push it forward
ah right
hey
so basically the python help channels get their channels name changed
i wanted to know
whats the rate limit
with the discord.py api
who can I talk to eg staff
The API isn’t from discord.py, but the point is
It’s not very high
We hit when we were smaller
It’s not viable at all right now
kk
@exotic ember Reviewed!
@vocal wolf reset your branch to the main, and then push your commits to it
will fix the commits from different branch
the thing is there was only one commit, I just needed to remove the unnecessary file. Also I thought the force pushes would combine into one.
I thought I saw that before, apparently I was wrong.
Yeah if I had multiple commits having each file this would be fine, but since there was only one commit, I could not do your suggestion.
I would probably just reset to a hash
and then do whatever
oh ok.
The first force push was me combining all commits into one, and then I noticed the other file lol
was an "oh shit" moment
lol
I think the contrib guide for bot may be missing a bit on the Redis host
I believe this should be set to redis when running with compose locally
I think hemlock was going to add that a couple days ago
If he hasn’t added it yet, I can add it in a little bit
We could also make it an environment variable and give it the correct value in the compose
that means people won't have to configure anything
Works for me
I have a suggestion for @stable mountain
do tell
Sometimes people test out their code on the server using the eval command. This is sometimes very helpful and some people wish to save the result.
The bot already reacts with a 🗑to delete the message if the user doesn't want it anymore. My proposal is to make the bot react with '💾' as well. If users react with this emoji, the bot 'saves' the message aka DMs them the same message. This might allow users to save the results for the codes that they test out on this server.
.bookmark <target_message> [title=Bookmark]
Can also use: bm, pin
Send the author a link to target_message via DMs.
There has been talks in the past about extending this feature though
Not many know about this tho
It's literally on another bot
It isn't very easy to save the message in this way
If the option is provided with delete option users are more likely to use that
That just requires a reaction directly on the message. It doesn't even require a command so users can instantly and easily save their msgs.
This one is for the eval command
Since many users would like to save those msgs
What if the code snippet was written by someone else?
Which is likely to be the case
I'm talking only abt the eval command so for example, lets say I did !e print("HelloWorld") and it sends out a message. I will have an option to delete that message as well as easily react with 💾 to send it directly to my dms.
This is obviously done for the commands that you type
but if someone else uses !eval and you want to save their message we can innovate on this by allowing others to react with 💾 and then that particular message reaches their DMs too. just to make it better, we can also have the bot to react with ✅ and ❎ after another user reacts with 💾 so that the user can confirm if they want to save it or not...
I’m alright with the feature if it only allows the original author to get the DM
But I’m very, very, very wary of allowing anyone to do it
DM rate limits are
Not great
And we need DMs for more important things
that was my idea at first as well
it should only be used for your codes
its a much easier way to save your message instantly and its only supposed to be used for the eval command
and after the user reacts to the message with 💾 both the bots and the users reactions are removed so that the user cant misuse the feature
At the same time, why not just use sir-lancebot’s book mark commands, and not risk getting rate limited on the more important bot
Right now, I can’t think of anything on @stable mountain that would easily allow a user to rate limit it
how will it become rate limited?
You spam a bunch of evals in a bot command channel
Then go back and click on all of them really quickly
You cause the bot to effectively spam you, which discord won’t like
And suddenly, we are unable to do some moderation actions
You know how lancebot deletes all of its reactions after the inactivity timeout?
Python could do the same if the user plans to use the command again
We can definitely add safeguards
But
I don’t see why when we can shove it somewhere lower risk
its easily accessible if we include it there
its like running a code and then going and taking a screenshot of it and then saving it instead of just directly clicking on the save button in your IDE
Except
We already have another form of save button
So that’s not a fair comparison
I think the book mark command allows you to do it for anyone’s code, and can keep the main bot safer
alright
with dewification the site is basically gonna be static? With no login/bot api,since API is a separate project now?
We’ll still have a django backend, but the site will be static from what I’m aware. The idea is to simplify things a lot
by things what do you mean?
The way it works. Like, we don’t need authentication and a database, considering what we do on the site. New pages be added with PRs instead
is the api going to be connected to the site atleast to manage interactions between the bot and the api?
Bot -> API (something.pythondiscord.com) -> Database
User -> Site (pythondiscord.com)
something like that
the important part is that the site and API will be different projects
@short snow do you still want bot#1423 ?
i can do it, but after 1 week or so, since am assigned to ~3 more issues
why not just use something like hugo then?
Ultimately the tech stack used will fall to the media team. Using Django still makes some sense since we can tightly control how content is displayed, for example loading in YAML and rendering the resources page from that.
We are using Hugo elsewhere in our stack so if it goes well it's something to think about, but I'm not sure Hugo is powerful enough for pythondiscord.com
We might at some point look into a Python-based solution that outputs static HTML because then we can do things like deploy previews which is a real nice way of working.
However, we've got several large rewrites on our hands at the moment, so I don't think we should complicate it when it can be avoided.
Hot swapping statics 
That's no problem. I was asking because I'm working on a related issue and can do it simultaneously
oh alright
If u wanna take it, go ahead!
when you're reviewing some code on github does it not let you add a comment to parts of code that haven't been changed? It doesn't seem to be letting me
Nope
that's seems pretty stupid ngl
cool, thanks
I am not 100% sure why, but my client let me do that
But I think I'm the exception
For example
It seems to let me go three lines up or three lines down from an edit, but I want to make a comment 4 lines down 😔
You'd need to use an external editor
oh interesting
Uhh it doesn’t let me
Hmm, pycharm doesn’t give me the + sign on non changed lines
Yeah
It also won't let you do expanded sections like github, but it's still a little larger
when u review a pr, u get the + sign and then u can comment
but in non changed sections it doesn”t
Quick question, I've tested the talentpool bot PR with the site one, and my only comments were really going to be about the style of the !tp search command results, i.e. it currently looks like this which I feel is a bit messy. Do you think changes to this would be in the scope of the PR, or would you want to do it along with fixing the tp list command?
What does the PR currently change?
it's this, https://github.com/python-discord/bot/pull/1445, so basically allowing multiple nominations at once
I guess it is fairly relevant, as the the changes from the PR are what has made it not that neat
my thoughts were a few small things like
- The "Nomination ID" for inactive nominations should be after status and date like with active infractions.
- "Actor", "Created", "Reason" would be a better order than "Actor", "Reason", "Created"
but I don't know if it might be worth messing around with some bigger changes to the formatting to neaten it up
I personally think getting the functionality should be the highest priority. If it’s easy to fix the styling, that would be great. Otherwise, I’d rather see it in a follow up PR
Those are really small changes, I don't mind either way or even a master commit
Makes sense, thanks. I'll approve the PR, mention them as optional changes, and I can always open a PR later if I want to change anything else.
I think we can make something work. @glass pecan has been working on polishing the infraction embeds, so maybe we can draw inspiration from that
yeah that embed is pree ugly, but your primary changes sound important too, so I'd focus on getting your primary stuff pushed first and have the formatting done later
it's defs a thing to do though, so might be worth adding as an issue ticket at the least so it's not forgotten
Yeah I'll keep the changes lean to not block the pr, and then we can bikeshed an exact ui
@patent pivot how do you feel about a tag for the humanize library?
not sure what it is
!pypi humanize
@patent pivot it's like arrow.humanize() but for more stuff
ah
a library that's pretty useful for converting stuff into human redable text
Hey, I found this thing https://www.gitpod.io/
Maybe we could set it up for lancebot or something like that?
seems like there's a free option for public repos
TL;DR it's a remote editor that sets up environment for you
There was an issue opened yesterday for providing support for it
I'm just unsure of adding editor specific support because
it's opening the floodgates slightly
I use GitPod for my own repos. Can't use for PyDis stuff, because not enough permissions.
What's the max characters in a message a bot can send, 2000?
Yeah, I think that’s it for regular messages
Embeds have some special limits as well
These are the exact limits for embeds https://discord.com/developers/docs/resources/channel#embed-limits
@patent pivot what do u think of the tag idea?
fine by me
ok
Thanks
Do we have a function or something for splitting text across multiple messages and posting it?
We have a paginator, if that’s what you’re looking for, like in the help command
Hmm I'm looking for something without an embed, but I'll check how the split works there
Alright. I don’t know if we have something for splitting it up, that doesn’t use an embed. Sounds like a good idea to check the source code
I think that was ne
Me*
Yeah, and I’m getting more and more convinced that we should have a hidden gems video on Textwrap
That's not a bad idea.
How does reddit bot automatically post the embeds to other channels, i added announcement option to my dev-log channel on a test server and it didn't happen. Like i get share with followers option everytime i need to do it manually
https://discordpy.readthedocs.io/en/latest/api.html#discord.Message.publish you probably are looking for this
hmm, what if i want to do it the github webhook?
like the #dev-log channel
webhook you don't send to?
still same method
just look for the message in on_message and figure out if it is in the channel, is the message you want to publish etc @short snow
oh alright. thanks
I need some help investigating some relatively-advanced Docker stuff
I ran into a roadblock and spent hours investigating it but couldn't find an explanation to the behaviour I was observing.
Is it possible to store objects within the Redis cache?
Such as a message or channel object
No. You have to serialise them.
they are only locked to certain data types
like the id of them the message in your case can be stored
right
Here's the problem: I have two separate run commands, but for some reason, the second command prevents the cached layer for the first command from being used.
# Pipenv installs to the default user site since PIP_USER is set.
RUN pipenv install --deploy --system
# Install numpy when in dev mode; one of the unit tests needs it.
RUN if [ -n "${DEV}" ]; \
then \
pipenv install --deploy --system --dev \
&& PYTHONUSERBASE=/snekbox/user_base pip install numpy~=1.19; \
fi
Where DEV is a build arg passed to Docker. If I build with it and then without it (or vice versa), it will always run the first command again instead of using the layer from the previous build.
There isn't enough documentation on how exactly buildx determines whether a layer is valid or not. I thought it just checked if the command was the same.
I tried using a tool to inspect the layers and they came up as 0 bytes on this specific step for some reason??? I don't really remember. If anyone has any leads on this, let me know.
I have no idea, but I can discuss it with someone from work who knows way more about docker than I do. I'm just not sure how soon I'll be able to talk to them.
Thanks, I appreciate that. It's not urgent, considering I've sat on this for like a month already.
What would be the best way of serializing a discord.Message object for storage within a Redis cache?
pickle?
Let me get the context for this
Speaking of context, for my Docker issue, here is the build output https://paste.pythondiscord.com/raw/eyajuvoton and here are the commands I'm running https://paste.pythondiscord.com/raw/dehulolito with this dockerfile https://paste.pythondiscord.com/raw/tujalawawo
Notice how some parts of venv are cached, but as soon as it reaches step 3, it refuses to keep using it despite the previous build creating a layer for it.
@tawdry vapor Did you try moving the ARG declaration to between the two RUN commands?
ARG variables are not persisted into the built image as ENV variables are. However, ARG variables do impact the build cache in similar ways. If a Dockerfile defines an ARG variable whose value is different from a previous build, then a “cache miss” occurs upon its first usage, not its definition.** In particular, all RUN instructions following an ARG instruction use the ARG variable implicitly (as an environment variable),** thus can cause a cache miss. All predefined ARG variables are exempt from caching unless there is a matching ARG statement in the Dockerfile.
I was looking at your file and that was my guess, because Docker can't know if a command run using RUN uses an environment variable
this seems to back it up
but I can't test it here on my work machine
Yeah, I forgot they are implicitly environment variables too.
Thanks, I knew I needed a 2nd pair of eyes on this.
Waiting for the build...
Yes, that fixed it.
Good catch
Hey are you still gonna provide context or did you figure it out?
I will be providing context, I just got sidetracked with squashing
@tawdry vapor the current PR that I'm working on is https://github.com/python-discord/bot/pull/1414. It adds a message at the bottom of #❓|how-to-get-help, showing the currently available help channels. kwzrd suggested that I add Redis caching so I don't have to set the variables every time on startup, since they'd instead be ready for me in the cache.
The current problem I'm facing is here:
https://github.com/python-discord/bot/blob/71ea5a6c9e6f3f4c09ee1b4b26fafb8e31e9ffbf/bot/exts/help_channels/_cog.py#L506-L511
Since self.how_to_get_help will still be an ID after the first block, the .history method will throw AttributeError. I thought it may just be better to instead replacing some API calls with putting the objects directly into the cache instead.
Nice, glad I could be that second pair of eyes.
@vocal wolf If you know the content, the channel ID, and the message ID, you should be able to edit the message directly
The API call only requires this information: https://discord.com/developers/docs/resources/channel#edit-message
Discord Developer Portal
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
No, you're using a message object to edit the message there by locating it
If you're going to keep track of the message ID of the last message posted by the bot (but think about what you're going to do if this cache is somehow stale or incorrect) and the channel ID (which is basically what you're doing if you were to cache an entire message object), you can just store the channel ID + message ID.
And then use the underlying API call to edit the message.
you can set the channel id, and then get the channel id while editing the message
self.bot.http.edit_message(channel_id, message_id, content=fresh_content)
You don't need an entire message object as a wrapper
I completely looked over this in kwzrd's review, sorry about that
I see what I must do, thank you @hardy gorge!
Wow this simplifies everything by a great amount
Redis caching is something else
and this
Thank you, @hardy gorge and @tough imp for helping me with this PR, especially with the implementation of the Redis cache.
'Tis no longer a draft, and can be seen here: https://github.com/python-discord/bot/pull/1414
bot_1 | ModuleNotFoundError: No module named 'pythonjsonlogger'
uhh even when i did pipenv install
Happens to me as well. pipenv --rm then pipenv install only sometimes resolves it.
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
You are attempting to remove a virtualenv that Pipenv did not create. Aborting.
Aborted!
did pipenv install pythonjsonlogger as a temporary solution
uhhh
Error: An error occurred while installing pythonjsonlogger!
Error text: Looking in indexes: https://pypi.python.org/simple
ERROR: Could not find a version that satisfies the requirement pythonjsonlogger
ERROR: No matching distribution found for pythonjsonlogger
✘ Installation Failed
!pypi python-json-logger
you shouldn't have to install manually though
doesn't work with install
what virtualenv are you using? pipenv is saying you're in a virtual environment it did not create
am using pipenv, venv made by pycharm when u slect that, and i am inside (bot)
are you sure Pycharm is using pipenv when creating the virtual environment? you should be able to check it in the project settings
it doesn't seem to work with docker, even after installing manually
i can screen share in dms to show you if u want
sure
yes, it shows on bottom right corner Pipenv (bot)
try docker-compose up --build
noice!
🎉
It shouldn't be in the same category
@short snow hey, you mentioned you tested emoji cog, correct?
yes
would you be able to have a quick squiz via mobile client on the output of a certain command for me?
cheers. it's when you do !emoji count asd
and if it outputs the invalid embed
it should show a list of valid categories
Oh, i have alread tested that with jasonnn instead of asd
Yeah it works
it shows the list of categories
yep. does it render correct on the mobile client?
not sure about that, do u have a mobile rn? i can quickly send u a invite
i do
and sure
feel free to dm me
confirmed a bug but i'm thinking it shouldn't block the PR tbh, especially as the bug is hardly noticeable + it's applicable across many of our command outputs
i'll make an issue ticket specifically for the bug to be addressed as a separate thing
What's up?
Ah, no
I have 3 of my own PRs that need to be reviewed, all relatively small except the last one:
https://github.com/python-discord/bot/pull/1453 - Purge ban message update
https://github.com/python-discord/bot/pull/1452 - PyPi message deletion on error
https://github.com/python-discord/bot/pull/1414 - Dynamic #❓|how-to-get-help message w/ Redis caching.
Things were changed, yes.
Am using https://en.wikipedia.org/api/rest_v1/page/random/summary to get random wikipedia articles, how should i give the question. Currently i use description but it is not sufficient to get the correct. and extract contains the answers in a lot of places
my idea is to use extract.replace(title, ""), is that fine?
@vocal wolf my computer should be good again today, if i have time, i'll finish it tonight
i left a message for fix last saturday
i don't know if they read it yet
i'll check that when i work on this
I have a suggestion
You can add an embed visualizer command
so that people can see how embeds look like
Title, description, colour etc. can all be separated using a |
We do have an !embed command, but we limit it to mods to avoid users faking to be the bot
yeah I imagine main use people would have from it is to try and break our rules with it by things such as advertising their servers and what not
there already are way better UI/UX wise tools online for that either way
for evaluation of python code
There are many IDE's that users can use instead, even on web
not for just making bot send plain text/embed
it is useful for help sessions
to show expected/result of a code snippet
Ye makes sense
It is easier in this case to have the output directly in Discord
Also we do run the filters on the snekbox output
I see
theres also is a big output difference between eval and embed
!embed most people might not even notice who invoked the command, especially if it was deleted
most people might not even notice who invoked the command, especially if it was deleted
it can easily be taken out of context
cool
hmm
Maybe you can add a text
Add a text just like how you do for the eval command
@User Here is your embed
anything that goes against the rules would be moderated I guess
generally no bots have an open-to-everyone command that allows people to send text/embeds via command
other thing being, it isn't really a thing that'd be much of a use outside of projects such as discord.py bot
Honestly there are ways to get around most of these issues, but whatever we make will just be a discounted version of the embed visualizer sites
We probably won’t give it full customization like color, title, fields etc, because it’ll be clunky to use over IRC
why dont you add an embed colour to all of @stable mountain's embeds?
cc @obsidian patio as the orginal author
Adding some (maybe blurple) default color would definitely be nice, but I think that would be best implemented using something like bot#1348, so we keep things DRY