Fixed custom hangman categories. closes #1627 , Version upped.
This commit is contained in:
parent
44cac90e34
commit
7210b07e6e
@ -124,49 +124,49 @@ namespace NadekoBot.Modules.Administration
|
||||
switch (type)
|
||||
{
|
||||
case LogType.Other:
|
||||
channelId = logSetting.LogOtherId = (logSetting.LogOtherId == null ? channel.Id : default(ulong?));
|
||||
channelId = logSetting.LogOtherId = (logSetting.LogOtherId == null ? channel.Id : default);
|
||||
break;
|
||||
case LogType.MessageUpdated:
|
||||
channelId = logSetting.MessageUpdatedId = (logSetting.MessageUpdatedId == null ? channel.Id : default(ulong?));
|
||||
channelId = logSetting.MessageUpdatedId = (logSetting.MessageUpdatedId == null ? channel.Id : default);
|
||||
break;
|
||||
case LogType.MessageDeleted:
|
||||
channelId = logSetting.MessageDeletedId = (logSetting.MessageDeletedId == null ? channel.Id : default(ulong?));
|
||||
channelId = logSetting.MessageDeletedId = (logSetting.MessageDeletedId == null ? channel.Id : default);
|
||||
break;
|
||||
case LogType.UserJoined:
|
||||
channelId = logSetting.UserJoinedId = (logSetting.UserJoinedId == null ? channel.Id : default(ulong?));
|
||||
channelId = logSetting.UserJoinedId = (logSetting.UserJoinedId == null ? channel.Id : default);
|
||||
break;
|
||||
case LogType.UserLeft:
|
||||
channelId = logSetting.UserLeftId = (logSetting.UserLeftId == null ? channel.Id : default(ulong?));
|
||||
channelId = logSetting.UserLeftId = (logSetting.UserLeftId == null ? channel.Id : default);
|
||||
break;
|
||||
case LogType.UserBanned:
|
||||
channelId = logSetting.UserBannedId = (logSetting.UserBannedId == null ? channel.Id : default(ulong?));
|
||||
channelId = logSetting.UserBannedId = (logSetting.UserBannedId == null ? channel.Id : default);
|
||||
break;
|
||||
case LogType.UserUnbanned:
|
||||
channelId = logSetting.UserUnbannedId = (logSetting.UserUnbannedId == null ? channel.Id : default(ulong?));
|
||||
channelId = logSetting.UserUnbannedId = (logSetting.UserUnbannedId == null ? channel.Id : default);
|
||||
break;
|
||||
case LogType.UserUpdated:
|
||||
channelId = logSetting.UserUpdatedId = (logSetting.UserUpdatedId == null ? channel.Id : default(ulong?));
|
||||
channelId = logSetting.UserUpdatedId = (logSetting.UserUpdatedId == null ? channel.Id : default);
|
||||
break;
|
||||
case LogType.UserMuted:
|
||||
channelId = logSetting.UserMutedId = (logSetting.UserMutedId == null ? channel.Id : default(ulong?));
|
||||
channelId = logSetting.UserMutedId = (logSetting.UserMutedId == null ? channel.Id : default);
|
||||
break;
|
||||
case LogType.ChannelCreated:
|
||||
channelId = logSetting.ChannelCreatedId = (logSetting.ChannelCreatedId == null ? channel.Id : default(ulong?));
|
||||
channelId = logSetting.ChannelCreatedId = (logSetting.ChannelCreatedId == null ? channel.Id : default);
|
||||
break;
|
||||
case LogType.ChannelDestroyed:
|
||||
channelId = logSetting.ChannelDestroyedId = (logSetting.ChannelDestroyedId == null ? channel.Id : default(ulong?));
|
||||
channelId = logSetting.ChannelDestroyedId = (logSetting.ChannelDestroyedId == null ? channel.Id : default);
|
||||
break;
|
||||
case LogType.ChannelUpdated:
|
||||
channelId = logSetting.ChannelUpdatedId = (logSetting.ChannelUpdatedId == null ? channel.Id : default(ulong?));
|
||||
channelId = logSetting.ChannelUpdatedId = (logSetting.ChannelUpdatedId == null ? channel.Id : default);
|
||||
break;
|
||||
case LogType.UserPresence:
|
||||
channelId = logSetting.LogUserPresenceId = (logSetting.LogUserPresenceId == null ? channel.Id : default(ulong?));
|
||||
channelId = logSetting.LogUserPresenceId = (logSetting.LogUserPresenceId == null ? channel.Id : default);
|
||||
break;
|
||||
case LogType.VoicePresence:
|
||||
channelId = logSetting.LogVoicePresenceId = (logSetting.LogVoicePresenceId == null ? channel.Id : default(ulong?));
|
||||
channelId = logSetting.LogVoicePresenceId = (logSetting.LogVoicePresenceId == null ? channel.Id : default);
|
||||
break;
|
||||
case LogType.VoicePresenceTTS:
|
||||
channelId = logSetting.LogVoicePresenceTTSId = (logSetting.LogVoicePresenceTTSId == null ? channel.Id : default(ulong?));
|
||||
channelId = logSetting.LogVoicePresenceTTSId = (logSetting.LogVoicePresenceTTSId == null ? channel.Id : default);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
|
||||
if (users.Count > 0)
|
||||
{
|
||||
await _cs.AddToManyAsync("", _amount, users.ToArray()).ConfigureAwait(false);
|
||||
await _cs.AddToManyAsync("Reaction Event", _amount, users.ToArray()).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
users.Clear();
|
||||
|
@ -56,9 +56,9 @@ namespace NadekoBot.Modules.Games.Common.Hangman
|
||||
|
||||
public Task EndedTask => _endingCompletionSource.Task;
|
||||
|
||||
public Hangman(TermType type)
|
||||
public Hangman(string type)
|
||||
{
|
||||
this.TermType = type.ToString().Replace('_', ' ').ToTitleCase();
|
||||
this.TermType = type.Trim().ToLowerInvariant().ToTitleCase();
|
||||
this.Term = TermPool.GetTerm(type);
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@ using NadekoBot.Modules.Games.Common.Hangman.Exceptions;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
@ -25,21 +24,17 @@ namespace NadekoBot.Modules.Games.Common.Hangman
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly ImmutableArray<TermType> _termTypes = Enum.GetValues(typeof(TermType))
|
||||
.Cast<TermType>()
|
||||
.ToImmutableArray();
|
||||
|
||||
public static HangmanObject GetTerm(TermType type)
|
||||
public static HangmanObject GetTerm(string type)
|
||||
{
|
||||
var rng = new NadekoRandom();
|
||||
|
||||
if (type == TermType.Random)
|
||||
if (type == "random")
|
||||
{
|
||||
var keys = Data.Keys.ToArray();
|
||||
|
||||
type = _termTypes[rng.Next(0, _termTypes.Length - 1)]; // - 1 because last one is 'all'
|
||||
type = Data.Keys.ToArray()[rng.Next(0, Data.Keys.Count())];
|
||||
}
|
||||
if (!Data.TryGetValue(type.ToString(), out var termTypes) || termTypes.Length == 0)
|
||||
if (!Data.TryGetValue(type, out var termTypes) || termTypes.Length == 0)
|
||||
throw new TermNotFoundException();
|
||||
|
||||
var obj = termTypes[rng.Next(0, termTypes.Length)];
|
||||
|
@ -29,12 +29,12 @@ namespace NadekoBot.Modules.Games
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Hangmanlist()
|
||||
{
|
||||
await Context.Channel.SendConfirmAsync(Format.Code(GetText("hangman_types", Prefix)) + "\n" + string.Join(", ", TermPool.Data.Keys));
|
||||
await Context.Channel.SendConfirmAsync(Format.Code(GetText("hangman_types", Prefix)) + "\n" + string.Join("\n", TermPool.Data.Keys));
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Hangman([Remainder]TermType type = TermType.Random)
|
||||
public async Task Hangman([Remainder]string type = "random")
|
||||
{
|
||||
var hm = new Hangman(type);
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace NadekoBot.Services.Impl
|
||||
private readonly IBotCredentials _creds;
|
||||
private readonly DateTime _started;
|
||||
|
||||
public const string BotVersion = "1.10.1";
|
||||
public const string BotVersion = "1.10.2";
|
||||
|
||||
public string Author => "Kwoth#2560";
|
||||
public string Library => "Discord.Net";
|
||||
|
Loading…
Reference in New Issue
Block a user