Merge remote-tracking branch 'Kwoth/dev' into dev
This commit is contained in:
commit
1b81f01b05
@ -116,7 +116,7 @@ namespace NadekoBot.Modules.Games
|
|||||||
if (msg == null)
|
if (msg == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this.Channel == null || this.Channel.Id != this.Channel.Id) return;
|
if (this.Channel == null || this.Channel.Id != msg.Channel.Id) return;
|
||||||
|
|
||||||
var guess = msg.Content;
|
var guess = msg.Content;
|
||||||
|
|
||||||
@ -124,13 +124,14 @@ namespace NadekoBot.Modules.Games
|
|||||||
var decision = Judge(distance, guess.Length);
|
var decision = Judge(distance, guess.Length);
|
||||||
if (decision && !finishedUserIds.Contains(msg.Author.Id))
|
if (decision && !finishedUserIds.Contains(msg.Author.Id))
|
||||||
{
|
{
|
||||||
var wpm = CurrentSentence.Length / WORD_VALUE / sw.Elapsed.Seconds * 60;
|
var elapsed = sw.Elapsed;
|
||||||
|
var wpm = CurrentSentence.Length / WORD_VALUE / elapsed.TotalSeconds * 60;
|
||||||
finishedUserIds.Add(msg.Author.Id);
|
finishedUserIds.Add(msg.Author.Id);
|
||||||
await this.Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
|
await this.Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
|
||||||
.WithTitle((string)$"{msg.Author} finished the race!")
|
.WithTitle($"{msg.Author} finished the race!")
|
||||||
.AddField(efb => efb.WithName("Place").WithValue($"#{finishedUserIds.Count}").WithIsInline(true))
|
.AddField(efb => efb.WithName("Place").WithValue($"#{finishedUserIds.Count}").WithIsInline(true))
|
||||||
.AddField(efb => efb.WithName("WPM").WithValue($"{wpm:F2} *[{sw.Elapsed.Seconds.ToString()}sec]*").WithIsInline(true))
|
.AddField(efb => efb.WithName("WPM").WithValue($"{wpm:F1} *[{elapsed.TotalSeconds:F2}sec]*").WithIsInline(true))
|
||||||
.AddField(efb => efb.WithName((string)"Errors").WithValue((string)distance.ToString()).WithIsInline((bool)true)))
|
.AddField(efb => efb.WithName("Errors").WithValue(distance.ToString()).WithIsInline(true)))
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
if (finishedUserIds.Count % 4 == 0)
|
if (finishedUserIds.Count % 4 == 0)
|
||||||
{
|
{
|
||||||
@ -150,11 +151,11 @@ namespace NadekoBot.Modules.Games
|
|||||||
{
|
{
|
||||||
public static List<TypingArticle> TypingArticles { get; } = new List<TypingArticle>();
|
public static List<TypingArticle> TypingArticles { get; } = new List<TypingArticle>();
|
||||||
|
|
||||||
const string typingArticlesPath = "data/typing_articles.json";
|
private const string _typingArticlesPath = "data/typing_articles.json";
|
||||||
|
|
||||||
static SpeedTypingCommands()
|
static SpeedTypingCommands()
|
||||||
{
|
{
|
||||||
try { TypingArticles = JsonConvert.DeserializeObject<List<TypingArticle>>(File.ReadAllText(typingArticlesPath)); } catch { }
|
try { TypingArticles = JsonConvert.DeserializeObject<List<TypingArticle>>(File.ReadAllText(_typingArticlesPath)); } catch { }
|
||||||
}
|
}
|
||||||
public static ConcurrentDictionary<ulong, TypingGame> RunningContests = new ConcurrentDictionary<ulong, TypingGame>();
|
public static ConcurrentDictionary<ulong, TypingGame> RunningContests = new ConcurrentDictionary<ulong, TypingGame>();
|
||||||
|
|
||||||
@ -207,7 +208,7 @@ namespace NadekoBot.Modules.Games
|
|||||||
Text = text.SanitizeMentions(),
|
Text = text.SanitizeMentions(),
|
||||||
});
|
});
|
||||||
|
|
||||||
File.WriteAllText(typingArticlesPath, JsonConvert.SerializeObject(TypingArticles));
|
File.WriteAllText(_typingArticlesPath, JsonConvert.SerializeObject(TypingArticles));
|
||||||
|
|
||||||
await channel.SendConfirmAsync("Added new article for typing game.").ConfigureAwait(false);
|
await channel.SendConfirmAsync("Added new article for typing game.").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
@ -221,7 +222,7 @@ namespace NadekoBot.Modules.Games
|
|||||||
if (page < 1)
|
if (page < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var articles = TypingArticles.Skip((page - 1) * 15).Take(15);
|
var articles = TypingArticles.Skip((page - 1) * 15).Take(15).ToArray();
|
||||||
|
|
||||||
if (!articles.Any())
|
if (!articles.Any())
|
||||||
{
|
{
|
||||||
@ -229,7 +230,7 @@ namespace NadekoBot.Modules.Games
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var i = (page - 1) * 15;
|
var i = (page - 1) * 15;
|
||||||
await channel.SendConfirmAsync("List of articles for Type Race", String.Join("\n", articles.Select(a => $"`#{++i}` - {a.Text.TrimTo(50)}")))
|
await channel.SendConfirmAsync("List of articles for Type Race", string.Join("\n", articles.Select(a => $"`#{++i}` - {a.Text.TrimTo(50)}")))
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,7 +248,7 @@ namespace NadekoBot.Modules.Games
|
|||||||
var removed = TypingArticles[index];
|
var removed = TypingArticles[index];
|
||||||
TypingArticles.RemoveAt(index);
|
TypingArticles.RemoveAt(index);
|
||||||
|
|
||||||
File.WriteAllText(typingArticlesPath, JsonConvert.SerializeObject(TypingArticles));
|
File.WriteAllText(_typingArticlesPath, JsonConvert.SerializeObject(TypingArticles));
|
||||||
|
|
||||||
await channel.SendConfirmAsync($"`Removed typing article:` #{index + 1} - {removed.Text.TrimTo(50)}")
|
await channel.SendConfirmAsync($"`Removed typing article:` #{index + 1} - {removed.Text.TrimTo(50)}")
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
@ -67,7 +67,7 @@ namespace NadekoBot.Modules.Music.Classes
|
|||||||
public float Volume { get; private set; }
|
public float Volume { get; private set; }
|
||||||
|
|
||||||
public event Action<MusicPlayer, Song> OnCompleted = delegate { };
|
public event Action<MusicPlayer, Song> OnCompleted = delegate { };
|
||||||
public event Action<MusicPlayer, Song> OnStarted = delegate { };
|
public event Action<MusicPlayer, Song> OnStarted = delegate { };
|
||||||
public event Action<bool> OnPauseChanged = delegate { };
|
public event Action<bool> OnPauseChanged = delegate { };
|
||||||
|
|
||||||
public IVoiceChannel PlaybackVoiceChannel { get; private set; }
|
public IVoiceChannel PlaybackVoiceChannel { get; private set; }
|
||||||
@ -130,13 +130,9 @@ namespace NadekoBot.Modules.Music.Classes
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (audioClient?.ConnectionState != ConnectionState.Connected)
|
if (audioClient != null)
|
||||||
{
|
try { await audioClient.DisconnectAsync().ConfigureAwait(false); } catch { }
|
||||||
if (audioClient != null)
|
audioClient = await PlaybackVoiceChannel.ConnectAsync().ConfigureAwait(false);
|
||||||
try { await audioClient.DisconnectAsync().ConfigureAwait(false); } catch { }
|
|
||||||
audioClient = await PlaybackVoiceChannel.ConnectAsync().ConfigureAwait(false);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
CurrentSong = GetNextSong();
|
CurrentSong = GetNextSong();
|
||||||
|
|
||||||
@ -313,11 +309,15 @@ namespace NadekoBot.Modules.Music.Classes
|
|||||||
{
|
{
|
||||||
var curSong = CurrentSong;
|
var curSong = CurrentSong;
|
||||||
var toUpdate = playlist.Where(s => s.SongInfo.ProviderType == MusicType.Normal &&
|
var toUpdate = playlist.Where(s => s.SongInfo.ProviderType == MusicType.Normal &&
|
||||||
s.TotalTime == TimeSpan.Zero);
|
s.TotalTime == TimeSpan.Zero)
|
||||||
|
.ToArray();
|
||||||
if (curSong != null)
|
if (curSong != null)
|
||||||
toUpdate = toUpdate.Append(curSong);
|
{
|
||||||
|
Array.Resize(ref toUpdate, toUpdate.Length + 1);
|
||||||
|
toUpdate[toUpdate.Length - 1] = curSong;
|
||||||
|
}
|
||||||
var ids = toUpdate.Select(s => s.SongInfo.Query.Substring(s.SongInfo.Query.LastIndexOf("?v=") + 3))
|
var ids = toUpdate.Select(s => s.SongInfo.Query.Substring(s.SongInfo.Query.LastIndexOf("?v=") + 3))
|
||||||
.Distinct();
|
.Distinct();
|
||||||
|
|
||||||
var durations = await NadekoBot.Google.GetVideoDurationsAsync(ids);
|
var durations = await NadekoBot.Google.GetVideoDurationsAsync(ids);
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=modules_005Cadministration_005Ccommands/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=modules_005Cadministration_005Ccommands/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=modules_005Cgambling_005Ccommands/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=modules_005Cgambling_005Ccommands/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=modules_005Cgames_005Ccommands/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
Loading…
Reference in New Issue
Block a user