fix: some build & linter warnings
This commit is contained in:
@@ -1,26 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using AsyncFormUpdates.forms;
|
||||
using TelegramBotBase;
|
||||
using TelegramBotBase.Builder;
|
||||
|
||||
namespace AsyncFormUpdates
|
||||
{
|
||||
class Program
|
||||
internal class Program
|
||||
{
|
||||
static TelegramBotBase.BotBase bot = null;
|
||||
private static BotBase __bot;
|
||||
|
||||
static void Main(string[] args)
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
String apiKey = "APIKey";
|
||||
var apiKey = "APIKey";
|
||||
|
||||
bot = BotBaseBuilder.Create()
|
||||
.QuickStart<forms.Start>(apiKey)
|
||||
__bot = BotBaseBuilder.Create()
|
||||
.QuickStart<Start>(apiKey)
|
||||
.Build();
|
||||
|
||||
bot.Start();
|
||||
__bot.Start();
|
||||
|
||||
var timer = new Timer(5000);
|
||||
|
||||
@@ -30,19 +28,19 @@ namespace AsyncFormUpdates
|
||||
Console.ReadLine();
|
||||
|
||||
timer.Stop();
|
||||
bot.Stop();
|
||||
__bot.Stop();
|
||||
}
|
||||
|
||||
private static async void Timer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
|
||||
foreach(var s in bot.Sessions.SessionList)
|
||||
foreach(var s in __bot.Sessions.SessionList)
|
||||
{
|
||||
//Only for AsyncUpdateForm
|
||||
if (s.Value.ActiveForm.GetType() != typeof(forms.AsyncFormUpdate) && s.Value.ActiveForm.GetType() != typeof(forms.AsyncFormEdit))
|
||||
if (s.Value.ActiveForm.GetType() != typeof(AsyncFormUpdate) && s.Value.ActiveForm.GetType() != typeof(AsyncFormEdit))
|
||||
continue;
|
||||
|
||||
await bot.InvokeMessageLoop(s.Key);
|
||||
await __bot.InvokeMessageLoop(s.Key);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using TelegramBotBase.Attributes;
|
||||
using TelegramBotBase.Base;
|
||||
using TelegramBotBase.Form;
|
||||
@@ -11,19 +7,19 @@ namespace AsyncFormUpdates.forms
|
||||
{
|
||||
public class AsyncFormEdit : FormBase
|
||||
{
|
||||
[SaveState]
|
||||
int counter = 0;
|
||||
[SaveState] private int _counter;
|
||||
|
||||
int MessageId = 0;
|
||||
private int _messageId;
|
||||
|
||||
public override async Task Load(MessageResult message)
|
||||
public override Task Load(MessageResult message)
|
||||
{
|
||||
counter++;
|
||||
_counter++;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public override async Task Action(MessageResult message)
|
||||
{
|
||||
await message.ConfirmAction("");
|
||||
await message.ConfirmAction();
|
||||
|
||||
switch (message.RawData ?? "")
|
||||
{
|
||||
@@ -41,14 +37,14 @@ namespace AsyncFormUpdates.forms
|
||||
var bf = new ButtonForm();
|
||||
bf.AddButtonRow("Back", "back");
|
||||
|
||||
if (MessageId != 0)
|
||||
if (_messageId != 0)
|
||||
{
|
||||
await Device.Edit(MessageId, $"Your current count is at: {counter}", bf);
|
||||
await Device.Edit(_messageId, $"Your current count is at: {_counter}", bf);
|
||||
}
|
||||
else
|
||||
{
|
||||
var m = await Device.Send($"Your current count is at: {counter}", bf, disableNotification: true);
|
||||
MessageId = m.MessageId;
|
||||
var m = await Device.Send($"Your current count is at: {_counter}", bf, disableNotification: true);
|
||||
_messageId = m.MessageId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using TelegramBotBase.Attributes;
|
||||
using TelegramBotBase.Base;
|
||||
using TelegramBotBase.Form;
|
||||
@@ -11,18 +7,18 @@ namespace AsyncFormUpdates.forms
|
||||
{
|
||||
public class AsyncFormUpdate : AutoCleanForm
|
||||
{
|
||||
[SaveState]
|
||||
int counter = 0;
|
||||
[SaveState] private int _counter;
|
||||
|
||||
|
||||
public override async Task Load(MessageResult message)
|
||||
public override Task Load(MessageResult message)
|
||||
{
|
||||
counter++;
|
||||
_counter++;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public override async Task Action(MessageResult message)
|
||||
{
|
||||
await message.ConfirmAction("");
|
||||
await message.ConfirmAction();
|
||||
|
||||
switch (message.RawData ?? "")
|
||||
{
|
||||
@@ -40,7 +36,7 @@ namespace AsyncFormUpdates.forms
|
||||
var bf = new ButtonForm();
|
||||
bf.AddButtonRow("Back", "back");
|
||||
|
||||
await Device.Send($"Your current count is at: {counter}", bf, disableNotification: true);
|
||||
await Device.Send($"Your current count is at: {_counter}", bf, disableNotification: true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using TelegramBotBase.Base;
|
||||
using TelegramBotBase.Form;
|
||||
|
||||
@@ -14,7 +10,7 @@ namespace AsyncFormUpdates.forms
|
||||
|
||||
public override async Task Action(MessageResult message)
|
||||
{
|
||||
await message.ConfirmAction("");
|
||||
await message.ConfirmAction();
|
||||
|
||||
switch (message.RawData ?? "")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user