Fix potential conflict on System.Collections.Immutable

This commit is contained in:
Wizou 2024-04-16 15:19:12 +02:00
parent 8c271f50f6
commit 1d07039f04
10 changed files with 18 additions and 15 deletions

View file

@ -7,7 +7,7 @@ namespace WTelegramClientTest
{
static class Program_DownloadSavedMedia
{
// go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number
// go to Project Properties > Debug > Launch Profiles > Environment variables and add at least these: api_id, api_hash, phone_number
static async Task Main(string[] _)
{
Console.WriteLine("The program will download photos/medias from messages you send/forward to yourself (Saved Messages)");

View file

@ -9,7 +9,7 @@ namespace WTelegramClientTest
// This code is similar to what you should have obtained if you followed the README introduction
// I've just added a few comments to explain further what's going on
// go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number
// go to Project Properties > Debug > Launch Profiles > Environment variables and add at least these: api_id, api_hash, phone_number
static string Config(string what)
{
if (what == "api_id") return Environment.GetEnvironmentVariable("api_id");

View file

@ -75,7 +75,7 @@ namespace WTelegramClientTest
var parts = databaseUrl.Split(':', '/', '@');
_sql = new NpgsqlConnection($"User ID={parts[3]};Password={parts[4]};Host={parts[5]};Port={parts[6]};Database={parts[7]};Pooling=true;SSL Mode=Require;Trust Server Certificate=True;");
_sql.Open();
using (var create = new NpgsqlCommand($"CREATE TABLE IF NOT EXISTS WTelegram_sessions (name text NOT NULL PRIMARY KEY, data bytea)", _sql))
using (var create = new NpgsqlCommand("CREATE TABLE IF NOT EXISTS WTelegram_sessions (name text NOT NULL PRIMARY KEY, data bytea)", _sql))
create.ExecuteNonQuery();
using var cmd = new NpgsqlCommand($"SELECT data FROM WTelegram_sessions WHERE name = '{_sessionName}'", _sql);
using var rdr = cmd.ExecuteReader();
@ -134,7 +134,7 @@ HOW TO USE AND DEPLOY THIS EXAMPLE HEROKU USERBOT:
- In Visual Studio, Clone the Heroku git repository and add some standard .gitignore .gitattributes files
- In this repository folder, create a new .NET Console project with this Program.cs file
- Add these Nuget packages: WTelegramClient and Npgsql
- In Project properties > Debug > Environment variables, configure the same values for DATABASE_URL, api_hash, phone_number
- In Project properties > Debug > Launch Profiles > Environment variables, configure the same values for DATABASE_URL, api_hash, phone_number
- Run the project in Visual Studio. The first time, it should ask you interactively for elements to complete the connection
- On the following runs, the PostgreSQL database contains the session data and it should connect automatically
- You can test the userbot by sending him "Ping" in private message (or saved messages). It should respond with "Pong"

View file

@ -10,7 +10,7 @@ namespace WTelegramClientTest
static WTelegram.UpdateManager Manager;
static User My;
// go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number
// go to Project Properties > Debug > Launch Profiles > Environment variables and add at least these: api_id, api_hash, phone_number
static async Task Main(string[] _)
{
Console.WriteLine("The program will display updates received for the logged-in user. Press any key to terminate");

View file

@ -8,7 +8,7 @@ namespace WTelegramClientTest
{
static WTelegram.Client Client;
// go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number
// go to Project Properties > Debug > Launch Profiles > Environment variables and add at least these: api_id, api_hash, phone_number
static async Task Main(string[] _)
{
Console.WriteLine("The program demonstrate how to handle ReactorError. Press any key to terminate");

View file

@ -16,7 +16,7 @@ namespace WTelegramClientTest
static readonly Dictionary<long, User> Users = [];
static readonly Dictionary<long, ChatBase> Chats = [];
// go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number
// go to Project Properties > Debug > Launch Profiles > Environment variables and add at least these: api_id, api_hash, phone_number
static async Task Main()
{
Helpers.Log = (l, s) => System.Diagnostics.Debug.WriteLine(s);