#dev-contrib
1 messages · Page 126 of 1
Oh you're a programmer? Name every error
kubectl get ingress -a
Oh, you're akarys? name what exit code 69 is.
BaseException
Wrong. BaseException

EX_UNAVAILABLE (69) A service is unavailable. This can occur if a sup port program or file does not exist. This can also be used as a catchall message when something you wanted to do doesn't work, but you don't know why.
nice ctrl c ctrl v
Yeah it looks bad
Like legit, working on a startup sequence thing so
when something you wanted to do doesn't work, but you don't know why.
thats like, everything ever for me
Ikr
Oh god I am such an idiot
Aaaaaaaaaaaa
So tl;dr I wondered why nothing was printed to console
Because I was grabbing all of the stdout into my eval command
That does sound problematic
Error from server (Forbidden): ingresses.networking.k8s.io is forbidden: User "system:serviceaccount:default:akarys" cannot list resource "ingresses" in API group "networking.k8s.io" in the namespace "default"
Interesting url
Ikr
Shush this didn't just happen to me
I had to resort to logging statements, can you imagine?
lol
@stable mountain actually uses that so yeah
lmfao
why do we use freebsd exit codes lol
@cold island I think we should take inspiration from git
class Msg:
last_channel: Msg
next_channel: Msg
last_user: Msg
next_user: Msg
message: discord.Message
history = Dict[int, Msg]
Ah, so that's what you mean by a dict - linked list combo
Yes
What will the keys be?
hmmm.. I don't particularly care about the channel
Stuff like clean would though
to clean a particular channel you just go to channel_history[channel.id] then go through last_channel until you hit whatever threshold
Yeah but the dpy cache exists either way no?
True, although I was thinking we'd just rely on this instead of both
A simple linked list runs into the same issues I have with the current cache
Which is bad random access and no slicing
I don't need a dict for that though, it's just indices
Well, either the messages are stored contiguously in a list/array structure, and indices work, or they're not, and someone, somewhere needs a dictionary
and contiguous doesn't really work for deleting from the middle
If we just want to delete from the front/end we could code up a circular buffer cache
I want to preserve deletions, so if we're making the same cache with deletions I'd rather just rely on the existing cache
Just a size constraint
Why does it need to be circular?
to avoid reallocation
I don't follow probably
a ring buffer offers O(1) prepend, append, 0 delete, end delete
a python list offers O(1) append and end delete, but O(size) 0 delete and prepend
list:
.insert(0) -> O(size)
.append() -> O(1)
.popleft() -> O(size)
.pop() -> O(1)
[random] -> O(1)
growing -> amortized
deque:
.insert(0) -> O(1)
.append() -> O(1)
.popleft() -> O(1)
.pop() -> O(1)
[random] -> O(size)
growing -> no cost
circular:
.insert(0) -> O(1)
.append() -> O(1)
.popleft() -> O(1)
.pop() -> O(1)
[random] -> O(1)
growing -> amortized
I'm probably just unfamiliar with the data structure. Do you have a reference or something
How is random access kept at O(1)?
It's backed by an array
to access the Nth element, you go to slot (start + n) % length
Then how is 0 delete O(1)?
start += 1
now accessing indices is shifted one element right, as if it were deleted
Presumably, for GC purposes, we'd set the element to None too
Ah, so you allocate the max size in advance
yes, or you grow whenever your start pointer bumps into your end pointer if you want to be unbounded
We're in Python yeah? 😅
Yeah, but same deal :P
class RingBuffer:
MAXLEN = 10
slots: List[T] = [None] * MAXLEN
start_slot: int = 0
end_slot: int = 0
def push(self, thing: T):
self.start_slot -= 1
self.slots[self.start_slot] = thing
def popleft(self, thing: T) -> T:
fetch = self.slots[self.start_slot]
self.slots[self.start_slot] = None
self.start_slot += 1
return fetch
def append(self, thing: T):
self.end_slot += 1
self.slots[self.end_slot] = thing
def pop(self, thing: T) -> T:
fetch = self.slots[self.end_slot]
self.slots[self.end_slot] = None
self.end_slot -= 1
return fetch
This is basically it, without bounds checks
Hmmm we'll need to discuss it a bit more about deciding to use our own cache
Seems like an interesting idea though
It's a criminally underused data structure in higher languages
It's very popular in embedded and similar because it gives you flexibility without needing linked lists, as well as backpressure if it fills up
But the benefits (IE: O(1) in push/pop/pull/append) it grants are useful at any algorithmic level
I'll see if I can make a good case for it and make a poll for the core devs
inserting and deleting the middle though is still bad, although you could have it only move half if you really wanted to do that work
kk
Yeah it wouldn't fit if we used deletions, but if we don't care about removing deleted messages that looks like something that should work
If we were doing insert/delete then we'd want to look into a rope, but yeah
We need the channel for Discord to be able to find the message
Yeah, but we have that on the message object
yeah
the question is really going backwards, from "we have channel ID and want latest message from cache"
which if we're not doing is fine to leave out that.. index
because I guess it is an index
what feature are you implemented?
A message cache
O(1) access but also ordered and iterable?
Oh right, they get overwritten?
Nope, they just stay there
They get naturally removed as newer messages arrive at the head of the cache
As any other message
Yeah that's what I mean
Ahh, yeah I still am not sure how easy it will be to add
Like it is possible, but so far I know you have a general preference over not monkey-patching 😅
Here is where it is defined really https://github.com/Rapptz/discord.py/blob/master/discord/state.py#L217
discord/state.py line 217
self._messages = self.max_messages and deque(maxlen=self.max_messages)```
But it also gets re-created when the bot leaves a guild as seen here: https://github.com/Rapptz/discord.py/blob/master/discord/state.py#L1048
discord/state.py line 1048
self._messages = deque((msg for msg in self._messages if msg.guild != guild), maxlen=self.max_messages)```
we already monkey patch for root aliases iirc so /shrug
What do you mean by root aliases?
off the top of my head, take !tp add, a root alias for that is !nominate, meaning it doesnt need to be invoked as a group member
Ah
Yea, we subclass discord.ext.commands.Command to add a new kwarg root_aliases
Then we overwrite add_command in our sub class of Cog to iterate through the root_aliases and add them to the list of commands
Setting self.max_messages to None seems simple enough
That will cause there to exist no message cache at all?
Or maybe there's a way to tell it to not cache in the first place
Yeah the idea is to have our own after all
Not to patch dpy's
Setting it to None disables the caching entirely
Yes. We don't use it at all at the moment though
Unlike root aliases which is just subclassing, it will be a very involved monkey patch that is subject to issues every time that file is updated with new code
So we can just disable the dpy caching and have it as a cog
Yea
We make use of it in evals
Or at least, internal ones
Alternatively, may I suggest we just leave it as is, and maintain our own for whatever we want?
So have 2 caches
doesn't dpy also make use of it for something which may be useful? Having a separate cache for what it's needed or implementing the seq/deque interface to directly replace dpy's cache sounds like it'd make more sense
on_message_delete, on_message_edit, on_reaction_add, on_reaction_remove, etc.
Yeah but parse_message_delete in https://github.com/Rapptz/discord.py/blob/feae059c6858e419552ec4096f1ad2692bb4c484/discord/state.py#L518 checks if there's a cache
discord/state.py line 518
def parse_message_delete(self, data):```
discord/state.py line 523
if self._messages is not None and found is not None:```
So as far as I can see those events will update the cache, if there is one
Yes, so it handles that case
But those events will not propogate
As of right now, it will break wait_for_deletion https://github.com/python-discord/bot/blob/main/bot/utils/messages.py#L97-L105
bot/utils/messages.py lines 97 to 105
try:
try:
await bot.instance.wait_for('reaction_add', check=check, timeout=timeout)
except asyncio.TimeoutError:
await message.clear_reactions()
else:
await message.delete()
except discord.NotFound:
log.trace(f"wait_for_deletion: message {message.id} deleted prematurely.")```
Because a reaction_add event looks like this: https://discord.com/developers/docs/topics/gateway#message-reaction-add
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Yup, and this is the case for most other events. reaction_remove is the word offender with having close to no information https://discord.com/developers/docs/topics/gateway#message-reaction-remove-message-reaction-remove-event-fields
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
We can use raw events (and we do for some things) if we really wanted to get rid of the cache
But we don’t have a compelling reason yet I don’t think
@vale ibex i resolved the lint errors on cowsay
It's a scary and easy trap to fall into though, trying to debug the bot and wondering why your events don't dispatch
very epic
i am goig to merge without testing because i live oon the edge
wait lint is failing @clever wraith
lol
just delete half of it
lmfao
Make the limit 102 and hate it back
lol
If it passes I'm giving you a virtual cookie
No cookie, too bad
I gotta say though, I really appreciate you taking time to work on both smarter resources and arthur, tysm! 🍪
I am also on phone though haha
I always forget we have that
Get what?
It automatically appears in the file tab
We use a special format when reporting lint error instructing github to add those comments
living on the edge... now thats what i call webscale!
Pick which zone(s) that should have their cache purged :cloud_lightning:
wait emote in wrong place
lol
oo yea that isn't working
@clever wraith that code you removed for the devops check is actually meaningufl lol
Smh alias zone
hmmmm
I think we should be dynamically calculating the options
okay i'm gonna rewrite this a bit
I don't think using _is_devops is worth it
may I ask, what are you using for it?
discord.py v2.0 unstable stuff, some of the libraries or custom made?
:cloud: Pick which zone(s) that should have their cache purged
:white_check_mark: Cache cleared! The Cloudflare cache for pythondiscord.com was cleared.
WTF WTF DISCORD BOTS HAVE SELECTIONS NOW?!
bad king arthur
seriously, you don't let the user know they can't use a component?
so bad
smh
(/s)
arthur ed [-GVhs] [-p string] [file]
Ed is the standard text editor.
if any core dev/contributor has time, could they get around to merging sir-lancebot#760 ? its been approved and just needs a merge
wait what oops
Discord isn’t letting me mention wokie lol
smh wookie approving and not merging
Because it's wookie not wokie smh
i click green
Schsjdvehv
I typed it like that to please the autocorrect gods
lol
async def interaction_check(self, interaction: Interaction) -> bool:
"""Check the interactor is authorised."""
if interaction.user.id == self.authorization:
return True
await interaction.response.send_message(
generate_error_message(description="You are not authorized to perform this action."),
ephemeral=True,
)
return False
generate_error_message puts a ❌ on it
I like the x
arthur responses will always start with an emote
it does yeah, because it uses generate_error_message
arthur deploy restart xyz
:no_entry_sign: What is the airspeed velocity of an unladen swallow? Whatever the answer may be, it's certainly faster than you could select a confirmation option.
true true
because it's nice to have flexibility in future
there is no point standardising to the extreme now if I need to come back inn a month and undo it all
@clever wraith before you get started, an idea of what PRs you want to make would be nice, just so all revisions are approved and we don't have to remove some later on
(this really sounds like y'all should use issues to properly scope changes before work starts
)
yeah, I'd say open issues for other proposed changes, standardising the view is fine but I don't think it's a big deal
actually, I think I'd rather explicitly define checks
we can standardise the logic, but it feelss like that is something that could slip through reviews & cause problems
(cc @clever wraith)
yeah, I don't think Arthur is in need of any refactors right now
I can have a crack at it
we also have another new service in mind for devops but more on that in time
stuff to do with downtime monitoring on non-http services
batch
same namespace the cronjob is in
Hey, could a core dev take a look at that issue? I would appreciate it! 😄
api#16
assume default if not specified
but she doesn't like me back 😔
😢
kubectl create job test-job --from=cronjob/a-cronjob
@sharp timber Hey, I've noticed that the fuzz for invalid commands is a bit too sensitive sometimes, looks like its set to 60% sensitivity in https://github.com/python-discord/bot/blob/173203ff54b62e311070dcae94a26b64e14a5fb4/bot/exts/info/help.py#L129
I've done stuff myself, and in my own projects, I set it to 80%
bot/exts/info/help.py line 129
result = process.extract(default_process(string), choices, scorer=fuzz.ratio, score_cutoff=60, processor=None)```
Do you have examples of inaccuracies?
seems like a simple change of 60% to 80% isn't a solution, as it should have suggested "paste" for that one
I don't see an issue with having a lower threshold, since we list all of the suggestions anyway
it seems the issue is that it isn't matching at all in the second screenshot
It seems like that threshold is lower, because we have another fuzz with a higher threshold that auto-runs them
EG
!pastr
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
I don’t think this’ll work in this instance
This instance being the example you’ve provided
The examples are all tags
And tags use different scoring than what you linked
In fact it uses a custom built scorer
bot/exts/info/tags.py line 85
def _get_suggestions(self, tag_name: str, thresholds: Optional[List[int]] = None) -> List[str]:```
Thanks python. Very cool.
This is for tags, yeah
Not for normal commands
@patent pivot question, why does Metricity store usernames but not discrims?
We didn't ever need them, open to adding them though
Hmm yeah, I would be interested in having them
PR should be pretty simple, just adding discriminator to the models & adding a migration and then updating the data inserted
make sure it defaults to 0000 though because users that left won't have one
The site might actually have what I want
Isn't that a possible combination though?
Nah, discord doesn't allow it
Ah, it was 0001 I was thinking about
PR a fix that was generated by copilot LOL
lol that was generated by copilot?
yea lol was one of the few things i accepted
Why did you accept it lol
It's free code!
not by choice though right? 
Webhooks only though, right?
With a smallint you have -32768 to +32767
Just set it to -1
Or is it gonna be stored as a string?
Make it nullable?
nope, users
result of a thing a while ago where having your account disabled and re-enabled would give you a 0000 discrim
why did discord not run a migration for these users?
cause it doesnt matter
lemon#0000 when
Lemon indexing is 1-based
because he is written in lua
Hmmm the anti spam cog sometimes refuses to work for me for some reason on my test bot, not sure why
Any errors?
that's odd
have you tried adding trace logs to that cog?
I just have BOT_TRACE_LOGGERS=* in my .env because I'm lazy
The issue is that it just doesn't see the channel history for some reason
🤔
This returns an empty list
that's...odd
not sure if you have notifications turn off in the test server, but I think I found the issue 😄 #476196547324018688 message
Ah, I do. Thanks
I've found a few instances where the value passed for the lines parameter of the pagination util isn't t.List[str] as described by the typehint. Is this something I should open a PR for to fix? Instances of this below:```
list[str] | tuple[str]: https://sourcegraph.com/github.com/python-discord/bot/-/blob/bot/exts/recruitment/talentpool/_cog.py?L160
dict_values[str] | tuple[str]: https://sourcegraph.com/github.com/python-discord/bot/-/blob/bot/exts/moderation/watchchannels/_watchchannel.py?L318
tuple[str]: https://sourcegraph.com/github.com/python-discord/bot/-/blob/bot/exts/info/site.py?L136
tuple[str]: https://sourcegraph.com/github.com/python-discord/bot/-/blob/bot/exts/utils/utils.py?L79```
Not sure if this is something we want to fix to keep the code accurate or whether it's a case of "it works so don't bother"
Just use Sequence[str]
So you think it's worth opening a PR to fix this?
I don't see anything wrong with it, might as well. You could take the time to run mypy and Pyright on strict and correct some other type hints.
That way you'd fix them in batch
Just install mypy through pip, then restart your console and do mypy bot, bot being the folder of course
Pyright I am not sure, but mypy should be easy enough I think
I'll do mypy then 👍
Basically all the errors are just this @brisk brook
No clue what that means
"Skipping analyzing" or "Library stubs not installed"
You need to go pip install discord.py-stubs
Discord.py doesn't have type hints, so Mypy is saying "I can't find typehints, and there are no stubs that tell me the typings either"
Right yeah fair enough
What about the errors towards bottom for "dateutil"?
These ones
Huh, I don't know if there are stubs for dateutil, try doing pip install dateutil-stubs. They're usually called that
Otherwise you can ignore those, it's not a module that's used a lot, so it's fine.
Yeah, there's no matches so will just ignore that
Still getting these two after this```
bot\exts\moderation\infraction\management.py:9: error: Skipping analyzing "discord.ext": found module but no type hints or library stubs
bot\exts\moderation\infraction\management.py:10: error: Skipping analyzing "discord.ext.commands": found module but no type hints or library stubs
Is there a separate library for that or something?
discord.py stubs. Contribute to bryanforbes/discord.py-stubs development by creating an account on GitHub.
NOTE: Because discord.py uses namespace packages for its extensions, mypy must be configured to use namespace packages either with the --namespace-packages command line flag, or by setting namespace_packages = True in your mypy configuration file. See the import discovery section of the mypy documentation for more details.
How can I ignore certain errors, such as error: "Logger" has no attribute "trace"?
Since that's just because the bot uses some custom Logger thing
I suppose I can ignore all attribute errors but then might ignore something I don't want ignored
Apparently it's types-python-dateutil (got from running mypy --install-types)
150 errors at the moment @brisk brook lol
Some seem legit and others I'm not so sure
Lmaooo
Take a quick look at the ones that stand out, I don't think the goal is to make the bot pass the type checker
Just clean up issues similar to the first one we started talking about
👍
I don't know how to work on two branches at once with the bot so I'll wait for my current PR to get merged first so I don't accidentally mess stuff up
Hmmm a question about order. bot.utils has a cache.py file, but I want to add the cache logic I wrote to that directory in a separate file. What should I do about that? 🤔
So you want to put a separate unrelated cache under bot.utils but the current cache is taking up the name?
yeah lol
What kind of a cache it is? maybe there is a name or location that'd fit it more than just a plain cache, or the current cache module could be renamed to lru_cache if I remember its contents correctly
It caches messages
Currently for the antispam cog but has other potential uses
and yeah the other file is an lru cache for async functions
Hmmm.. why are we not using it more often 🤔
But yeah, I guess I'll rename one of them or both
thanks
for the most part redis is used because of its persistence, or handling for stale data would be needed, I'm not sure if there are many more uses for it
Currently it's used only in the pep cog. Which makes sense because links to peps don't really change
It could be used to save a few API calls to the rules endpoint. It's not a big deal either way
uhh why don't we sue lru cachec itself for caching the pep urls?
because it'd cache the coro returned by the coroutine function
yeah, (i thought it was containing some other caching logic, just saw it is a custom async implementation for lru cache)
It could also go in utils/messages.py or just stay in the cog if it doesn't seem like it could be used anywhere else.
It's over 200 lines and the inner logic of the class is irrelevant to anything that uses it, so I'd rather keep it in a separate file.
over 200 lines
This is when #esoteric-python python could help (I'm kidding pls don't)
Hmm how do I run the bot tests in pycharm?
right click on the tests dir and run tests, though I think the cwd may need to be changed to the project root
poetry run task test?
Hmm yeah the cwd was the issue. Thanks
I meant through the pycharm UI
oh idk lol sorry
np, Numerlor's answer was what I needed
~~use ui to open terminal, follow aru's advice
~~ /s
Pro tip: edit the template to include the cwd, that way all your future suites have it
Top notch ux after that by just clicking the bright green button beside file/suite/test name
That's a good tip
where I started:
"which [vscode] ext do you use for git?"
where I am:
"I type out most of my git commands"
(two quotes from me at different times)
I do everything via my terminal and you won't make me go out of the 80s era
lol @eternal owl the link to the issue on your draft PR is broken, could you please correct it?
@Moderators this guy is obviously using a tui to connect to discord which is against ToS
FIGURED THIS OUT:
#dev-contrib message
tl;dr the reason that the bots aren't getting typing events is because its a discord.py bug
no it isn't
what
!int socket
Receiving 2.01 events per second.
22,558
17,241
10,309
2,117
1,426
1,175
839
758
589
405
315
269
251
219
178
82
49
8
7
4
3
2
1
1
oh right, you didn't specify DMs lol, the thing you mentioned was not a discord.py bug
the message from kat was referencing a platform bug
ah
bot/bot.py line 116
intents.dm_typing = False```
lol
lol
we still don't receive user_update which again I think is platform
ah
Someone around who's familiar with the antispam cog? I'm a bit puzzled by how it was designed
last time I was going to work with it I was heavily considering a rewrite first, but some other issue came up
Yeah... I'm looking at this commit https://github.com/python-discord/bot/commit/14a67c187a38b9748fee375e15cfc9f6aa10fc6f and I can't really understand what problem it was trying to solve
Isn't that the code that actually groups messages?
So, say I was spamming in a channel. Without that code it would count as multiple spams because I used multiple messages.
This code sets up queues and those deletion contexts, which are simply groups of messages?
Or am I thinking about it incorrectly?
The code was already there, it was moved to a dedicated class
I just can't understand the commit message, because it works just fine on deleted messages
And also I don't see any call to a deleted messages endpoint, it just uploads them to a log
I'd assume from the code itself it's trying to prevent multiple log messages for the same spam event
Yeah if I strip the guards it tries to log it multiple times if I keep spamming after the filter is triggered
This one is to prevent a race condition where two messages are sent, and they both trigger anti-spam I believe
There is one problem, in the wikipedia quess game, the extract includes the full name but the title only includes the first and last name
another one, there is no specific differentiation between such articles so i can't filter these out
this is how i form the questions currently
ok looks like those are the only two things i need to catch now
for names maybe we can get the match between the first and the last name, and remove that completel?
I need to interact with the message cache to check for a deleted message, how can I access https://github.com/python-discord/bot/blob/main/bot/exts/moderation/modlog.py#L44
bot/exts/moderation/modlog.py line 44
self._cached_deletes = []```
actually, I don't think we should do that since the deleted messages are only viewable by mod+ (ig) and incidents can be seen by helpers
cc: @sharp timber
I'm not sure if we should rely on the cache. Maybe we could try it and fallback to scraping the history of the channel? Either way self.bot.get_cog("ModLog")._cached_deletes
We know, if an helper tries to click the link they would get a 403 page, which isn't a problem. It is a pain to find a linked message in the deletion logs, and #incidents is more of a mod tool either way.
hi
Hello!
Oh, Bast wanted to display the message directly
iam new to this server can i get some roles
Yeah, I feel like we should instead link to the log entry, although I'd like to hear Bast's input
They are all described in #roles :)
tq @green oriole
I don' t think we would be able to even show the content of deleted messages to helpers without a privacy police amendment, but I would have to double check that. I don't think it makes sense either way, that should be a mod only information.
we could scrap the channel history but then we would need to parse the embed and then how many messages would be iterate through, finding messages a week back also can be a lot of messages.
Actually finding old messages isn't possible if we see the cache also since it won't retain them after restarts 🤷♂️
@green oriole r u talking to me
I am taking to Jason
oh sorry
Well, I feel like we could assume that if a helper has a link to a deleted message it is in the last 50 entries or so. If it isn't, oh well, we can search manually.
Also we need to keep in memory what messages are linked in the incident channel, and if one of those messages are deleted then we want to link it. Kind of the other way around.
@green oriole i want roles and and i wanna learn python coding here
Right, I don't think I get you for the second part do you mean if a staff links a deleted message then we should show the link to log entry? That's what i am doing rn
I also mean the other way around, consider the following case:
- Someone sends a message X
- A staffer links the message X in #incidents
- The message X gets deleted
I would want the bot to add a link to the deletion log of the message X in incidents
oh, so if a message gets deleted after linking? I would need to edit the modlog on message delete trigger then
Cool, you could ask for resources in #python-discussion! As for the roles, everything is described in #roles.
cant u give me roles @green oriole
Yep! Or you could add an on_message_delete listener to the incident cog, that could keep things more simple I would say? Not sure, it may be hard to get the link to the log
I don't have the permissions to do so, and even if I did you didn't do anything worth of a role, as described in #roles
how do i get roles bud
oh ok dont get angry
Possibly yes 😄 I will do that
thanks
ok @green oriole where can i learn coding now
!resources you can have a look at our resources list
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
ok
@clever wraith to be clear, we do not give out roles randomly. If you have any other questions about roles, please ask in #community-meta. Thanks in advance!
ok
If I have a formula with -1 in two places, should I collapse it into a -2, or keep it separate if it makes the formula clearer?
I suppose I can put part of it in a separate variable to make it less obvious
Yeah ok, I know what to do

Exactly lol
It works lol
Yeah, this is completely reasonable. I was coming from the perspective that we'd want to show the message content (which is a point of the feature), with the gist that if we're forwarding message content then we need to be careful not to accidentally forward stuff if, say, someone accidentally has the wrong link in their buffer and pastes a link to a mod message, and that it would also (separately) be nice to get links to deleted message items.
!mute 503580753947394060
:incoming_envelope: :ok_hand: applied mute to @buoyant gulch until <t:1629574634:f> (59 minutes and 59 seconds).
You're in the wrong channel. You can discuss it in #python-discussion if you want.
bump :D
can two messages in the different channels have the same id?
ummm like?
rather than looking through the message history or the deleted cache, can i just make the deleted messages endpoint on the site GETable?
could probably add an addiontional key to deletedmessage_set for the modlog entry message link
for any admin: do you explicitly set permission for helpers to read #incidents?
if yes that would make my life easier to check if the role can read the channel or not
The roles that can read/write to the channel are partners, python community, and everyone above and including helpers
is it explicitly set, like it is green ✅ for their role? if that isn't and it is based on a category then discord.py sets the permission to None and I would need to look a level higher to get the true value
The green checkmark for helpers is set for view channel and send messages
it is not synced with the category that the channel is in
that should work I think, thanks xith :D
np
it does seem a bit surreal that people are contributing to features they can't even use 👀
lol
So I messaged in a help channel but @stable mountain didn't send me a DM regarding that channel... I have my DMs on and the setting enabled 
@vale ibex a heads up, the method used here https://github.com/python-discord/thread-bot/blame/main/bot/utils/helpers.py#L65 is already deprecated
🤔
!ping
You are not allowed to use that command here. Please use the #bot-commands channel instead.
bot/utils/helpers.py line 65
for thread in await channel.active_threads():```
!source Github
Unable to convert 'Github' to valid command, tag, or Cog.
Is bot#1742 okay to be merged now that it has passed all checks? (should probably unlink bot#1757 first though since it won't actually solve)
So.. There's an issue here
If it doesn't solve it, that means we still need the FetchedUser and FetchedMember converters, just with a different functionality
FetchedMember is still there, just renamed and will fallback to a discord.User (when the user isn't in server and ID was provided)
FetchedUser was removed
I know, but if FetchedUser is returned in another form then it's not just Member or User anymore
Then we update the variable I guess?
To like UserIdentifier or something
Which will be Union[discord.Member, discord.User, DatabaseUser]
Hmm I suppose
I think it makes more sense to create a DatabaseUser class than a FetchUser which tries User then fallsback to what would be DatabaseUser
Since I don't think we want a converter to be able to return multiple different types
From a quick look in converters.py there isn't any converter with this behaviour currently (other than the Unions like MemberOrUser) , and I think it should stay this way
Otherwise a converter type becomes ambiguous
Does that seem right? @cold island
@static canyon have you learned how to squash commits? If so, please do when this PR is ready to be merged.
If you haven't learned how to, here's a guide: https://www.notion.so/pythondiscord/Squashing-a-Pull-Request-191e8efa2fbb4d72840fd17ca37cf7fa
Which commits in particular need to be squished? The top abomination was squashed by Chrisjl but there's probably some after that which should be squished too tbf
The top stuff is still there. Will Chris be doing it at the end of the PR, or did he just forget to force push?
I see that too
I think Chris squashed something else
Yeah possibly
CC @vale ibex (if you can remember)
I'll squash if it needs to be done since learning opportunity lol
be sure to make a backup in case things go sideways
aka checkout to another branch, then switch back to the branch you intend to squash a bunch
@vocal wolf I think the issue was approved when I started working on it and later it moved to planning
My god, I think I may have did something wrong.
git reset --hard d697860f22d13063a064ebc5982dea2dc127b0f0
that's when everything was normal in your PR
@molten perch
same was the case for me, when i rebased main branch to my PR all this mess happened
(regarding enhancing incidents pr)
It shall be made clear within the issue next time.
Right, I also like the status:approved label on an issue to make it even clearer, like how it is done on sir lancebot
oh that's what I was forgetting about labels
we do have it on bot
yeah but it isn't used
I'm on it, it should be fine any minute 😂
alright
Never happened before 😄
I force pushed, but forgot to tell @static canyon to reset the local branch
it happens at least once to every dev
ah
It might be easier to just squash merge tbh
It seems like, I can't 😄 I managed to hard reset my local branch, but I can't seem to get it to the remote one.
git push --force?
Everything up-to-date
Wdym?
What do I need to do to squash the abomination?
Oh yeah, I was still in rebase mode, so I was in no branch
Phew 😅 Thank you! 😄
So embarassing. Never happened before, this rebasing made everything chaotic. Sorry! 🙂
It's no problem, really. I tried reviving a 2 year old PR and ended up doing the same thing, but instead with 3k commits.
It's actually very simple:
First, pick a commit to base on. If the tree looks like this:
A - B - C - D - E - F
And you want to squash A and B, then copy the SHA of C.
Now do git rebase -i MY_SHA_FOR_C, it will open a textfile in your editor where you can change the verb to the left of the SHAs.
In this case you want to squash A and B, but more importantly, you want to squash A into B. So change pick to squash or s for A.
Finally save and close the file, it will open another that will allow you to specify the commit message. Edit it and save, then the rebase should finish
Can I do like "move commit a,b,d into g"? (skipping commits)
😂 Alright, fortunately that's what git made for! 🙂
I guess not since that would also change c,e,f
Remember to always refer to the website https://dangitgit.com/en
I want to "group" these into "Remove redundant..." "Update..." and "Remove unused..." (13 commits into 3)
Yes, you can reorder the commits by moving the lines around. So say you want the order to be A - C - B - D.
You'll change ```
pick A Some text
pick B Other thing
pick C I don't know
pick D Final message
Into ```
pick A Some text
pick C I don't know
pick B Other thing
pick D Final message
You can also squash at the same time, so let's say we want it to be A - D. The file will look like this: ```
pick A Some text
squash C I don't know
squash B Other thing
pick D Final message
Now we squash C and B *into* D. So C, B, and D all become the same commit
We have the option to squash everything into 1 commit when merging to main via the github ui
But using the opportunity to learn could be good
Right yeah that seems to make sense. I won't be able to actually do this for quite a few hours but am I okay to @ you when I do?
Yeah, I would like to at least try
If I fail then we can do that lol
Yeah that's fine 👍
The reason it went wrong before is because I squashed on my local branch and pushed, but forgot to tell you to reset your local branch, so the next time you pushed, you pushed all of the other commits too
@static canyon make dat backup if you haven't already
Feel free
dat backup?
Like copy all the files?
I mean, we still want to keep some of the history. Rather than just getting one commit
While on your branch that you're trying to squash, before you do anything major with the git history rewriting, git checkout -b backup-remove-redundant-converters or whatever you prefer. Then checkout back to the branch that you want to do all the crazy stuff on and continue from there.
Right, so making an duplicate branch in case things go south?
ye
👍
@molten perch ty for PR, works very well
.bm
.bm
lots of review requests 👀
@slim widget you available?
If so, please review this here thingy: https://github.com/python-discord/bot/pull/1749
I think we already have enough people reviewing that tbh
only akarys that i know of
My pleasure! 😄
I'd like the other one to be finished first before allocating people to this PR.
I will see if I can allocate some time for modpings schedule next week
This is totally selfish but I really want this feature :3
Also it is being merged
cool
!remind @molten perch 10s 
Your reminder will arrive <t:1629625061:R> and will mention 1 other(s)!
@molten perch
Here's your reminder: :partygopher:
[Jump back to when you created the reminder](#dev-contrib message)
Yaay, can you delete your message before the reminder arrives? Just to make sure 😄
Oh, wait I can also 😄
Your reminder will arrive <t:1629625157:R>!
@vocal wolf
Here's your reminder: test
[Jump back to when you created the reminder](#dev-contrib message)
Perfect :3
I think @tawdry vapor mentioned it in one of the issues.
what was the conclusion?
So, I took the liberty and added it 😄
When a lot of messages has been sent, it could sometimes show up as "Message could not be resolved". I think the link should be there
And we got a sentry
There was an error when trying to reply to a reminder invocation message, 400 Bad Request (error code: 50035): Invalid Form Body
In message_reference: Unknown message, fall back to using jump_url
Which is from this one it seems like
oh we didn't need that high of a log level then
Actually
Don't you need an non empty message to be able to reply?
!remind 1s test
Your reminder will arrive <t:1629625379:R>!
Here's your reminder: test
[Jump back to when you created the reminder](#dev-contrib message)
I make fast PR
Yeah, I'm not sure why I left it on "error" level, right after that it falls back to the jump_url behaviour 😄
So, it's expected.. I believe.
I've just noticed your branch name for the reply PR, this is a galaxy brain move
I thought no-one would notice 
@green oriole k here https://github.com/python-discord/bot/pull/1761
@vale ibex review
LOL I like how this is an order

Review now, or.. I can't find a great pun

I've never approved on mobile before, is it even possible?
within the github app
ok
no
that's not fair lmao

I disabled it, how did you still merge??
I manually merged
ah fuck
lol I reviewed quite a few little PRs on mobile
github didn't give me that option
wait I disabled it and that gave you the power to do so
damn
lol
lol you glitched github
Auto merge is quite buggy if the PR switches to a mergeable state
@vale ibex ty anyways
Yeah, you get exactly that
If you refresh it goes away and you have the green button
Your reminder will arrive <t:1629626103:R>!
@vocal wolf
Here's your reminder: test
[Jump back to when you created the reminder](#dev-contrib message)
Sorry, just saw this.
it is the np
Akarys is fast 😄
Hi
Hello
I'm on my laptop now, how do move these around? What's the terminal command?
I have a-l and I want to make it intopy a b m # 3 commits into one c d e f g i k # 7 commits into one h j l # 3 commits into one
So if the commit is https://github.com/python-discord/bot/pull/1742/commits/cbb5914bf8fa510550d9b2b6cb1b0569ccea396c then the SHA is the cbb59...396c right?
Yup
PS C:\Users\tizzy\bot> git rebase -i cbb5914bf8fa510550d9b2b6cb1b0569ccea396c
error: cannot rebase: You have unstaged changes.
error: Please commit or stash them```
It's because I changed the config-default.yml but don't want to commit that change
You can stash it then
I forget the exact syntax, but git stash --help should tell you
what did you change the default config for?
So that I didn't get a whole load of env issues when running a linter or something
the user config file should take priority for all keys
I changed bot: token from !ENV "BOT_TOKEN" to just "BOT_TOKEN" so that I didn't get errors about missing env variable
Why use the config-default.yml for that, why not just use config.yml?
There isn't a config.yml
you're supposed to create it, it's not a tracked file
So revert the change in config-default.yml and make the change in config.yml instead?
Just do git stash, then git stash pop when you're done
yes, just copying the changed part of the config to config.yml should work fine
So having config.yml asyml bot: token: "BOT TOKEN"?
yeah I think that should work
Okay, done
It still thinks there's a change in the config-default.yml so I'll have to stash anyway
revert the file
How?
Just stash it, reverting is a bit scary
I'll just stash for now since I'm meant to be doing squashing right now lol
git checkout config-default.yml
if they keep the changes around stashing for every change to the branch will be a pita
Did this 👍
Now git diff isn't showing the file so guess it worked
Right, what do I do after this?
In subcommands, if you give it aliases like: append -> a you still need to do group a. Root aliases allow you to set an alias so for example agroup will call the subcommand
Perfect, start with reordering them as you wish. Remember that commits squash down so you will have to reorder them to be next to each other
Can I also edit commit messages?
For the ones I'm going to use as a base
(Just out of interest)
So when you squash you will get a chance to edit the message
Actually no
Otherwise you can change the verb pick to edit. This will stop the rebase and allow you to amend the commit
I think I rebased the wrong thing
It's showing commits made after not before
It's showing from the first one made after (the bottom in image)
@brisk brook
And you want to change the first few?
Yes
Everything before (and including) cbb5914
I rebased cbb5914 and it's showing everything after
"quit it"?
Close the file, it's open in an editor so close that tab
PS C:\Users\tizzy\bot> git rebase -i cbb5914bf8fa510550d9b2b6cb1b0569ccea396c
error: nothing to do```seems to have worked
So I guess I need to git rebase -i 6dfe53b... (the top commit)?
So remember, a Git commit history is a one-way timeline (append-only).
You can't do something before a commit and have it not change subsequentl commits.
What you'll have to do is pick more commits to rebase, but just change the bottom ones you don't want to change.
Is that "Remove redundant converters"?
Yes
Pick the one before it
There is, it's in the bot's branch.
\ |
\ |
\ |
\|
| <- This commit
Left is your branch, right is the bot branch. GitHub only shows the difference, that is, the commits you have but the main branch doesn't.
Yes, those are normal discord.py names
Right
So I need to find when I made the branch I guess
(How do I do that? xD)
#dev-log works I guess
This is probably easiest done locally, from the perspective of Git. Where your branch still is a straight line.
Do git log and press ENTER to scroll
#dev-log message this is it
I don't know, you're really not meant to haha
I don't think so?
That's the last commit before I opened the branch
Because the message after it is me opening the branch
Although that's in a branch, not main, so nvm I guess
Exactly. I think this might be it? https://github.com/python-discord/bot/commit/d5ee28133f8e792526716b07d25cbf6e4faba3a1
#dev-log message this I guess
I opened the commit you linked above, and pressed Parent
You don't really know though, when did you create the branch?
11th aug #dev-log message
Like I said, just type git log and find the commit before "Remove redundant converters"
Git will know
wait this issn't stafff liunge LOL
So the one you linked from the looks of it
6dfe is my first, d5ee is the one before
So git rebase -i d5ee...? @brisk brook
Yep!
I am on my phone ATM, I can't read that text file. A screenshot will be fine
Change every pick except the first one to squash
This is the point where I plug GUIs
After (have only changed order)
Git User Interfaces*
I don’t think git will handle that particularly wel
Maybe it’ll just ignore it
You don’t need to change the order though
changing the rebase actions is relatively fine, but for resolving the conflicts that may come up I'd always go through a gui
I’ve got some fun aftermath stuff from today’s PATMA event
This is the entirety of the sentry error log for the bot. The 403s were just misconfigurations of perms. It speaks to the quality of @stable mountain since the code is just copied from there 😛
What exactly do I need to do now?
For squashing, keep the order the same, and just change the ‘pick’ beside each commit
For commits you want to keep, leave it as pick
For ones you want squashed into others, use squash instead of pick
Then save and close the file
There are other keywords that are used for things that aren’t squashing
You may be able to see them in a comment somewhere, possibly in your terminal
they are in the generated file
More event stuff. This is my DO panel for snekbox (just snekbox, the bot ran in a separate instance). It managed really well as far as I could tell. You can actually see right about when the event started 🤡. No major problems though (now if they’d just pay for my personal cloud)
But how does it know what to squash into what?
This is what I'm trying to do @gritty wind
It’ll merge them into the commits on top (older) of them
For instance, if you have commits a, b, c, d (a being oldest), squashing b and c will result in:
- a, b, c
- d
Trying to jump up to the message, but mobile is being funky
I see your message now
So, if your oldest commit is a, you’d want to make sure you have b and m right below it, set a to pick, b and m to squash, and you’ll end get what you want
You may end up with conflicts though
An alternative to this approach is to reset your current branch to the base revision you checked out from using ‘soft’
What that’ll do is it’ll drop all your commits, but keep the actual current version of things
Which is why I need to reorder the commits?
Yeah
Which is what I'm doing here, right?
Do I need to change to squash too or just reorder?
I believe so, tho I only saw the abbreviated titles, not the actual commit names
Yeah, you need to change to squash
Or tennis if you’re into that
Lol
Will the commit have the name of a?
You’ll get another prompt to edit the message
It’ll show all three together, and you get to mold them as you like
Right yeah
I'll do that now
How do I delete a commit? @gritty wind
I have duplicates from when Chrisjl squashed earlier but forgot to tell me I had to reset my local branch or something
So are you deleting them just from history, or do you want to remove the changes too
Hmm
Just history, because there wasn't any changes made (the ones I'm deleting are squashes)
Okay
You can just squash them into any other commit, and provided the same code existed at the commit you’re merging to, it’ll disappear from history
I.E if commit C has the same code as commit B, squashing C into B will make it disappear (you just need to remove the message)
Fixup may also do this thing, but I’ve never used it
Have you considered this? I find it usually the best option when you’re basically completely rewriting your branch
I'm interested in doing it this way just cause I'm learning a lot about git
In that case, do look into fixup haha
I'm so scared I'm gonna do this wrong lol
But I guess that's why I made the backup branch
You do also have GitHub
Think this is right
2,3 merges into 1
5,6,7,8,9 merges into 4
11,12,13 merges into 10
15 merges into 14
Yes that looks good
There's 3 lines that don't have a #.
The first line will be the commit message, if you have more lines under it those will become the description
Remove the other uncommented lines, you don't need them
So this?
PS C:\Users\tizzy\bot> git rebase -i d5ee28133f8e792526716b07d25cbf6e4faba3a1
...
error: could not apply a0f079d7... Rename converter from FetchedMember to MemberOrUser
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply a0f079d7... Rename converter from FetchedMember to MemberOrUser
Auto-merging bot/errors.py
CONFLICT (content): Merge conflict in bot/errors.py
Auto-merging bot/converters.py
PS C:\Users\tizzy\bot>```
I got an error
Not really sure what the conflict is
open that file in a gui editor
What happened was that when you reordered it Git couldn't merge the two files. You probably changed two things at the same time
You will see something like: ```
<<<<<<<< AAAAHHHHH
from collections import abc
from collections.abc import XYZ
AAAHHHGGG
AAAAHHHHH
wait what
Yeah I've done a whole load of conflicts
Now got the Successfully rebased and updated refs/heads/remove-redundant-converters.message
No clue what to do now though lol @brisk brook
Do git log and check the history
I appear to still have a duplicate (top and bottom)
Ah wait no I know why
I now need to remove 3 commits from the history
Right okay
I think it's good locally
Ah okay
So what do I do now?
git push presumably
Hopefully I'm in the correct branch and stuff
then uh, git status
to check this, do git status
something like this:
PS C:\Users\tizzy\bot> git push
To github.com:python-discord/bot.git
! [rejected] remove-redundant-converters -> remove-redundant-converters (non-fast-forward)
error: failed to push some refs to 'github.com:python-discord/bot.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
PS C:\Users\tizzy\bot>```
But I don't want to
you changed the history, you need to force the push
oh
git push -f?
ye
git fetch doesn't make a commit
git fetch just checks if there's been any changes on the remotes
I think you're thinking of git pull
which internally runs git fetch && git merge (tldr)
as an aside I tend to run git fetch --prune which removes references to deleted branches on the default remote
31 comments to 15 😄
It looks like everything's correct too which is always nice
Can someone please confirm that I've done this squashing correctly on bot#1742?
Also @green oriole I forgot "solves" isn't a term for linking a PR with an issue so bot#1763 has to be closed (not sure how to manually link them)
If it's just a case of closing I can do that but wasn't sure whether I needed to link it to the PR first
Okay 👍
Can you double check this pls if you get a chance
They are all different fixes
But I suppose they could be
I think the rename should be separate at least
The last three were a case of "commit, lint failed. Fix the lint issue, commit, etc.."
Yeah, just fixed it ^^
Cool
@vale ibex I don't have too much experience with that, but are you sure https://github.com/python-discord/bot/pull/1762/files#diff-ea2117893ba180856952bc6c6734b882f9554bc4dfe169bcc344b5d65054fc95R45 will work as intended?
Looking at https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Cog.cog_command_error it seems to expect a CommandError
I believe you need to re-review for it to acknowledge it's been changed btw
Yeah I know, was just going over the commits one last time
👍
it works, I guess the typehint isn't correct though
I copied it from elsewhere
Does changing the typehint change the exceptions being directed to the function?
Calling type() on that error still shows it as a commanderror
so it doesn't seem like it
guess they don't pass through converters
Odd
Well I'm not sure how to functionally test it
uhhh, you can test it using your metabase username and password implicitly via the export
Actually, you can test the share too, as long as you choose a question that's already marked as publicly shareable
You can edit the message 😔
that's how I'm doing it lol
I just thought I'd mention it since @radiant merlin doesn't remove his buttons 
Should I make a quick PR for bot#1750? It's just changing the time format used
Go for it 😄
Also, small note that I've finished implementing the interactions side of this, buttons are really nice to work with in d.py
bot#1766 reviews please (literally just changing a timestamp format)
Probably match a member, should we move the mentions to the end?
I'm guessing the user converter got greedy, and there are people named 3D and maybe
There is a user named 3D because I accidentally muted them the other day
I wonder if we should be stricter with those converters, since we don't really want to match strings there
feels the fix in that case would be to make a param user converter to be only checking for mentions or IDs
!src remind
Commands for managing your reminders.
!remind Chrisjl#2655 1s test
You can't mention other members/roles in your reminder!
!remind 3D 1s test
You can't mention other members/roles in your reminder!
yep, its a user
MentionOrID is already a converter so I guess you can use that
!remind A Real Username#8028 1s test
it's using the dpy converters for members
should switch to using those instead, then
lol
!remind "A Real Username#8028" 1s test
oh yea, it's using the user converter there
It uses Union[discord.Member, discord.Role]
🍪
but with a cookie