示例#1
0
        private async Task MirrorModCommand(SocketMessage msg, string[] parts)
        {
            if (parts.Length != 2)
            {
                await ReplyTo(msg, "Command is: mirror-mod <game-name> <mod-id>");

                return;
            }

            if (long.TryParse(parts[2], out var modId))
            {
                await ReplyTo(msg, $"Got {modId} for a mod-id, expected a integer");

                return;
            }

            if (GameRegistry.TryGetByFuzzyName(parts[1], out var game))
            {
                var gameNames = GameRegistry.Games.Select(g => g.Value.NexusName)
                                .Where(g => !string.IsNullOrWhiteSpace(g))
                                .Select(g => (string)g)
                                .ToHashSet();
                var joined = string.Join(", ", gameNames.OrderBy(g => g));
                await ReplyTo(msg, $"Got {parts[1]} for a game name, expected something like: {joined}");
            }

            if (game !.NexusGameId == default)
            {
                await ReplyTo(msg, $"No NexusGameID found for {game}");
            }

            await _sql.AddNexusModWithOpenPerms(game.Game, modId);

            await _quickSync.Notify <MirrorUploader>();

            await ReplyTo(msg, "Done, and I notified the uploader");
        }