public IReadOnlyCollection <ClientMsgHandler> OnBotSteamHandlersInit([NotNull] Bot bot) { ItemDropHandler CurrentBotItemDropHandler = new ItemDropHandler(); ItemDropHandlers.TryAdd(bot, CurrentBotItemDropHandler); return(new HashSet <ClientMsgHandler> { CurrentBotItemDropHandler }); }
private static async Task <string?> ItemDropDefList(ulong steamID, Bot bot) { if (!bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return(null); } if (!ItemDropHandlers.TryGetValue(bot, out ItemDropHandler? ItemDropHandler)) { return(bot.Commands.FormatBotResponse(string.Format(Strings.ErrorIsEmpty, nameof(ItemDropHandlers)))); } return(bot.Commands.FormatBotResponse(await Task.Run <string>(() => ItemDropHandler.itemDropDefList(bot)).ConfigureAwait(false))); }
//Responses private static async Task <string?> StartItemIdle(ulong steamID, Bot bot, string appid, string droplist) { if (!bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return(null); } if (!uint.TryParse(appid, out uint appId)) { return(bot.Commands.FormatBotResponse(string.Format(Strings.ErrorIsInvalid, nameof(appId)))); } if (!ItemDropHandlers.TryGetValue(bot, out ItemDropHandler? ItemDropHandler)) { return(bot.Commands.FormatBotResponse(string.Format(Strings.ErrorIsEmpty, nameof(ItemDropHandlers)))); } return(bot.Commands.FormatBotResponse(await Task.Run <string>(() => ItemDropHandler.itemIdleingStart(bot, appId)).ConfigureAwait(false))); }
// Testing section for checking new feature as single/independent command private static async Task <string?> ItemDropTest(ulong steamID, Bot bot, string appid) { if (!bot.HasAccess(steamID, BotConfig.EAccess.Master)) { bot.ArchiLogger.LogGenericError("Bot has no access"); return(null); } if (!uint.TryParse(appid, out uint appId)) { return(bot.Commands.FormatBotResponse(string.Format(Strings.ErrorIsInvalid, nameof(appId)))); } if (!ItemDropHandlers.TryGetValue(bot, out ItemDropHandler? ItemDropHandler)) { return(bot.Commands.FormatBotResponse(string.Format(Strings.ErrorIsEmpty, nameof(ItemDropHandlers)))); } return(bot.Commands.FormatBotResponse(await Task.Run <string>(() => ItemDropHandler.itemDropTest(appId, bot)).ConfigureAwait(false))); }
private static async Task <string?> CheckItem(ulong steamID, Bot bot, string appid, string itemdefId) { if (!bot.HasAccess(steamID, BotConfig.EAccess.Master)) { return(null); } if (!uint.TryParse(appid, out uint appId)) { return(bot.Commands.FormatBotResponse(string.Format(Strings.ErrorIsInvalid, nameof(appId)))); } if (!uint.TryParse(itemdefId, out uint itemdefid)) { return(bot.Commands.FormatBotResponse(string.Format(Strings.ErrorIsInvalid, nameof(itemdefid)))); } if (!ItemDropHandlers.TryGetValue(bot, out ItemDropHandler? ItemDropHandler)) { return(bot.Commands.FormatBotResponse(string.Format(Strings.ErrorIsEmpty, nameof(ItemDropHandlers)))); } return(bot.Commands.FormatBotResponse(await Task.Run <string>(() => ItemDropHandler.checkTime(appId, itemdefid, bot)).ConfigureAwait(false))); }