コード例 #1
0
    public async Task SendStartupNotification()
    {
        var channelId   = _eventLogConfig.ChannelId;
        var appHostInfo = AppHostUtil.GetAppHostInfo(includePath: true);

        var htmlMessage = HtmlMessage.Empty
                          .Bold("Bot has started successfully").Br().Br()
                          .Text(appHostInfo);

        await _botClient.SendTextMessageAsync(
            chatId : channelId,
            text : htmlMessage.ToString(),
            parseMode : ParseMode.Html
            );
    }
コード例 #2
0
    public static async Task GetAppHostInfoAsync(this TelegramService telegramService)
    {
        var featureConfig = await telegramService.GetFeatureConfig();

        if (!featureConfig.NextHandler)
        {
            return;
        }

        var appHostInfo = AppHostUtil.GetAppHostInfo(includeUptime: true);

        await telegramService.SendTextMessageAsync(
            sendText : appHostInfo,
            includeSenderMessage : true,
            scheduleDeleteAt : DateTime.UtcNow.AddMinutes(10)
            );
    }