How to get a character Name from their characterID

So, contradicting another of my posts I was wondering:

How can I get a characters Name from their CID?

If possible could I have it in the exact JSON data that is sent to and from the server?

I need it so that I can

  1. Add as a part of the new request feature to the bot client.
  2. So that I can begin adding a feature that will allow players to create locked or unlocked gifts around sinder.

I am not sure if I understand you correctly. But, yes, you can also use getChar with character ID.

The getChar method can either take the name:

// The name is normalized, so it doesn't have to match case or diacritics.
{ "charName": "accipiter nisus" }

Or it may take a character ID:

{ "charId": "c0n144ot874c2tqpubpg" }

Both will return the same character model:

{
  "id": "c0n144ot874c2tqpubpg",
  "name": "Accipiter",
  "surname": "Nisus",
  "gender": "Male",
  "species": "Wolf",
  /** .. and more ... **/ 
}
1 Like

Hmmm… How weird, I seem to only be getting this:

{"result":{"rid":"<rid>"}}

Of course I was able to split it by the “.”'s and use the character id within the substring.

That response indicates that Resgate does not think the client can handle RES protocol v1.2 style resource responses.

Or to say it in another way:

It seems the client you use to connect to Resgate from Python doesn’t send an initial version request. Because of this, Resgate will instead just reply with the resource ID rather than the full resource, simply because it assumes it is an older client.~

Scrap that.
I realize it just means that Resgate has previously already sent this information to the client, so it assumes it does not need to re-provide the model again.

Edit
And the reason can be that:

  1. You called it twice for the same character. First time you got the data. Second time you only get the rid response, as Resgate has already sent the data to you the first time.
  2. You have already received the character model by fetching the awake list or some other list where that character was included.
1 Like

What Python client are you using?

1 Like

Am am using python 3.11
Using websocket-client to connect to the server.

Ah okay. I believe the bot already fetches the awake list on boot, I will see if I can store this info and use that.
Gimme a second to get it set up ^w^

I see.
Yes, to simply use a WebSocket connection is possible. But it is not my recommendation. And it is meant that you’d use a client library that implements the RES Client protocol to simplify this communication.

And part of that is to keep some kind of store of all the model/collection data that Resgate sends. Since if Resgate has sent it before (and if your client hasn’t decided to unsubscribe to the data), it will not resend it. This is of course to minimize the amount of data sent over the connection.

1 Like

because it’s always more fun to debug the desync problems, isn’t it? :grinning_face_with_smiling_eyes:

1 Like

Yeah, I dont see very many good python RES clients at all >w<
and this bot was a re-write of @FoxLancaster-Okami’s original bot. hence the websocket.
I may end up re-writing the bot and adding in a python specific RES client for it but that may take a while >w<

Fox’s bot is a pretty straightforward state machine so it doesn’t trip over the persisted state. My dart library is almost there in terms of feature parity with the official JS client (good enough to run the UI), but my rust library is stuck at the same caching issue (who’d have thought that all those RID references are a PITA for a non-GC language?). If you don’t have lots of business logic, I’d suggest to switch to either JS or dart.

1 Like

Yeah, that’s gonna be a big no from me, I don’t have any experience in JS or dart. while I could learn I really want the bot to be in python for it’s simplicity.

Yes, I think apart from the libraries I’ve written for javascript and C# .NET, @farcaller’s libraries are probably the most advanced and feature complete.

But considering how often Python pops up, I probably should try to write one based on the C# lib.

Ouch. Yes. … I can surely imagine!
I haven’t tried much in Rust yet, but I can see how it can become painful!

1 Like