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); } } } }
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); } } }
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); } } }
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); } } }
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); } } } }