private async Task TestSubHandler(IRC.TwitchChatter chatter, string[] remainingCommand) { if (chatter.User.AuthorizationLevel < AuthorizationLevel.Admin) { communication.SendPublicChatMessage($"You are not authorized to test sub notifications, @{chatter.User.TwitchUserName}."); return; } string user = "******"; string submessage = "This is my sub message"; if (remainingCommand.Length >= 1) { user = remainingCommand[0]; submessage = ""; } Database.User subUser = await userHelper.GetUserByTwitchLogin(user.ToLower(), false); if (subUser == null) { communication.SendWarningMessage($"Requested user {user} not found in database. Substituting broadcaster."); subUser = await userHelper.GetUserByTwitchId(botConfig.BroadcasterId, false); } if (remainingCommand.Length < 2 || !int.TryParse(remainingCommand[1], out int months)) { months = 1; } if (remainingCommand.Length < 3 || !int.TryParse(remainingCommand[2], out int tier)) { tier = 1; } subscriptionHandler.HandleSubscription( userId: subUser.TwitchUserId, message: submessage, monthCount: months, tier: tier, approved: true); }
public async void HandleRedemption(ChannelPointMessageData.Datum redemption) { //Handle redemption string rewardID = redemption.Redemption.Reward.Id; if (!redemptionHandlers.ContainsKey(rewardID)) { communication.SendErrorMessage($"Redemption handler not found: {rewardID}"); return; } Database.User user = await userHelper.GetUserByTwitchId(redemption.Redemption.User.Id); if (user is null) { communication.SendErrorMessage($"User not found: {redemption.Redemption.User.Id}"); return; } await redemptionHandlers[rewardID](user, redemption.Redemption); }