#dev-contrib
1 messages Β· Page 149 of 1
Like this?
Yeah it does support emojis
Yeah but does it support mentions
try and see it
Only one way to find out
I don't think it does, and even if it does mobile is awful at mentions in embeds
!int e
from discord import Embed
ctx.send(embed=Embed(title=ctx.author.mention))```
you mean author
There
!int e
from discord import Embed
ctx.send(embed=Embed(author=ctx.author.mention))
In [13]: from discord import Embed
...: ctx.send(embed=Embed(author=ctx.author.mention))
...:
Out[13]:
File "/bot/bot/exts/utils/internal.py", line 180, in _eval
res = await func()
File "<string>", line 6, in func
TypeError: __init__() got an unexpected keyword argument 'author'```
should be embed.author
happy late realization
class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if itβs within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").
For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
!src user
Yeah it is title
Title is something else isn't it
!int e
from discord import Embed
ctx.send(embed=Embed(title=ctx.author.mention))
In [14]: from discord import Embed
...: ctx.send(embed=Embed(title=ctx.author.mention))
...: ```
oh right
await
yeah
!int e
from discord import Embed
await ctx.send(embed=Embed(title=ctx.author.mention))
In [15]: from discord import Embed
...: await ctx.send(embed=Embed(title=ctx.author.mention))
...: ```
Yeah since there are two lines
I have to say, the name discord being taken by a dead library is pretty annoying
At least that's not their PyPI name
oh it's not?
!pypi discord.py
its discord.py
I don't know if that's better or not
Ah yeah
A mirror package for discord.py. Please install that instead.
bruh
Never mind, they take both names
Well we don't need it, just thinking of how future code will look like. discord.Embed looks super nice
but anyways you can still name it discord if you don't use the discord.py lib
you just can't use the pypi index name
It does confuse some IDE that the name of the PyPI package is different from the actual module
@brisk brook is this fine?
Yeah that's much better
I managed to get it working in the end, so the time has come, the first endpoint on the new API! api#25. I would greatly appreciate if someone could take a look at it (mostly the test suite. I'm concerned about it, however it tests the core features of the API and omitting DB calls the same time. π )
I like how the contribution graph is just a union of Seb's and Dorsan's contributions
That's a lot of changed files. Seems you went with DB in test suite in the end
Nope, I did not. π
I just changed on the flake config, a few of the models, created a module and an init file, the test files and such.
Yeah, and of course, the linting workflow π
The test mocking part took up most of the time actually π
Well :3
So, in order to override a dependency in fast api you have to import it.
And there was a chain of imports, I'll have to take a look at it actually.
Hmm I wonder
Do you think you could get it working without that? Possibly with some flags on the imports? If we do that, we don't have to worry about a test accidentally using the real DB, since it'll be checked by CI
Yeah, actually I have to move a few things and it should work. Give me an hour or so! π
I appreciate you being so flexible lol
it's all about being flexible π
@patent pivot do you think it would be feasible to have metricity track voice channels
My most basic idea is to have it track how many users are in VC, and make a new entry when the number changes
Perhaps buffered so we don't get like 30 entries in like 3 seconds
possibly? Iβm not a huge fan of it though, itβs making metricity more time series which is what we wanted to avoid
we get some data from discord on voice usage, for those sorts of things Iβm more inclined to say graphite is a better choice, but Iβm not entirely sure
server insights gives total listeners and speakers over last 28 days I think
yea, I guess it would just be an incr on join and decr on leave?
Ooo dorsan opened reminders PR, that reminds me of my otn issue, i will do that soon
but volcy's pr should be merged before any of the others... otherwise the functionality won't do any benefit
yea or gauge if we want proper accuracy
Is it possible to make a generic dependency override? Because we would be using this on all API endpoints...making duplicate code
I don't think so. The overrides differ on each test case. I can't create a general one.
Hmmm, I will give it a shot while I am working with the otn endpoint
Of course, but, if you override the database session to return a specific value when a specific argument is passed because that's what the test case needs.. I can't really think of a general solution that could cover all cases.
Drop all data after each test? keep everything else same
All data? π
I hate to disappoint you π¦ , but I couldn't find a proper way to do it. I wanted to patch the create_session method so that it won't fail when imported, but by the time it gets patched it'll be already imported and I couldn't find any workaround, like monkeypatching the environment variables or similar, because of the same issue.
I was actually thinking more along the lines of conditionally importing it in the main file
Unless it needs to always be imported in that?
Actually, it has to be imported in order to override it. That's a FastAPI convention. (I guess π )
That's the source of the problem, actually.
So, to better explain what I'm trying to say:
if os.getenv("Testing") == "true":
session_factory = mock_session
else:
engine = create_engine(settings.database_url)
session_factory = sessionmaker(bind=engine)```
that's not how you paste code 
I see, I actually thought about that, however I thought using a mock object (or Mock or whatver) in a non-test file is "against the conventions".
But, if it's okay, then I'll happily push a patch π
Idk, it might be π
I guess I'll check, but it really should only run in a testing context
Yes, I believe so. π
So, what's your opinion
I believe, it shouldn't be a problem. If we come up with something better along the way we'll change it, however that's the only solution I see.
Alright, you've been working on API for a while now, and I'll trust your judgement
we'll change it
yeah true
@brisk belfry your time has come bot#1928
I pushed a commit, it seems to work! Thank you for the suggestion! π
Oh I got confused, and thought you weren't going with this idea
Thanks for all your work
!remind 15H Review api PR
Your reminder will arrive on <t:1635842516:F>!
Btw. I went with using normal sessions rather than AsyncSessions, since it's still not advised to use it in production environment. (As far as I know! )
Oh, cool
i think you just have to do it once
you can uh
echo "$(poetry env info --path)/bin/python3"
smh
what i sent would work too
~~No, they're mine π ~~ Literally every endpoint, except Reminder and OffTopicName. π
no, it will generate a too massive diff for nothing, we decided to not change them unless a PR is already working on the file when we migrated to 3.9
what does it look like if that converter fails?
if you pass an invalid value to the converter
We don't define that, Discord.py does
since it's the thing that does the conversion on built-ins
actually doesn't the error handler modify that behavior a bit
Yea, I'm more talking to what error is raised
So that when it comes to the error handler, it behaves the same
bot/exts/backend/error_handler.py line 89
elif isinstance(e, errors.ConversionError):```
You're the one with the changes locally, you tell us 
@clever wraith I think you missed the new PR one
Wait
I think I'm thinking of the wrong PR that I have
Yeah, I am
It's a different PR that got merged
So I just need to change my PR to use Literal
@clever wraith did you test to see if the noqa is still needed?
Using typing.Literal may fix the bug with flake8
Wherever we had allowed_strings we needed a noqa comment because of a bug in flake8 @clever wraith
what was the noqa:
@fallen patrol F722
!flake8 F722
You are not allowed to use that command here. Please use the #bot-commands channel instead.
π
since when is that a command
@clever wraith F722 syntax error in forward annotation
lmao
i actually
it's because flake8 thinks the strings in the allowed_strings call are forward references
rm -rf $(poetry env info -p) && poetry install
will regenerate it
ye
i actually use poetry but don't use poetry, if that makes sense
okay like.... i maintain a requirements.txt file
but wrote a script to generate it, from poetry.lock
and to activate my env, I have source $(poetry env info -p)/bin/activate in a script that i run to set up my env
installing 100 dependencies
ah
i have uh
over 100 for my project
although i've read that ppl don't lock their lint deps into the project
because they use pre-commit
black doesn't support all of 3.10 yet
mmm snekbox
I'm not sure. I would be up for it, but it's not my call. Open an issue so that we can discuss it. π
@clever wraith have you poetry install --remove-untracked?
what's the problem?
You do need to do that, but why?
so you opened two PRs from the same branch?
Right, you opened from main
well, since there are comments on it I'd rather not close and re-open it
Left a review on bot#1929 @clever wraith
Turns out the # noqa comments aren't necessary with typing.Literal
mmmmmyes but github would see that as a merge
@rapid igloo I've addressed your reviews on sir-lancebot#919 π
Would appreciate another re-review
should be all good now, I'll just test it functionality locally and submit a review
Sorry, had got busy.... yeah, all data... after each test delete all the data present in each tables
I don't think names are needed for check-toml, etc. If no names are given, it would use the id, and check-toml is quite straightforward
loggging statements should start with a capital letter right?
Also, is debug level logging statements be visible in prod?
I think @patent pivot might know
don't think so
Ah thanks, wanted to confirm it π
@molten perch Could I base my otn endpoints branch of your PR?
It might change in the mean time, though.
yeah, that can be handled π
@molten perch Do you have push perms on pythondiscord/api ?
If you don't, tell me I'll make sure you do haha
Cuz I wanted to keep the merge branch of my PR as yours and that's not possible if yours is based of a fork branch
Unless you PR to Dorsan's fork, you indeed cannot
yeah even backticks don't work, that's why I need to use ' if I am committing it from the terminal and not an editor... is there a way to disable/escape it
in fish I can use \ to escape
also, you should(always) be comitting with an editor not -m :P
I mostly use neovim to commit, but sometimes they are really short so I just commit them in the terminal
you don't use pycharm's git integration?
Depends which project I am working on (I only use pycharm for some of my projects)
I think so. π
Well, if it is possible, could you base your PR of a branch on the repo?
I could, but actually my pr is migrating a different endpoint, why do you need it as a base? The models are already in the repo
testing setup/dependencies/router module
Alright, but even if I base my branch on the repo it could drastically change, and you might have to rewrite many things.
How do I mock order_by here?
def get_all_otn(db_session: Session) -> Query:
return db_session.query(OffTopicChannelName).all()
queryset = get_all_otn(db_session).order_by("used", "?")[:random_items]
This is what I tried but it doesn't work
the error
Could you return a mock query instead?
Here's your reminder: Review api PR
[Jump back to when you created the reminder](#dev-contrib message)
Iβm on phone, so sorry for the errors: it has to be: mocked_session.query().all().order_by.return_value = β¦.
Nice.. sorry. π
@static canyon sorry for the mess in the PR, I keep adding single comments instead of starting a review π . I deleted the comment before I saw you already replied to it
No worries lol
Although I don't seem to be able to reply to your review
It just has the option to mark as resolved
Refresh?
Already tried that
Done that too xD
Why does GitHub hate me lol
Completely restarting my laptop doesn't even fix
Wtf
Can you reply through your phone?
I'm in school so can't get my phone out to check :p
Or at least not until like 10mins time
Lol then I'll distract you no further
In registration at the moment, once I go to PS I can check
Hi
Just checked and I can't do it on my phone either @cold island
Exact same screen (can resolve but not reply)
The one where you said to change by to for, it's deliberately by because if it was for then that implies it's the infractions received not given
Ah right
Yeah, I'm doing that
And gonna make 100 display as 100+ since 100 could be anything from 100 to infinity (api will return a maximum of 100)
That might be something to change in the other searches as well
I suppose. It seems unlikely to have 100 received infractions though
But if I'm editing the file anyway I suppose I might as well
sec, I can't do it in this channel
We would probably want to add a decently sized paginator and update the bot API connector to properly handle it
Yeah that'd be nice
That's outside the scope of my PR though lol
Which is my way of saying I'm not going to be the person doing it
Would it be worth making a small helper function which gets called?
def format_infraction_count(infraction_list):
...```
I think get_infraction_count is a better name
get count sounds like you're expecting an int
Hmm
what do you actually have to do in this function?
I guess format_infraction_count should take infraction_count then, rather than infraction_list?
@staticmethod
def get_infraction_count(infraction_list: list[]) -> str:
"""
Returns a string-formatted infraction count.
API limits returned infractions to a maximum of 100, so if `len(infraction_list)`
is 100 then we return `"100+"`. Otherwise, return `str(len(infraction_list))`.
"""
if (num_infractions := len(infraction_list)) == 100:
return "100+"
return str(num_infractions)
```this is what I had
It's short but helps DRY π€·
I think format_infraction_count makes sense
^
also I feel like gettext could do that
No clue what that is lol
I don't either, but we saw @cold island use it once and it was rather fancy, heh
from gettext import ngettext
...
end_msg = f" (#{id_} ; {total} infraction{ngettext('', 's', total)} total)"```this is the only example I can see in bot
hmm yeah that doesn't help
Yeah
ngettext(str(len(infractions), '+', total > 99) could work I guess
>>> help(gettext.ngettext)
"""
Help on function ngettext in module gettext:
ngettext(msgid1, msgid2, n)
"""```thanks python
Very helpful
lol
lol
has anyone assigned sir-lancebot#933 yet/doing it yet?
It doesn't seem to
@staticmethod
def format_infraction_count(infraction_count: int) -> str:
"""
Returns a string-formatted infraction count.
API limits returned infractions to a maximum of 100, so if `infraction_count`
is 100 then we return `"100+"`. Otherwise, return `str(infraction_count)`.
"""
if infraction_count == 100:
return "100+"
return str(infraction_count)
```this is what I've got at the moment
BUGS
The return type ought to be const char *, but is char * to avoid
warnings in C code predating ANSI C.
I think that function is fine, we can just slap it as a function
embed = discord.Embed(
title=f"Infractions by `{actor}` ({self.format_infraction_count(len(infraction_list))} total)",
colour=discord.Colour.orange()
)
Does that seem okay or should I make the return value a variable?
formatted_infraction_count = self.format_infraction_count(len(infraction_list))
embed = discord.Embed(
title=f"Infractions by `{actor}` ({formatted_infraction_count} total)",
colour=discord.Colour.orange()
)
Think I prefer the latter
imo the first one would be better, or if you want to have more readable code for people like me, then the second
Thoughts? @clever wraith @cold island ^
how can restrict_to_user in paginator be used to limit some actions?
I would say the later, logic in f-string is usually a bad pratice
len = len(infraction_list)
f"Infractions by `{actor}` ({len}{'+'[:len>99]} total)"
``` 
Aight cool thanks
Sent by a core dev so that must be good code
lol
no u
lol, it's even better than my master piece here https://github.com/python-discord/bot/blob/main/bot/exts/utils/utils.py#L169
bot/exts/utils/utils.py line 169
name=f"Snowflake{'s'[:len(snowflakes)^1]}", # Deals with pluralisation```
opinion invalidated, chris is banned
!e It's relying on the fact that this works ```py
print("+"[:True])
print("+"[:False])
@vale ibex :white_check_mark: Your eval job has completed with return code 0.
+
I love how it's infraction_list and not len(infraction_list) too
You just send the entire dictionary
Possibly with a + at the end
yes but I don't care

I am still bitting my nails for not having reviewed that PR
oof
because screw the rest of the code in that file
how can this be implemented to https://github.com/python-discord/sir-lancebot/blob/ba4b0e498191195d773c031fcfdaef862bd472b8/bot/utils/pagination.py#L91-L95
sir-lancebot#933
bot/utils/pagination.py lines 91 to 95
async def paginate(cls, lines: Iterable[str], ctx: Context, embed: Embed,
prefix: str = "", suffix: str = "", max_lines: Optional[int] = None,
max_size: int = 500, empty: bool = True, restrict_to_user: User = None,
timeout: int = 300, footer_text: str = None, url: str = None,
exception_on_empty_embed: bool = False) -> None:```
mainly the restricting the user
does it have the mod bypass like python does
It doesn't
Nope, don't have the capacity for that
Most of the dev time I'll have in the next several months will go to the filters system
that's pretty fair
Did you make much of a start on it?
IE do you have anything locally that isn't in the repo?
I started with a repo setup, but if anyone picks that up they'll be able to do it pretty quickly
yeah, I got stuck on CI and setup.py and never made time for it again lol
It would have been a nice learning experience, but I just don't have time for it atm
could you git add . and git commit?
We may have time to get the ball rolling this weekend, as week 6 exam is nothing
π
@cold island have pushed the fixes to your review on bot#1926
do you wanna push what you have to a branch?
I don't think it's much of anything, so I think it's better to start from scratch than trying to fix whatever I did
lol okay
Not sure exactly what you mean but I maybe know
what was the conclusion on distributing the package? I/we quite like the idea of uploading an artifact using the CI and have a worker serve the latest
In here to LinePaginator? https://github.com/python-discord/sir-lancebot/blob/main/bot/exts/utilities/wikipedia.py#L76-L95
I think that was more or less that. We had a local PyPI instance but it's down for now
look at the code you linked above, there is a restrict_to_user: User = None, parameter on that function
But joe says it'll be easy to start again
yeah I remember it got nuked, don't remember why
Was just unused
really? wasn't it memory leaking or something
idk
I'll ask Ak to have a look
I saw the part but unsure where it belongs in the code, I have never contributed these bots
when you call paginate give it a user/member object
await paginate(lines, restrict_to_user=ctx.author)
or whatever
Oh now I see
joe took it down after a super long crashloop due to linode rate limits, and we apparently prefered to use zips over a custom pypi
I don't think you can use two servers for different packages using Poetry anyway
so, if I want to make a fix to something I need to create a pr?
sure thing
how do I create a pr for a issue that is open?
have you ever opened a PR?
Cool! How much do you know about Git and pushing branches?
Sure can lol
I know the general usage, I can make commits and pushes without problem with git (except the few times I nearly destroyed my whole repo)
and iirc if you want to push a commit to non main branch it will create a pr for it
The PR wonβt be created automatically, but once you open the repo on GitHub after pushing, itβll show a prompt to create one
Do you have a fork?
you'll need one, yeah
oh.. I alrd forked
np π
Can you run git branch -v?
erm that would take a while to get repo to vsc
git branch -v
* master 63b96601 Merge pull request #935 from SavagePastaMan/remove-skill-level-topic
well now I have made the possible fix in my code
if that is correct, then I would need to know how to make a pr from that
ah, he meant git remote -v
haha, okay
But at a time, how do I create a pr from the code I added?
Make a commit with your code, push it to your fork. Open the fork on GitHub
Thereβll be a βCreate Pull Requestβ button
*make a new branch first
Called?
I'll try when I get access to laptop, thx!
I usually name my feature branches "feature/description-of-issue-here"
https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/working-with-git/cli/ could be useful for you
Basic workflow when using the git CLI.
we usually do $type/$issue/$description
$issue as in issue ID?
in that case it would be something something wikipedia/933/lock-paginator-to-author
yeah
And what's "type"?
it makes it way easier for us to checkout the right branch, as you can just type the issue number and press tab
mayhabs a file
TFW gh cli and editor integration mean you never have to type anything
type is what we use at the beginning of our commit, I guess field would be better
it is like what very specific part of the app is affected by this commit
Such as what?
I don't think I've ever done that π
like here the commit would be something along the lines of Wikipedia: lock paginator to author
oh, by we I meant Ak and I
Ah lol
Oh, ok
lmao
I thought you meant we the community
yeah, nah
not part of the staff, wouldn't make sense anyway
I can just use this, right?
as long as it isn't the opposite
Chris why are your commits so violent
yeah, feel free
I tend to label feature branches with issue ID at work, but I didn't see anyone else doing that with the pydis repos, so I haven't so far.
We donβt have a general policy
should I ask why Destiny II has this?
It's nice when an issue requires multiple PRs.
Just do whatever you feel like
it could be interesting to slap some suggestions in the contrib supplemental info page
It really doesnβt matter too much at the end of the day
There's not much value to it if I'm the only one doing it anyway, so meh.
ehh I have mistaken something, right? ```
git checkout --no-track -b wikipedia/933/lock-paginator-to-author upstream/main
fatal: 'upstream/main' is not a commit and a branch 'wikipedia/933/lock-paginator-to-author' cannot be created from it
The only place itβll show up is the merge message if left I modified
You have that extra
βUpstream/mainβ
git remote add upstream https://github.com/python-discord/sir-lancebot.git first
At the end
I did
Ah
needs to be my repo..?
ah so this is not needed?
You should be able to just check out without it and itβll use the current head as base
Did you do git fetch upstream ?
now it worked when I removed the last thing
It should in theory work with it too, assuming you have the branch
You can verify with git checkout upstream/main
Wait, what's the last argument supposed to do when creating a new branch?
Specifies base
I usually bind the upstream when I push the branch, not when I create it.
Well I guess it worked so far
Well, you can bind the upstream later anyway
<start-point>
The new branch head will point to this commit. It may be given as a branch name, a commit-id, or a tag. If this option is omitted, the current HEAD will be used instead.
so after adding, do i need to commit + push?
Yes
does it need a meaningful commit message?
Yes please. It doesnβt need to be too elaborate, just a basic idea of what the commit is
git commit -m "Limited user reactions by adding user restricting"
We have guidelines for that, one sec
aha, I'll read about it
I usually try to follow this: https://chris.beams.io/posts/git-commit/
I wouldnβt recommend you use the m option, as itβs harder to write out meaningful things
Yeah hah
(the article I posted, not the one I wrote)
but -m would work as well?
I use -m when I know for a fact I won't need multiple lines, but it tends to make you lazy.
It would, but youβre only giving it a title, and no body
so I would not make it like this```
git commit -m "Limited user reactions to prevent them from removing message by adding user restricting"
Thatβs a bit long for a title
Itβs good for a body, but to do that youβll need multiple lines
If you try to commit without it, itβll open your default text editor
erm how do I use smth else thab -m?
So "Limit user reaction...", not "Limited"
Just leave it out and it'll open an editor
ok, and now?
So, write a shorter βtitleβ on the first line, which describes your commit
Leave one empty line
Then you can put the longer form description, aka βbodyβ
@cursive relic Use this as a checklist: https://chris.beams.io/posts/git-commit/#seven-rules
We donβt really enforce commit quality beyond βmake sure you actually have commits, and they arenβt spamβ, but we do appreciate when someone puts in the effort for nicer commits
I have never ever written anything close to good as commit message, and this is what I came up by
GitHub displays up to 72 so that's the limit I usually stick to, 50 can be a bit restrictive imo
Do you know what the imperative mood is?
In English grammar.
nope, never heard about it
Imperative mood means commands
Like "Clean your room!"
One of the rules is to write the title in the imperative mood
so some sort of clean message?
No, like "Take out the trash" "Write a good commit message" <- These verbs are in the imperative mood, because they are commands.
You should write the commit title in the imperative mood as well.
So instead of "Limited user reactions", it should be "Limit user reactions"
You can think of it as describing the effect the commit will have
Not what effect it had
I suck at writing these π
so I would need to improve this?
I just can't really tell about it
Tell what?
anything to commit message, I just can't come up with anything
nah that doesn't work, still get the same error
all commit messages I have written are sort of "quick fixes", "fixed typo" or smth
What does the commit do?
fixed a "bug" or added a missing feature
I saw this issue on the GitHub feedback repo discussions panel, can't find the link now as I was incognito mode... made you can go through the latest ones (<6-7 days)
What bug? Which missing feature?
that the user can remove a message even when they are not a author of command
"Prevent non-author from removing message" ?
kind of
Kind of? What's wrong with it?
ehh was that example to commit message..?
There was nothing wrong about it, I just thought it in another subject
I mean, yeah, that's how I would phrase it based on your description. But if it's not accurate in some way, maybe it needs to be revised. Does it leave out any important information?
Well imo, no it does not miss anything. But I'm quite sure that something may be missing
You don't have to second-guess yourself forever. If you think it's accurate and it obeys the seven rules, go with it. Writing good commit messages is a skill that requires practice to master.
You can't go straight to writing perfect ones overnight.
well, this is what it has now :/
Everytime you think over the commit message, you will get something new. Think once, the commit message should just be a short summary of your change such that the person doesn't need to look at your code
yeah that's perfect
Limiting user reactions on embed pagination could also be used as commit title imo
That's why I like adding Wikipedia: at the beginning of the commit, so you can clearly see what part of the app it is changing
I'll take that there
Did you commit it already?
Well, again, fix the imperative mood issue.
I don't quite know what that is, even if tried to explain
that should be evident from the scope of the PR that introduced it
It means the sentence should be phrased as a command
As if you were telling someone to do something
When you tell someone to clean their room, you don't say "Cleaned your room!"
I follow this outside pydis - the type/scope part
When you write a commit message subject, you don't write "Limited user reactions"
But it isn't when you look at the commit log on main
then comes up next problem, I don't know how to format it as a command
"Limited user reactions" -> "Limit user reactions"
It's that simple
"Limit user reactions" can be read as a command
"Limit user reactions, immediately!"
so not talking as past?
No, talking as if you were telling someone to do something
better?
so now I just close the file?
Sorry, I didn't follow along with the previous conversation. You're going to create a PR from your fork?
I'm making pr to my fork of sir lancebot
Right. Which remotes do you have currently?
none, I never did it
git remote -v
upstream https://github.com/python-discord/sir-lancebot.git (fetch)
upstream https://github.com/python-discord/sir-lancebot.git (push)
Alright, so you want to add your fork as a remote git remote add origin https://github.com/<your-github-user>/sir-lancebot.git
and now?
Assuming you put the correct url, you should be able to go git push
You might get an error telling you to configure the upstream branch
in which branch?
Which branch did you just commit to?
git status
On branch wikipedia/933/lock-paginator-to-author
nothing to commit, working tree clean
Just go git push
It'll push to the origin remote by default, and to the configured upstream branch of the current branch
git push
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using
git remote add <name> <url>
and then push using the remote name
git push <name>
i think it worked
Not based on that output
git push --set-upstream oorigin wikipedia/933/lock-paginator-to-author
Enumerating objects: 11, done.
Counting objects: 100% (11/11), done.
Delta compression using up to 4 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 577 bytes | 192.00 KiB/s, done.
Total 6 (delta 5), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (5/5), completed with 5 local objects.
remote:
remote: Create a pull request for 'wikipedia/933/lock-paginator-to-author' on GitHub by visiting:
remote: https://github.com/Nipa-Code/sir-lancebot/pull/new/wikipedia/933/lock-paginator-to-author
remote:
To https://github.com/Nipa-Code/sir-lancebot.git
* [new branch] wikipedia/933/lock-paginator-to-author -> wikipedia/933/lock-paginator-to-author
Branch 'wikipedia/933/lock-paginator-to-author' set up to track remote branch 'wikipedia/933/lock-paginator-to-author' from 'oorigin'.
Aah, you misspelled origin
ye ...
i see, what do I do next?
If I were you, I would fix that typo, because it'll be inconvenient to have to type out the remote name for every command later
press it?
But it's not strictly necessary
Yes, you can do that to create the PR
The destination should be the main branch on the main (not your fork) repo
so I need to fix smth?
ok so just click the green button?
Lots of git commands take a remote as a parameter, where you specify which repo you want to operate toward. If you don't explicitly specify a remote, it will use "origin" as the default.
Since you don't have a remote called "origin", you will need to explicitly specify the remote for every command.
This is kind of inconvenient.
hmm, how do I fix it
You can fix this, if you want to, but you don't have to.
i can do that
the alternative is to always type out the remote name
You can set the default remote to be something else
How do you do that?
Although actually, renaming the remote is just as easy
gh repo clone auto adds upstream remote if you are cloning a fork
git remote rename oorigin origin
@cursive relic
Origin is the fork, right?
done π
yeah
Perfect
origin would be the fork i made
now I click the button of doom
yes, the magic green button
Click the button of doom and it'll take you to the form of doom where you can fill in your PR title and description of doom.
lol
oh god
Yeah, I mean in their specific case
this is a 1-minute process once you get familiar with it π (excluding the pr description)
I need to write more text?
Do you need a do not merge label on your PR Jason
Yup! There are some comments in those fields to say what you have to write
yessir
:sad_face_of_smth:
Done
ty
somehow kinda hard to explain all what I have done because all I did was ```py
restrict_to_user=ctx.author
Lol
add that limit... line in description and put the relevant issue
click the ticks
and you are done
do what..?
Finally π
what do I need to write in Relevan issue I did not understand
Usually a PR closes an issue
Hmm, Move that limit users... line (your commit description) to the description section, then add the relevant issue in form of Closes #XXXX (read the commented section below it- in raw mode) and click the relevant ticks you have followed and press the magic green button
looks good?
uhh yeah
ok aight, I will blame you if smth goes wrong /j
Looks about right
button of doom was activated
Good stuff
what is that?
you passed the linting test π―
Basically runs pre-commit hooks and flake8 against your code and sees if everything is okay
don't even know what that is but not suprising when all I did was 1 single argument
Linting basically checks that your code is formatted according to certain standards that we use in this project.
If it wasn't, it would fail and you would have to fix it before you can merge the PR.
You're welcome! π
Is that the beta issues? Or notifications?
@static canyon you want to open a separate PR for the 100+ thing?
Notifications.. Finally meant I atlast mentioned all of them
Why not leave it in the one it's currently in?
If you really want me to then I can I guess, although I'd have to wait for the current one to get merged first
I don't know, you didn't add it there. I mean for the other places where it should be used as well
Mh the webhook settings for api aren't correct and Ak doesn't have access to the settings
Need an owner
I added them all in the PR?
bot#1929
I only see it for infractions by
Ah yeah
I forgot to add it to the others
Should I add in this PR or make another?
Here is fine I think
nw
!remind 2h this ^
Your reminder will arrive on <t:1635871838:F>!
!reminder cancel 3403
That reminder has been deleted successfully!
@cold island have just squash-pushed ^^
@thorny obsidian You told me to ping you here if I ran into issues with setting up evalbot π
I was wondering if Docker is necessary? I have no experience with it at all, so I just tried running __main__.py in vscode. I had to install a few modules but the when I try to install the bot module with pip i get ModuleNotFoundError: No module named 'keyring.backends.macOS' ERROR: Could not find a version that satisfies the requirement bot ERROR: No matching distribution found for bot
Thought I should ask first before doing anything, perhaps this isn't an issue if I were to use docker
What is eval bot?
Maybe the snekbox? But Docker is strongly recommended
I asked if I could use @stable mountain in my own server, this isnt possible but I got recommended evalbot which is is the !e side of the python bot
@gritty wind this might be a good one for you ^^
Oh hi
Could you tell me why, please? I know almost nothing about it
yes, pip install bot
It isn't packaged onto pypi. If you want to use it, clone it from source, or use the docker container I publish
In the file log.py there is a from bot import constants, I tried pip install bot.constants but I kinda knew that wouldnt work cause I assume pip would think bot.constants is a single module
Which would you prefer?
bot is just the name of the folder that houses the code
if you run python -m bot it will work
Cloning it from the source sounds less confusing, I'll try that
(Assuming you installed the other dependencies)
I'll try π
I don't have instructions for it, because it was never an official project. Just something I spun up for a little while and forgot to take down
The general process is though:
pip install poetry
git clone https://github.com/HassanAbouelela/evalbot/
cd evalbot
poetry install
poetry run python -m bot
(poetry is a package manager which installs the other dependencies for you)
poetry oh I had trouble with poetry in the past
couldnt tell you why though
I will try this
Give it a shot now, if it still gives you trouble, you can still manually install all the dependencies
progress has been made, I'm just told now that ModuleNotFoundError: No module named 'aiohttp' so I'll be installing modules for now
At which step do you get that error?
last step, poetry run python -m bot
Am I safe to just install the required modules with pip?
actually no, poetry install ran just fine
Actually, I'm looking over it now
there's a lot of JSONDecodeError in red font, bold
This might help,
β’ Installing idna (3.2)
β’ Installing mccabe (0.6.1)
β’ Installing multidict (5.1.0)
β’ Installing pycodestyle (2.7.0)
β’ Installing pyflakes (2.3.1)
β’ Installing async-timeout (3.0.1): Pending...
β’ Installing attrs (21.2.0): Failed
The first 5 dependencies installed, async-timeout is stuck on pending and attrs failed
The poetry install finished executing I just still have this Pending... next to async-timeout
Ironic considering the module name
I'm a bit preoccupied rn, but I can get back to you in 10 minutes or so
@worn swallow, the JSONDecodeErrors could be because of the Python version
hmm. I got the same error with 3.10, but not with 3.9.7
Check which version poetry uses
I'm not sure how to check this myself but I searched it up: Poetry requires Python 2.7 or 3.5+
poetry --version outputs Poetry version 1.1.11
what does poetry env list print?
RuntimeError
Poetry could not find a pyproject.toml file in /home/stivens or its parents
at .local/lib/python3.9/site-packages/poetry/core/factory.py:369 in locate
365β if poetry_file.exists():
366β return poetry_file
367β
368β else:
β 369β raise RuntimeError(
370β "Poetry could not find a pyproject.toml file in {} or its parents".format(
371β cwd
372β )
373β )
Am i just an idiot or what
I was supposed to do that in the evalbot folder, right..?
yep
Sorry, i only managed to get 5 hours of sleep today and am running on a tasty cup of java
evalbot-dJNuoo1j-py3.9 (Activated)
Is the output
so it is actually Python 3.9, weird.
pyproject.toml lines 8 to 9
[tool.poetry.dependencies]
python = "3.9.*"```
poetry run python -VVVV
[GCC 11.2.0]```
Hmm, should be right, I'm still busy rn, but I have it in the back of my mind
@worn swallow reinstall poetry using pipx π
There's too many issues with poetry's own installer
It creates its own venv and manages it when using the installer
Ofc every update breaks that venv
to reinstall I suppose I must delete my current version of poetry?
Yeah
Through apt remove and apt purge?
How did you install poetry?
installed package poetry 1.1.11, Python 3.9.7
These apps are now globally available
- poetry
done! β¨ π β¨
``` ....pretty π
lol same I'm just procrastinating while I drink my coffee
I'm unsure what bot is in import bot, but it's also the name of the directory inside evalbot , evalbot contains everything from github
I reinstalled poetry using pipx as suggested and ran poetry run python -m bot
Yes, and this time nothing failed I dont think. Let me check
I wont copy and paste the poetry install but there were no fails
nope
since when was there a virtual environment
what is going on, why so much chaos
such difficult questions
idk if im perfectly honest, poetry run python -m bot still tells me there is no module named bot and I have no Idea when this vitrual environment came into play
Which folder are you currently in
/home/stivens/.cache/pypoetry/virtualenvs/evalbot-c3UWB7ZP-py3.9/bin/python: No module named bot
I ran this inside the bot folder through vscode and I feel even more like an idiot the more I type
But I will still take it like a gentleman
You need to run the commands in the folder that has the pyproject.toml file
It comes with experience
Should be from a command line / terminal, from the evalbot directory. Just gotta cd to the right folder location that you cloned
Oh my gosh we have progressss
So I created a 2nd folder for evalbot because I was messing around with the fist one I cloned - my only error now is that BOT_TOKEN is not defined but this is jsut something I forgot to do in the 2nd folder
Since there are plenty of seasonalify commands, such as .spookify for Halloween, shouldn't there also be a .christmasify command or something like that?
Sure, why not. Would you like to make an issue?
Sure
The full list of variables you need is defined in the readme π
Wait do I need to follow the format for the issue?
I forget what the template is like
Probably just a couple sentences for description and reasoning
Alright
implm is optional, but it's basically just the same details as the other commands lol
It should be built in
Oh yes, this is a question that I wanted to ask about the environment variables
I have BOT_TOKEN set up, but I'm not sure what to put for the CHANNELS environment variable?
The IDs for the channels you want the bot to be enabled in. You can get that by right clicking on the channel name and selecting copy ID
Because I tried something like CHANNELS=[general,brainstorming] and I get ValueError: invalid literal for int() with base 10: '[general, so I thought perhaps I needed channel IDs separated by commas
there you go π
Thanks, thought I done something silly there
Tbh the documentation on the project is quite lacking, it was never intended to stick around as long as it did, or get used by anyone
Would you like a PR to add some documentation / setup? I could try to set it up locally and write up my steps
Normally, yes, but for this project specifically, I want to kill it eventually, not keep it around. It's already going out of sync with our actual bot implementation.
It runs... It's alive! 
Maybe one day we could migrate the eval stuff out of the main bot, so people could actually use it for their own bots
I wonder if d.py has a nice way to do that
Thank you very much for your help everyone, couldn't have figured this out by myself π
It's alright, feel free to ping me if you run into any more problems
Will do
Just submitted an issue :)
thanks, approved
it does, actually
see jihtsu or however you spell the name
but tldr to load it, bot.load_extension('jistaku')
Hey! Could someone take a "quick" look at api#25? π
No the problem is
(ping me when you have it :P)
my ide is being fucky
What should the default command prefix be for evalbot?
There is a section in main.py, when defining the bot, prefix=prefix, I was thinking of setting this to prefix="!" but I didnt want to tamper with the code again
You just need to set this in your environment settings
You can do something like:
VARIABLE_ONE=value VARIABLE_TWO=value poetry run python -m bot
Or you can use a .env file
I have a .env file with the bot token and channels
I assume there is a PREFIX variable too?
I checked, constants.py, "BOT_PREFIX"
So I can set this to something like BOT_PREFIX=!?
There are ~896 LOCs to get the bare minimum needed to run the bot. 115 more if you count the internal eval stuff. Of those, only half (408) are directly snekbox. The others are all utilities and other stuff that's also used in Python. If we were to use an extension, that's standalone, we'd have to duplicate half of the project in both repos
Yes, but, I wouldn't recommend you search the constants directly
The readme has all the available variables and descriptions of them
smh that didn't ping me
;-;
Nah, actually it's just two in overall. The rest is like adding default=True to the models and such π
Is there another channel I should go to if I have anotehr question relating to evalbot, or can I ask here?
is that my DMs
yes
nice
ik, ik im the only member right now
The bot responds to !help but when I try !e or !eval I get Cannot connect to host snekbox.default.svc.cluster.local:80 ssl:default [Temporary failure in name resolution]
Can I join the cool kids club?
ye, a snekbox also has to be running
Snekbox is an independent project that also needs to be running, have you had a chance to look into that?
Well, it's a python discord project
snexbox#1
So we can still help you lol
MAYBE if i spelled name correctly
For this one, I would actually recommend running in docker directly, setting it up locally is very difficult
Impossible on a lot of devices lol
You must start all conversations with memes, that's the price of entry
Guess it's time to learn about docker
I've seen explanations for what it does but I dont know how to use it or what it does 
interesting
For snekbox, should I git clone this into the same folder as my evalbot folder?
TIL you know what a meme is
Preferably not, but you don't actually need to clone it
smh
It's those electronic digital media things that are all the rage with the kids, no?
if i dont need to clone it... what else can I do with it? π
If you run:
docker run --ipc=none --privileged -p 8060:8060 ghcr.io/python-discord/snekbox
(after installing docker) it'll just workβ’οΈ
anyways, i need to go write some more tests,
I see, I'll try this
Just finished
well then, nice
docker run --ipc=none --privileged -p 8060:8060 ghcr.io/python-discord/snekbox in the same folder as evalbot I presume?
any folder is fine actually
Clearly you didn't see the pydis staff in staff channels lmao
Alrighty, I'll run it in evalbot just to be safe
They are the true shitposters
more importantly, how would you 
smh @green oriole stop sharing your thoughts with her π
alts, many, many alts

Not like I can, or at least want to
docker... image(? ) runs, I can send the output
I ran
sudo docker run --ipc=none --privileged -p 8061:8061 ghcr.io/python-discord/snekbox
Provided you didn't see any errors, you shouldn't have any problems with that
but what's the URL you configured for the bot :)
shhhh
Damn if only I knew lol, I'll try to find it oh that's an environment variable isnt it
i remember
here we go again π
For your case, it's most likely going to be something like http://localhost:8061/eval
so should I set SNEKBOX_URL=http://localhost:8061/eval or SNEKBOX_URL=ghcr.io/python-discord/snekbox?
2nd one, no?
In your env file, it would be the first one
It's basically telling the bot where snekbox is running on your PC
(ignore this)
Oh I see
I'm going to set up all environment variables listed on the github except the optional ones
haha that's a wise idea
PASTEBIN_URL can just be https://pastebin.com/ no?
so uh actually, I don't know if this is compatible with the pastebin API
We actually use our own hosted hastebin
which we call pastebin lol
you can use https://paste.pythondiscord.com/{key}, or any other hosted hastebin instance
actually
notice the notice
this is the original's new endpoint https://www.toptal.com/developers/hastebin
given this one deletes pastes after 7 days i would use it lol
pydis deletes after 3 months of no access
and hastebin.cc deletes after 1 year
So I can use this toptal one you sent?
hopefully π
make sure to add /{key} to the end of w/e you use
it's a string template that gets replaced by the bot in certain places
"https://a.com/{key}.format(key="something") = "a.com/something"
lol
I'm a developer @clever wraiththub where I develop software that helps developers develop software.
...
sorry random user
this is from the original hastebin creator's github bio
I'll be honest and say I have no Idea what to put, where to get it or where to put it
bruh this is invalid
SyntaxError: Unclosed String literal on line 1
Oh shit i get what you mean about string template
Slowest progress ive made in my entire life but we move
.bonk @gritty wind
...
btw can someone close and lock maybe even delete https://github.com/python-discord/bot/issues/1932
Damn your like my IDE. Complaining about unfinished code
Thanks
I coulllldd share my own .env lol
please
Actually, there isn't anything left that's reusable for your case
you could bullshit the actual private values


