Exemple #1
0
    public override async Task HandleAsync(
        IUpdateContext context,
        UpdateDelegate next,
        string[] args
        )
    {
        await _telegramService.AddUpdateContext(context);

        var chatId = _telegramService.ChatId;

        if (!await _telegramService.CheckUserPermission())
        {
            Log.Warning("This command only for sudo!");
            return;
        }

        await _telegramService.AppendTextAsync("Memulai Job RSS..");

        _rssFeedService.UnRegisterRssFeedByChatId(chatId);

        var rssSettings = await _rssService.GetRssSettingsAsync(chatId);

        var rssCount = rssSettings.Count();

        foreach (var rssSetting in rssSettings)
        {
            var urlFeed = rssSetting.UrlFeed;

            _rssFeedService.RegisterUrlFeed(chatId, urlFeed);
        }

        await _telegramService.AppendTextAsync($"Sebanyak {rssCount} RSS berhasil dimulai");
    }
Exemple #2
0
    public override async Task HandleAsync(
        IUpdateContext context,
        UpdateDelegate next,
        string[] args
    )
    {
        await _telegramService.AddUpdateContext(context);

        var chatId = _telegramService.ChatId;

        if (!await _telegramService.CheckUserPermission())
        {
            Log.Warning("This command only for sudo!");
            return;
        }

        await _telegramService.AppendTextAsync("Mematikan Job RSS..");
        var jobCount = _rssFeedService.UnRegisterRssFeedByChatId(chatId);

        await _telegramService.AppendTextAsync($"Sebanyak {jobCount} RSS berhasil dimatikan.");
    }