public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator) { broadcaster.Broadcast(cmd.Sender.Username, Localization.KICK_PERM); return; } var targetPlayerName = cmd.Arguments?.Trim(); if (string.IsNullOrEmpty(targetPlayerName)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.KICK_NO_USER); return; } var targetPlayer = playerProvider.Get(targetPlayerName); await game.KickAsync(targetPlayer); }
public TwitchBot( ILogger logger, IKernel kernel, IRavenfallClient ravenfall, IPlayerProvider playerProvider, ITwitchMessageFormatter localizer, IMessageBus messageBus, ICommandProvider commandProvider, ICommandHandler commandHandler, IChannelProvider channelProvider, IConnectionCredentialsProvider credentialsProvider) { this.logger = logger; this.kernel = kernel; this.ravenfall = ravenfall; this.playerProvider = playerProvider; this.messageFormatter = localizer; this.messageBus = messageBus; this.commandProvider = commandProvider; this.commandHandler = commandHandler; this.channelProvider = channelProvider; this.credentialsProvider = credentialsProvider; this.messageBus.Subscribe <string>("streamer_userid_acquired", userid => { try { if (listeningToChannelPoints) { return; } if (pubsubIsConnected) { pubsubIsConnected = false; pubsub.Disconnect(); } pubsub.ListenToChannelPoints(userid); pubsub.Connect(); pubsubIsConnected = true; logger.WriteDebug("Connecting to PubSub"); } catch (Exception exc) { logger.WriteError(exc.ToString()); } }); this.CreateTwitchClient(); ravenfall.ProcessAsync(Settings.UNITY_SERVER_PORT); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (cmd.Sender.IsVerifiedBot) { return; } if (!await game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender, cmd.Arguments); await game.JoinAsync(player); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender); if (player == null) { return; } await game.RequestIslandInfoAsync(player); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender); if (string.IsNullOrEmpty(cmd.Arguments)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.REDEEM_NO_ARG); return; } await game.RedeemStreamerTokenAsync(player, cmd.Arguments); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } if (!string.IsNullOrEmpty(cmd.Arguments) && (cmd.Sender.IsBroadcaster || cmd.Sender.IsModerator)) { var player = playerProvider.Get(cmd.Arguments); if (player != null) { await game.UnstuckAsync(player); } } else { var player = playerProvider.Get(cmd.Sender, cmd.Arguments); await game.UnstuckAsync(player); } }