Пример #1
0
        public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd)
        {
            var channel = cmd.Channel;
            var session = game.GetSession(channel);

            if (session != null)
            {
                var connection = game.GetConnection(session);
                if (connection != null)
                {
                    var destination = cmd.Arguments?.ToLower();
                    if (string.IsNullOrEmpty(destination))
                    {
                        twitch.Broadcast(channel, cmd.Sender.Username, Localization.TRAVEL_NO_ARG);
                        return;
                    }

                    var player = session.Get(cmd.Sender);
                    if (player != null)
                    {
                        await connection.TravelAsync(player, destination);
                    }
                }
            }
        }
Пример #2
0
        public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd)
        {
            var channel = cmd.Channel;
            var session = game.GetSession(channel);

            if (session != null)
            {
                var connection = game.GetConnection(session);
                if (connection != null)
                {
                    if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator && !cmd.Sender.IsSubscriber)
                    {
                        twitch.Broadcast(channel, cmd.Sender.Username, Localization.OBSERVE_PERM);
                        return;
                    }

                    var targetPlayerName = cmd.Arguments?.Trim();
                    var player           = string.IsNullOrEmpty(targetPlayerName)
                        ? session.Get(cmd.Sender)
                        : session.GetUserByName(targetPlayerName);

                    await connection.ObservePlayerAsync(player);
                }
            }
        }
Пример #3
0
        public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd)
        {
            var channel = cmd.Channel;
            var session = game.GetSession(channel);

            if (session != null)
            {
                var connection = game.GetConnection(session);
                if (connection != null)
                {
                    var player = session.Get(cmd.Sender);
                    if (string.IsNullOrEmpty(cmd.Arguments))
                    {
                        twitch.Broadcast(channel, cmd.Sender.Username, Localization.REDEEM_NO_ARG);
                        return;
                    }

                    await connection.RedeemStreamerTokenAsync(player, cmd.Arguments);
                }
            }
        }
Пример #4
0
        public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd)
        {
            var channel = cmd.Channel;
            var session = game.GetSession(channel);

            if (session != null)
            {
                var connection = game.GetConnection(session);
                if (connection != null)
                {
                    var player = session.Get(cmd.Sender);

                    if (string.IsNullOrEmpty(cmd.Arguments) || !cmd.Arguments.Trim().Contains(" "))
                    {
                        twitch.Broadcast(channel, cmd.Sender.Username, Localization.TRADE_NO_ARG, cmd.Command);
                        return;
                    }

                    await connection.BuyItemAsync(player, cmd.Arguments);
                }
            }
        }
Пример #5
0
        public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd)
        {
            var channel = cmd.Channel;
            var session = game.GetSession(channel);

            if (session != null)
            {
                var connection = game.GetConnection(session);
                if (connection != null)
                {
                    if (string.IsNullOrEmpty(cmd.Arguments))
                    {
                        twitch.Broadcast(channel, cmd.Sender.Username, Localization.VALUE_NO_ARG, cmd.Command);
                        return;
                    }

                    var player = session.Get(cmd.Sender);
                    if (player != null)
                    {
                        await connection.CraftRequirementAsync(player, cmd.Arguments);
                    }
                }
            }
        }