Prefixes in strings, fixed CI?

This commit is contained in:
Kwoth
2016-09-15 17:31:02 +02:00
parent 0794137232
commit 8fa90348a3
6 changed files with 31 additions and 20 deletions

View File

@@ -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;

View File

@@ -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();

View File

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