Hola, i have trouble in connection Telegram bot to rust plugin.
Code:
//Reference: Telegram.Bot
using Oxide.Core;
using Oxide.Core.Libraries.Covalence;
using System.Collections.Generic;
using System.IO;
using Oxide.Core.Configuration;
using Telegram.Bot;
using System;
namespace Oxide.Plugins
{
[Info("Test", "LuL-Z", 1.0)]
[Description("Testing")]
public class Program : CovalencePlugin
{
[Command("connect", "conn", "cct")]
private void TestCommand(IPlayer player, string command, string[] args)
{
TelegramBotClient bot = new TelegramBotClient("TOKEN");
bot.SendTextMessageAsync(tg_id_person, "Check Message");
}
}
}
Error:
Failed to call hook 'TestCommand' on plugin 'Program v1.0.0' (UnauthorizedAccessException: System access is restricted, you are not allowed to use System.Threading.CancellationToken)
at Oxide.Plugins.Program.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00032] in <8a3e985d305b41b884ea0fa03e8c523f>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0
How to fix it?