Skip to content

Instantly share code, notes, and snippets.

View donma's full-sized avatar
:octocat:
I wanna play a game.

Donma Hsu donma

:octocat:
I wanna play a game.
View GitHub Profile
private static Task _TelegramBotClient_OnMessage(Telegram.Bot.Types.Message message, Telegram.Bot.Types.Enums.UpdateType type)
{
if (message.Text==null)
{
return Task.FromResult<object>(null);
}
if (message.Text.ToLower().StartsWith("/"))
{
private static Task _TelegramBotClient_OnUpdate(Telegram.Bot.Types.Update update)
{
if (update.CallbackQuery != null)
{
Console.WriteLine(update.CallbackQuery.From.Id + ":" + update.CallbackQuery.Data);
var sentMessage = _TelegramBotClient.SendMessage(
static TelegramBotClient _TelegramBotClient;
static CancellationTokenSource cts = new CancellationTokenSource();
public static void InitTelegramBotClient()
{
_TelegramBotClient = new TelegramBotClient("1234567890:AAD98dMandhVhEW4jDEu-LTm6fX9MYL9PKU4",httpClient:default,cts.Token);
_TelegramBotClient.OnMessage += _TelegramBotClient_OnMessage;
}
static TelegramBotClient _TelegramBotClient;
static CancellationTokenSource cts = new CancellationTokenSource();
public static void InitTelegramBotClient()
{
_TelegramBotClient = new TelegramBotClient("1234567890:AAD98dMandhVhEW4jDEu-LTm6fX9MYL9PKU4",httpClient:default,cts.Token);
_TelegramBotClient.OnMessage += _TelegramBotClient_OnMessage;
var filePath = AppDomain.CurrentDomain.BaseDirectory + "oooo.jpg";
UploadImageToIPFS(filePath);
static void UploadImageToIPFS(string filePath)
{
var client = new RestClient("https://app.img2ipfs.org/api/v0/add");
var filePath = AppDomain.CurrentDomain.BaseDirectory + "oig.jpg";
//user key from https://vgy.me/account/details
var response=UploadImageVgyMe(filePath, "user_key");
Console.WriteLine("Image path:" + response.image);
static readonly string[] EarthlyBranches = { "子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥" };
static readonly string[] Zodiacs = { "鼠", "牛", "虎", "兔", "龍", "蛇", "馬", "羊", "猴", "雞", "狗", "豬" };
static readonly int[] SixClashIndex = { 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5 };
public static void CalculateZodiacClash(DateTime date)
{
int earthlyIndex = GetEarthlyBranchIndex(date);
string earthlyBranch = EarthlyBranches[earthlyIndex];
//有被標示
var txid1RiskStatus = IsRiskTransaction("ecc4bad962d2bb4ac74694ff8bea53eec1358312afdfaba54a484f47ba68e5a4");
Console.WriteLine("ecc4bad962d2bb4ac74694ff8bea53eec1358312afdfaba54a484f47ba68e5a4 is risk :" + txid1RiskStatus);
//沒有被標示
var txid2RiskStatus = IsRiskTransaction("74cc8723d0c5c3933d8bf4d521be5a9b9c5d581d3d0f42fa8e9d3baae9187188");
static string ConvertHexToBase58Check(string hexAddress)
{
byte[] addressBytes = HexToBytes(hexAddress);
// 計算雙重 SHA-256 校驗碼
using (SHA256 sha256 = SHA256.Create())
{
//var contractTransResult = GetTransactionByTXId("70cfc24c7fd731e1ea523268a3c9fdf738fe8ffa6ed410f520e1a32631d7b33e");
static GetTransactionByIdResponse GetTransactionByTXId(string txId)
{
string apiUrl = "https://api.trongrid.io/wallet/gettransactionbyid";
var client = new RestClient(apiUrl);