mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
Fixed "ignoring old msg_id" warnings on session start
This commit is contained in:
parent
1ffbca1b51
commit
08f58e3d0a
15
EXAMPLES.md
15
EXAMPLES.md
|
|
@ -123,7 +123,7 @@ await client.SendMessageAsync(chats.chats[chatId], "Hello, World");
|
|||
```
|
||||
Notes:
|
||||
- This list does not include discussions with other users. For this, you need to use [Messages_GetAllDialogs](#list-dialogs).
|
||||
- The list returned by Messages_GetAllChats contains the `access_hash` for those chats. Read [FAQ #4](FAQ.MD#access-hash) about this.
|
||||
- The list returned by Messages_GetAllChats contains the `access_hash` for those chats. Read [FAQ #4](FAQ.md#access-hash) about this.
|
||||
- If a basic chat group has been migrated to a supergroup, you may find both the old `Chat` and a `Channel` with different IDs in the `chats.chats` result,
|
||||
but the old `Chat` will be marked with flag [deactivated] and should not be used anymore. See [Terminology in ReadMe](README.md#terminology).
|
||||
- You can find a longer version of this method call in [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs)
|
||||
|
|
@ -217,12 +217,23 @@ var participants = await client.Channels_GetAllParticipants(channel);
|
|||
```
|
||||
|
||||
<a name="join-channel"></a>
|
||||
### Join a channel/group by @channelname
|
||||
### Join a channel/group by their public name or invite link
|
||||
* For a public channel/group `@channelname`
|
||||
If you have a link of the form `https://t.me/channelname`, you need to extract the `channelname` from the URL.
|
||||
You can resolve the channel/group username and join it like this:
|
||||
```csharp
|
||||
var resolved = await client.Contacts_ResolveUsername("channelname"); // without the @
|
||||
if (resolved.Chat is Channel channel)
|
||||
await client.Channels_JoinChannel(channel);
|
||||
```
|
||||
* For a private channel/group/chat, you need to have an invite link
|
||||
Telegram invite links can typically have two forms: `https://t․me/joinchat/HASH` or `https://t․me/+HASH` *(note the '+' prefix here)*
|
||||
To use them, you need to extract the `HASH` part from the URL and then you can use those two methods:
|
||||
```csharp
|
||||
var chatInvite = await client.Messages_CheckChatInvite("HASH"); // optional: get information before joining
|
||||
await client.Messages_ImportChatInvite("HASH"); // join the channel/group
|
||||
// Note: This works also with invite links of public channel/group
|
||||
```
|
||||
|
||||
<a name="add-members"></a>
|
||||
### Add/Invite/Remove someone in a chat
|
||||
|
|
|
|||
2
FAQ.md
2
FAQ.md
|
|
@ -82,7 +82,7 @@ After that, you should be able to see/install the pre-release versions in your N
|
|||
This happens when you connect to Telegram Test servers instead of Production servers.
|
||||
On these separate test servers, all created accounts and chats are periodically deleted, so you shouldn't use them under normal circumstances.
|
||||
|
||||
You can verify this is your issue by looking at [WTelegram logs](EXAMPLES.MD#logging) on the line `Connected to (Test) DC x...`
|
||||
You can verify this is your issue by looking at [WTelegram logs](EXAMPLES.md#logging) on the line `Connected to (Test) DC x...`
|
||||
|
||||
This wrong-server problem typically happens when you use WTelegramClient Github source project in your application in DEBUG builds.
|
||||
It is **not recommended** to use WTelegramClient in source code form.
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@ namespace WTelegram
|
|||
if (msgIds == null)
|
||||
{
|
||||
msgIds = new long[msgIdsN];
|
||||
for (int i = 0; i < msgIdsN; i++) msgIds[i] = msg_id;
|
||||
msgIds[0] = msg_id;
|
||||
msg_id -= 300L << 32; // until the array is filled with real values, allow ids up to 300 seconds in the past
|
||||
for (int i = 1; i < msgIdsN; i++) msgIds[i] = msg_id;
|
||||
return true;
|
||||
}
|
||||
int newHead = (msgIdsHead + 1) % msgIdsN;
|
||||
|
|
|
|||
Loading…
Reference in a new issue