A lot of bugfixes
This commit is contained in:
parent
45e3e3d8be
commit
0b09379bc5
@ -50,6 +50,23 @@ namespace NadekoBot.Modules.Administration
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[RequireContext(ContextType.Guild)]
|
||||||
|
[RequirePermission(GuildPermission.Administrator)]
|
||||||
|
public async Task ResetPermissions(IUserMessage imsg)
|
||||||
|
{
|
||||||
|
var channel = (ITextChannel)imsg.Channel;
|
||||||
|
|
||||||
|
using (var uow = DbHandler.UnitOfWork())
|
||||||
|
{
|
||||||
|
var config = uow.GuildConfigs.PermissionsFor(channel.Guild.Id);
|
||||||
|
config.RootPermission = Permission.GetDefaultRoot();
|
||||||
|
await uow.CompleteAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
await channel.SendMessageAsync($"{imsg.Author.Mention} :ok: `Permissions for this server are reset`");
|
||||||
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
|
@ -51,7 +51,7 @@ namespace NadekoBot.Modules.Administration
|
|||||||
while (!token.IsCancellationRequested)
|
while (!token.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
await Task.Delay(Repeater.Interval, token).ConfigureAwait(false);
|
await Task.Delay(Repeater.Interval, token).ConfigureAwait(false);
|
||||||
try { await Channel.SendMessageAsync("🔄 " + Repeater.Message).ConfigureAwait(false); } catch (Exception ex) { _log.Warn(ex); }
|
try { await Channel.SendMessageAsync("🔄 " + Repeater.Message).ConfigureAwait(false); } catch (Exception ex) { _log.Warn(ex); try { source.Cancel(); } catch { } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException) { }
|
catch (OperationCanceledException) { }
|
||||||
|
@ -146,7 +146,7 @@ namespace NadekoBot.Modules.Games
|
|||||||
IUserMessage msg;
|
IUserMessage msg;
|
||||||
var vowelFirst = new[] { 'a', 'e', 'i', 'o', 'u' }.Contains(Gambling.Gambling.CurrencyName[0]);
|
var vowelFirst = new[] { 'a', 'e', 'i', 'o', 'u' }.Contains(Gambling.Gambling.CurrencyName[0]);
|
||||||
|
|
||||||
var msgToSend = $"Oh how Nice! **{imsg.Author.Username}** planted {(vowelFirst ? "an" : "a")} {Gambling.Gambling.CurrencyName}. Pick it using {NadekoBot.ModulePrefixes[typeof(Gambling.Gambling).Name]}pick";
|
var msgToSend = $"Oh how Nice! **{imsg.Author.Username}** planted {(vowelFirst ? "an" : "a")} {Gambling.Gambling.CurrencyName}. Pick it using {NadekoBot.ModulePrefixes[typeof(Games).Name]}pick";
|
||||||
if (file == null)
|
if (file == null)
|
||||||
{
|
{
|
||||||
msg = await channel.SendMessageAsync(Gambling.Gambling.CurrencySign).ConfigureAwait(false);
|
msg = await channel.SendMessageAsync(Gambling.Gambling.CurrencySign).ConfigureAwait(false);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Discord;
|
using Discord;
|
||||||
|
using Discord.Net;
|
||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
using NLog;
|
using NLog;
|
||||||
using System;
|
using System;
|
||||||
@ -61,7 +62,12 @@ namespace NadekoBot.Modules.Games.Trivia
|
|||||||
}
|
}
|
||||||
oldQuestions.Add(CurrentQuestion); //add it to exclusion list so it doesn't show up again
|
oldQuestions.Add(CurrentQuestion); //add it to exclusion list so it doesn't show up again
|
||||||
//sendquestion
|
//sendquestion
|
||||||
try { await channel.SendMessageAsync($":question: **{CurrentQuestion.Question}**").ConfigureAwait(false); } catch (Exception ex) { _log.Warn(ex); }
|
try { await channel.SendMessageAsync($":question: **{CurrentQuestion.Question}**").ConfigureAwait(false); }
|
||||||
|
catch (HttpException ex) when (ex.StatusCode == System.Net.HttpStatusCode.Forbidden)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
catch (Exception ex) { _log.Warn(ex); }
|
||||||
|
|
||||||
//receive messages
|
//receive messages
|
||||||
NadekoBot.Client.MessageReceived += PotentialGuess;
|
NadekoBot.Client.MessageReceived += PotentialGuess;
|
||||||
@ -88,13 +94,15 @@ namespace NadekoBot.Modules.Games.Trivia
|
|||||||
// load next question if game is still running
|
// load next question if game is still running
|
||||||
await Task.Delay(2000).ConfigureAwait(false);
|
await Task.Delay(2000).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
try { NadekoBot.Client.MessageReceived -= PotentialGuess; } catch { }
|
||||||
|
GameActive = false;
|
||||||
await End().ConfigureAwait(false);
|
await End().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task End()
|
private async Task End()
|
||||||
{
|
{
|
||||||
ShouldStopGame = true;
|
ShouldStopGame = true;
|
||||||
await channel.SendMessageAsync("**Trivia game ended**\n" + GetLeaderboard()).ConfigureAwait(false);
|
try { await channel.SendMessageAsync("**Trivia game ended**\n" + GetLeaderboard()).ConfigureAwait(false); } catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task StopGame()
|
public async Task StopGame()
|
||||||
@ -127,7 +135,7 @@ namespace NadekoBot.Modules.Games.Trivia
|
|||||||
{
|
{
|
||||||
if (GameActive && CurrentQuestion.IsAnswerCorrect(umsg.Content) && !triviaCancelSource.IsCancellationRequested)
|
if (GameActive && CurrentQuestion.IsAnswerCorrect(umsg.Content) && !triviaCancelSource.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
Users.AddOrUpdate(guildUser, 0, (gu, old) => old++);
|
Users.AddOrUpdate(guildUser, 1, (gu, old) => ++old);
|
||||||
guess = true;
|
guess = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,7 +160,7 @@ namespace NadekoBot.Modules.Games.Trivia
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("**Leaderboard:**\n-----------\n");
|
sb.Append("**Leaderboard:**\n-----------\n");
|
||||||
|
|
||||||
foreach (var kvp in Users.OrderBy(kvp => kvp.Value))
|
foreach (var kvp in Users.OrderByDescending(kvp => kvp.Value))
|
||||||
{
|
{
|
||||||
sb.AppendLine($"**{kvp.Key.Username}** has {kvp.Value} points".ToString().SnPl(kvp.Value));
|
sb.AppendLine($"**{kvp.Key.Username}** has {kvp.Value} points".ToString().SnPl(kvp.Value));
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ namespace NadekoBot.Modules.Searches
|
|||||||
checkTimer = new Timer(async (state) =>
|
checkTimer = new Timer(async (state) =>
|
||||||
{
|
{
|
||||||
oldCachedStatuses = new ConcurrentDictionary<string, StreamStatus>(cachedStatuses);
|
oldCachedStatuses = new ConcurrentDictionary<string, StreamStatus>(cachedStatuses);
|
||||||
cachedStatuses.Clear();
|
cachedStatuses = new ConcurrentDictionary<string, StreamStatus>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IEnumerable<FollowedStream> streams;
|
IEnumerable<FollowedStream> streams;
|
||||||
|
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
@ -5270,6 +5270,33 @@ namespace NadekoBot.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to resetperms.
|
||||||
|
/// </summary>
|
||||||
|
public static string resetpermissions_cmd {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("resetpermissions_cmd", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Resets BOT's permissions module on this server to the default value..
|
||||||
|
/// </summary>
|
||||||
|
public static string resetpermissions_desc {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("resetpermissions_desc", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to `.resetperms`.
|
||||||
|
/// </summary>
|
||||||
|
public static string resetpermissions_usage {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("resetpermissions_usage", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to restart.
|
/// Looks up a localized string similar to restart.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2637,4 +2637,13 @@
|
|||||||
<data name="forwardtoall_usage" xml:space="preserve">
|
<data name="forwardtoall_usage" xml:space="preserve">
|
||||||
<value>`.fwtoall`</value>
|
<value>`.fwtoall`</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="resetpermissions_cmd" xml:space="preserve">
|
||||||
|
<value>resetperms</value>
|
||||||
|
</data>
|
||||||
|
<data name="resetpermissions_desc" xml:space="preserve">
|
||||||
|
<value>Resets BOT's permissions module on this server to the default value.</value>
|
||||||
|
</data>
|
||||||
|
<data name="resetpermissions_usage" xml:space="preserve">
|
||||||
|
<value>`.resetperms`</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
Loading…
Reference in New Issue
Block a user