Hi
I am trying to build a new plugin for OB2 0.3.2 but I see to get these (2) errors all the time:
ShadowBot failed with 2 error(s) (0,7s)
error CS0246: The type or namespace name ‘ICustomBlock’ could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name ‘CustomRunContext’ could not be found (are you missing a using directive or an assembly reference?)
Build failed with 2 error(s) in 3,4s
What is it that I am doing wrong?
this is the cs file below:
using RuriLib.Models.Blocks.Custom;
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace ShadowTelegramBot
{
public class TelegramBlock : BlockInstance
{
public TelegramBlock()
{
Label = “Send Telegram Message”;
}
public override async Task Run(BlockCustomInputs inputs)
{
string botToken = inputs.TryGetInput("BotToken")?.AsString() ?? "TOKEN";
string chatId = inputs.TryGetInput("ChatId")?.AsString() ?? "CHAT ID";
string message = inputs.TryGetInput("Message")?.AsString() ?? "";
string parseMode = inputs.TryGetInput("ParseMode")?.AsString() ?? "Markdown";
using var client = new HttpClient();
var url = $"https://api.telegram.org/bot{botToken}/sendMessage";
var content = new StringContent(
$"chat_id={chatId}&text={Uri.EscapeDataString(message)}&parse_mode={parseMode}",
Encoding.UTF8,
"application/x-www-form-urlencoded"
);
var response = await client.PostAsync(url, content);
response.EnsureSuccessStatusCode();
}
}
}
I know there are other Telegram plugins available, I am just trying something simple to understand how to create a plugin.