public async Task <bool> IsBotAdminAsync(long chatId) { var getMe = await _botService.GetMeAsync(); var isBotAdmin = await IsAdminAsync(chatId, getMe.Id); return(isBotAdmin); }
public async Task <bool> IsMeHereAsync(long chatId) { var me = await _botService.GetMeAsync(); var chatMember = await GetChatMemberAsync(chatId, me.Id); var isHere = chatMember.Status is not(ChatMemberStatus.Left or ChatMemberStatus.Kicked); return(isHere); }
private async Task <string> MongoDbGetDbName(bool sharedDb) { if (sharedDb) { return("shared"); } var bot = await _botService.GetMeAsync(); return(bot.Username.Underscore().ToLower()); }
public async Task Start() { var op = Operation.Begin("Command Start Handler on {ChatId}", ChatId); var me = await _botService.GetMeAsync(); var argStr = Message.Text.GetTextWithoutCmd(); var args = argStr.Split("_"); var arg1 = args.ElementAt(0); switch (arg1) { case "settings": var chatId = args.ElementAt(1).ToInt64(); var settingsCmd = await _settingsService.GetSettingButtonByGroup(chatId, true); var btnMarkup = await settingsCmd.ToJson().JsonToButton(chunk: 2); _logger.LogDebug("Settings: {Count}", settingsCmd.Count); await SendMessageTextAsync("Pengaturan", btnMarkup); break; default: var htmlMsg = new HtmlString() .Bold($"🤖 {me.FirstName} ").Code(_enginesConfig.Version).Br() .TextBr($"by @{_enginesConfig.Company}.").Br() .Bold($"{me.FirstName} ") .TextBr( $"adalah bot debugging dan manajemen grup yang di lengkapi dengan alat keamanan. " + "Agar fungsi saya bekerja dengan fitur penuh, jadikan saya admin dengan" ) .Url("https://docs.zizibot.winten.my.id/glosarium/admin-dengan-level-standard", "Level standard").Br().Br() .TextBr("Saran dan fitur bisa di ajukan ke grup dibawah ini.") .TextBr("- @WinTenDevSupport") .Text("- @TgBotID"); await SendMessageTextAsync(htmlMsg, disableWebPreview : true); break; } op.Complete(); }
public async Task MongoDbDatabaseMapping() { _logger.LogInformation("Mapping MongoDb Database.."); var meUser = await _botService.GetMeAsync(); var meUsername = meUser.FirstName.Underscore(); var connectionString = _connectionStrings.MongoDb; await DB.InitAsync(meUsername, MongoClientSettings.FromConnectionString(connectionString)); await DB.InitAsync("shared", MongoClientSettings.FromConnectionString(connectionString)); DB.DatabaseFor <ForceSubscription>(meUsername); DB.DatabaseFor <SubsceneMovieSearch>("shared"); DB.DatabaseFor <SubsceneMovieItem>("shared"); DB.DatabaseFor <SubsceneSubtitleItem>("shared"); _logger.LogInformation("Mapping MongoDb Database complete"); }