Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add port configuration #32

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Add port configuration #32

wants to merge 4 commits into from

Conversation

SayuShira
Copy link

This isn't exactly what's described in #8 but it's a working solution for me. I run DiscordPtb (beta client) alongside the normal Discord client. And of course it usually tries to connect to the wrong one.
This lets me specifically set the port the websocket uses.


Added a number input to choose the port, with a big tooltip.
Along with a button to reconnect and a small label showing if its connected or not.

I also added a subcommand /whostalking port <number>.


If you are interested, but want some changes please let me know. If you are not I would still appreciate a heads-up so I'm aware.
Thank you for the amazing plugin!

Copy link
Owner

@sersorrel sersorrel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks basically plausible to me – thanks! it will probably be a while before I get around to merging/testing/publishing an update, but it's on my to-do list.

do you know if there's any way we can display any information about which Discord instance we're connected to? e.g. does the READY payload we receive contain any information that differs between release and PTB apps? I presume there's not, but it would be nice to know for sure one way or the other

public void ReconnectDiscord() {
this.Connection.Dispose();
this.Connection = new DiscordConnection(this);
this.disposeActions.Push(() => this.Connection.Dispose());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will cause this.Connection to be disposed multiple times, right? since the constructor already pushes one of these.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure if the pushed one still works after replacing this.Connection with a new instance of DiscordConnection. I presumed it would not since the reference that was pushed into the stack points to a no-longer used instance of DiscordConnection. But i might be totally of the mark

@SayuShira
Copy link
Author

SayuShira commented Jan 18, 2025

There is a way to distinguish the instances. It's even logged into /xllog. It's part of the string you get when establishing the connection. The "api_endpoint" contains the url which is //discord.com vs //ptb.discord.com. Actual strings might differ slightly, writing from memory as i'm not logged in rn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants