Prefixes in strings, fixed CI?
This commit is contained in:
		@@ -12,9 +12,16 @@ namespace NadekoBot.Modules
 | 
			
		||||
        protected CommandService _commands { get; }
 | 
			
		||||
        protected DiscordSocketClient _client { get; }
 | 
			
		||||
        protected Logger _log { get; }
 | 
			
		||||
        private string _prefix { get; }
 | 
			
		||||
 | 
			
		||||
        public DiscordModule(ILocalization loc, CommandService cmds, DiscordSocketClient client)
 | 
			
		||||
        {
 | 
			
		||||
            string prefix;
 | 
			
		||||
            if (NadekoBot.ModulePrefixes.TryGetValue(this.GetType().Name, out prefix))
 | 
			
		||||
                _prefix = prefix;
 | 
			
		||||
            else
 | 
			
		||||
                _prefix = "?missing_prefix?";
 | 
			
		||||
 | 
			
		||||
            _l = loc;
 | 
			
		||||
            _commands = cmds;
 | 
			
		||||
            _client = client;
 | 
			
		||||
 
 | 
			
		||||
@@ -18,6 +18,10 @@ namespace NadekoBot.Modules.Gambling
 | 
			
		||||
        [Group]
 | 
			
		||||
        public class AnimalRacing
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            public AnimalRacing()
 | 
			
		||||
            {
 | 
			
		||||
            }
 | 
			
		||||
            public static ConcurrentDictionary<ulong, AnimalRace> AnimalRaces = new ConcurrentDictionary<ulong, AnimalRace>();
 | 
			
		||||
 | 
			
		||||
            [LocalizedCommand, LocalizedDescription, LocalizedSummary, LocalizedAlias]
 | 
			
		||||
@@ -92,8 +96,7 @@ namespace NadekoBot.Modules.Gambling
 | 
			
		||||
                    {
 | 
			
		||||
                        try
 | 
			
		||||
                        {
 | 
			
		||||
                            //todo Commmand prefixes from config
 | 
			
		||||
                            await raceChannel.SendMessageAsync($"🏁`Race is starting in 20 seconds or when the room is full. Type $jr to join the race.`");
 | 
			
		||||
                            await raceChannel.SendMessageAsync($"🏁`Race is starting in 20 seconds or when the room is full. Type {NadekoBot.ModulePrefixes["Gambling"]}jr to join the race.`");
 | 
			
		||||
                            var t = await Task.WhenAny(Task.Delay(20000, token), fullgame);
 | 
			
		||||
                            Started = true;
 | 
			
		||||
                            cancelSource.Cancel();
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,6 @@ namespace NadekoBot.Modules.Games
 | 
			
		||||
        [Group]
 | 
			
		||||
        public class PlantPickCommands
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            private Random rng;
 | 
			
		||||
 | 
			
		||||
            private ConcurrentDictionary<ulong, bool> generationChannels = new ConcurrentDictionary<ulong, bool>();
 | 
			
		||||
@@ -83,12 +82,11 @@ namespace NadekoBot.Modules.Games
 | 
			
		||||
                    if (num > 100)
 | 
			
		||||
                    {
 | 
			
		||||
                        lastGenerations.AddOrUpdate(channel.Id, DateTime.Now, (id, old) => DateTime.Now);
 | 
			
		||||
                        //todo get prefix
 | 
			
		||||
                        try
 | 
			
		||||
                        {
 | 
			
		||||
                            var sent = await channel.SendFileAsync(
 | 
			
		||||
                                GetRandomCurrencyImagePath(), 
 | 
			
		||||
                                $"❗ A random { Gambling.Gambling.CurrencyName } appeared! Pick it up by typing `>pick`")
 | 
			
		||||
                                $"❗ A random { Gambling.Gambling.CurrencyName } appeared! Pick it up by typing `{NadekoBot.ModulePrefixes["Gambling"]}pick`")
 | 
			
		||||
                                    .ConfigureAwait(false);
 | 
			
		||||
                            plantedFlowers.AddOrUpdate(channel.Id, new List<IUserMessage>() { sent }, (id, old) => { old.Add(sent); return old; });
 | 
			
		||||
                        }
 | 
			
		||||
@@ -149,8 +147,8 @@ namespace NadekoBot.Modules.Games
 | 
			
		||||
                var file = GetRandomCurrencyImagePath();
 | 
			
		||||
                IUserMessage msg;
 | 
			
		||||
                var vowelFirst = new[] { 'a', 'e', 'i', 'o', 'u' }.Contains(Gambling.Gambling.CurrencyName[0]);
 | 
			
		||||
                //todo add prefix
 | 
			
		||||
                var msgToSend = $"Oh how Nice! **{imsg.Author.Username}** planted {(vowelFirst ? "an" : "a")} {Gambling.Gambling.CurrencyName}. Pick it using >pick";
 | 
			
		||||
                
 | 
			
		||||
                var msgToSend = $"Oh how Nice! **{imsg.Author.Username}** planted {(vowelFirst ? "an" : "a")} {Gambling.Gambling.CurrencyName}. Pick it using {NadekoBot.ModulePrefixes["Games"]}pick";
 | 
			
		||||
                if (file == null)
 | 
			
		||||
                {
 | 
			
		||||
                    msg = await channel.SendMessageAsync(Gambling.Gambling.CurrencySign).ConfigureAwait(false);
 | 
			
		||||
 
 | 
			
		||||
@@ -12,11 +12,8 @@ using System.Diagnostics;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Reflection;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using NLog.Fluent;
 | 
			
		||||
using Microsoft.EntityFrameworkCore.Infrastructure;
 | 
			
		||||
using Microsoft.EntityFrameworkCore.Migrations;
 | 
			
		||||
using Microsoft.EntityFrameworkCore.Migrations.Operations;
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Collections.ObjectModel;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot
 | 
			
		||||
{
 | 
			
		||||
@@ -33,6 +30,8 @@ namespace NadekoBot
 | 
			
		||||
        public static GoogleApiService Google { get; private set; }
 | 
			
		||||
        public static StatsService Stats { get; private set; }
 | 
			
		||||
 | 
			
		||||
        public static IReadOnlyDictionary<string, string> ModulePrefixes { get; private set; }
 | 
			
		||||
 | 
			
		||||
        public async Task RunAsync(string[] args)
 | 
			
		||||
        {
 | 
			
		||||
            SetupLogger();
 | 
			
		||||
@@ -70,7 +69,11 @@ namespace NadekoBot
 | 
			
		||||
 | 
			
		||||
            _log.Info("Connected");
 | 
			
		||||
 | 
			
		||||
            //load commands
 | 
			
		||||
            //load commands and prefixes
 | 
			
		||||
            using (var uow = DbHandler.UnitOfWork())
 | 
			
		||||
            {
 | 
			
		||||
                ModulePrefixes = new ReadOnlyDictionary<string, string>(uow.BotConfig.GetOrCreate().ModulePrefixes.ToDictionary(m => m.ModuleName, m => m.Prefix));
 | 
			
		||||
            }
 | 
			
		||||
            await Commands.LoadAssembly(Assembly.GetEntryAssembly(), depMap).ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
            Console.WriteLine(await Stats.Print().ConfigureAwait(false));
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,7 @@
 | 
			
		||||
    "Microsoft.EntityFrameworkCore.Design": "1.0.0-preview2-final",
 | 
			
		||||
    "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0",
 | 
			
		||||
    "CoreCLR-NCalc": "2.1.0",
 | 
			
		||||
    "ImageProcessorCore": "1.0.0-alpha-1021"
 | 
			
		||||
    "ImageProcessorCore": "1.0.0-alpha1045"
 | 
			
		||||
  },
 | 
			
		||||
  "tools": {
 | 
			
		||||
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
 | 
			
		||||
 
 | 
			
		||||
@@ -146,7 +146,7 @@
 | 
			
		||||
          "lib/netstandard1.3/Google.Apis.YouTube.v3.dll": {}
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "ImageProcessorCore/1.0.0-alpha-1021": {
 | 
			
		||||
      "ImageProcessorCore/1.0.0-alpha1045": {
 | 
			
		||||
        "type": "package",
 | 
			
		||||
        "dependencies": {
 | 
			
		||||
          "System.Collections": "4.0.11",
 | 
			
		||||
@@ -3411,12 +3411,12 @@
 | 
			
		||||
        "lib/portable-net45+netcore45+wpa81+wp8/Google.Apis.YouTube.v3.xml"
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "ImageProcessorCore/1.0.0-alpha-1021": {
 | 
			
		||||
      "sha512": "ItWOgl9z3E67X5WW6Qp9U0E8rmD9ZkBFPeywkuODASCEfuArc+g5viRo6cD8lXyu2TXDE/LAYlsvu6X5dSOP9w==",
 | 
			
		||||
    "ImageProcessorCore/1.0.0-alpha1045": {
 | 
			
		||||
      "sha512": "A5oL7SwFnzcu5eF26u49nf73joQghpEpCGwLb54dm6VI6ZGpjBJpKAyNKtJP30HtXy1VngiGJn/EcvCl8+JGcg==",
 | 
			
		||||
      "type": "package",
 | 
			
		||||
      "path": "ImageProcessorCore/1.0.0-alpha-1021",
 | 
			
		||||
      "path": "ImageProcessorCore/1.0.0-alpha1045",
 | 
			
		||||
      "files": [
 | 
			
		||||
        "ImageProcessorCore.1.0.0-alpha-1021.nupkg.sha512",
 | 
			
		||||
        "ImageProcessorCore.1.0.0-alpha1045.nupkg.sha512",
 | 
			
		||||
        "ImageProcessorCore.nuspec",
 | 
			
		||||
        "lib/netstandard1.1/ImageProcessorCore.dll"
 | 
			
		||||
      ]
 | 
			
		||||
@@ -9100,7 +9100,7 @@
 | 
			
		||||
      "Google.Apis.Customsearch.v1 >= 1.16.0.466",
 | 
			
		||||
      "Google.Apis.Urlshortener.v1 >= 1.15.0.138",
 | 
			
		||||
      "Google.Apis.YouTube.v3 >= 1.15.0.582",
 | 
			
		||||
      "ImageProcessorCore >= 1.0.0-alpha-1021",
 | 
			
		||||
      "ImageProcessorCore >= 1.0.0-alpha1045",
 | 
			
		||||
      "Microsoft.EntityFrameworkCore >= 1.0.0",
 | 
			
		||||
      "Microsoft.EntityFrameworkCore.Design >= 1.0.0-preview2-final",
 | 
			
		||||
      "Microsoft.EntityFrameworkCore.Sqlite >= 1.0.0",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user