Compare commits

...

11 Commits

Author SHA1 Message Date
Kwoth
3f5443dd54 - Fixed .logevents and .log bugs related to thread logging
- Upped version to 4.3.16
- closes #418
2023-05-24 10:31:05 +02:00
Kwoth
93df4f3bf3 Upped version to 4.3.15, Updated CHANGELOG.md 2023-05-21 00:37:29 +02:00
Kwoth
073b832065 Fixed .rps 'amount' field, closes #415 2023-05-17 17:39:25 +02:00
Kwoth
a01e580e03 Merge branch 'hokutochen-v4-patch-69027' into 'v4'
%img:stuff% Deprecated

See merge request Kwoth/nadekobot!295
2023-05-07 16:14:48 +00:00
Hokuto Chen
6124e2fab5 %img:stuff% Deprecated 2023-05-07 16:14:48 +00:00
Kwoth
4dd31d6a0b Fixed .showembed, closes #410 2023-05-03 02:23:10 +02:00
Kwoth
e8706d4006 Fixed -w 0 for .trivia which allows for infinite games, closes #413 2023-05-02 09:36:27 +02:00
Kwoth
140cc43c98 Merge branch 'hokutochen-v4-patch-43149' into 'v4'
updated updater link

See merge request Kwoth/nadekobot!292
2023-04-06 00:40:30 +00:00
Hokuto Chen
26b7149435 updated updater link 2023-04-06 00:40:29 +00:00
Kwoth
b354ee7269 Merge branch 'v4' into 'v4'
fixed bank award giving error message instead of checkmark

See merge request Kwoth/nadekobot!294
2023-04-06 00:40:02 +00:00
Kamal Tufekcic
b829ca0109 fixed bank award giving error message instead of checkmark 2023-04-06 00:40:02 +00:00
15 changed files with 68 additions and 26 deletions

View File

@@ -2,6 +2,22 @@
Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o
## [4.3.16] - 24.05.2023
### Fixed
- Fixed missing events from `.logevents`
- Fixed `.log` thread deleted and thread created events not working properly
## [4.3.15] - 21.05.2023
### Fixed
- Fixed -w 0 in trivia
- Fixed `.rps` amount field in the response
- Fixed `.showembed` output
- Fixed bank award's incorrect output message
## [4.3.14] - 02.04.2023
### Fixed

View File

@@ -123,7 +123,7 @@ In order to use music commands, you need ffmpeg and youtube-dl installed.
- [ffmpeg-32bit] | [ffmpeg-64bit] - Download the **appropriate version** for your system (32 bit if you're running a 32 bit OS, or 64 if you're running a 64bit OS). Unzip it, and move `ffmpeg.exe` to a path that's in your PATH environment variable. If you don't know what that is, just move the `ffmpeg.exe` file to `NadekoBot/output`.
- [youtube-dl] - Click to download the file, then move `youtube-dl.exe` to a path that's in your PATH environment variable. If you don't know what that is, just move the `youtube-dl.exe` file to `NadekoBot/system`.
[Updater]: https://dl.nadeko.bot/
[Updater]: https://dl.nadeko.bot/v3/
[Notepad++]: https://notepad-plus-plus.org/
[.net]: https://dotnet.microsoft.com/download/dotnet/5.0
[Redis]: https://github.com/MicrosoftArchive/redis/releases/download/win-3.0.504/Redis-x64-3.0.504.msi

View File

@@ -89,6 +89,5 @@ Some features have their own specific placeholders which are noted in that featu
- `%rngX-Y%` - Returns a random number between X and Y
- `%target%` - Returns anything the user has written after the trigger (only works on Expressions)
- `%img:stuff%` - Returns an `imgur.com` search for "stuff" (only works on Expressions)
![img](https://puu.sh/B7mgI.png)

View File

@@ -1,5 +1,6 @@
#nullable disable warnings
using SixLabors.ImageSharp.PixelFormats;
using System.Text.Json.Serialization;
namespace NadekoBot;
@@ -7,14 +8,14 @@ public sealed record SmartEmbedArrayElementText : SmartEmbedTextBase
{
public string Color { get; init; } = string.Empty;
public SmartEmbedArrayElementText() : base()
public SmartEmbedArrayElementText()
{
}
public SmartEmbedArrayElementText(IEmbed eb) : base(eb)
{
Color = eb.Color is { } c ? new Rgba32(c.R, c.G, c.B).ToHex() : string.Empty;
}
protected override EmbedBuilder GetEmbedInternal()
@@ -63,6 +64,7 @@ public abstract record SmartEmbedTextBase : SmartText
public SmartTextEmbedFooter Footer { get; init; }
public SmartTextEmbedField[] Fields { get; init; }
[JsonIgnore]
public bool IsValid
=> !string.IsNullOrWhiteSpace(Title)
|| !string.IsNullOrWhiteSpace(Description)
@@ -100,7 +102,7 @@ public abstract record SmartEmbedTextBase : SmartText
IconUrl = ef.IconUrl
}
: null;
if (eb.Fields.Length > 0)
{
Fields = eb.Fields.Select(field

View File

@@ -1,4 +1,6 @@
#nullable disable
using System.Text.Json.Serialization;
namespace NadekoBot;
public sealed record SmartEmbedTextArray : SmartText
@@ -6,6 +8,7 @@ public sealed record SmartEmbedTextArray : SmartText
public string Content { get; set; }
public SmartEmbedArrayElementText[] Embeds { get; set; }
[JsonIgnore]
public bool IsValid
=> Embeds?.All(x => x.IsValid) ?? false;

View File

@@ -1,16 +1,20 @@
#nullable disable
using Newtonsoft.Json.Linq;
using System.Text.Json.Serialization;
namespace NadekoBot;
public abstract record SmartText
{
[JsonIgnore]
public bool IsEmbed
=> this is SmartEmbedText;
[JsonIgnore]
public bool IsPlainText
=> this is SmartPlainText;
[JsonIgnore]
public bool IsEmbedArray
=> this is SmartEmbedTextArray;

View File

@@ -150,9 +150,11 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
{
try
{
if (sch.HasValue || sch.Value is not IGuildChannel ch)
if (!sch.HasValue)
return;
var ch = sch.Value;
if (!GuildLogSettings.TryGetValue(ch.Guild.Id, out var logSetting)
|| logSetting.ThreadDeletedId is null)
return;
@@ -165,7 +167,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
await logChannel.EmbedAsync(_eb.Create()
.WithOkColor()
.WithTitle("🆕 " + title)
.WithTitle("🗑 " + title)
.WithDescription($"{ch.Name} | {ch.Id}")
.WithFooter(CurrentTime(ch.Guild)));
}
@@ -177,15 +179,12 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
return Task.CompletedTask;
}
private Task _client_ThreadCreated(SocketThreadChannel sch)
private Task _client_ThreadCreated(SocketThreadChannel ch)
{
_ = Task.Run(async () =>
{
try
{
if (sch.Guild is not IGuildChannel ch)
return;
if (!GuildLogSettings.TryGetValue(ch.Guild.Id, out var logSetting)
|| logSetting.ThreadCreatedId is null)
return;
@@ -456,6 +455,12 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
case LogType.UserWarned:
channelId = logSetting.LogWarnsId = logSetting.LogWarnsId is null ? cid : default;
break;
case LogType.ThreadDeleted:
channelId = logSetting.ThreadDeletedId = logSetting.ThreadDeletedId is null ? cid : default;
break;
case LogType.ThreadCreated:
channelId = logSetting.ThreadCreatedId = logSetting.ThreadCreatedId is null ? cid : default;
break;
}
uow.SaveChanges();
@@ -1267,6 +1272,12 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
case LogType.UserWarned:
id = logSetting.LogWarnsId;
break;
case LogType.ThreadCreated:
id = logSetting.ThreadCreatedId;
break;
case LogType.ThreadDeleted:
id = logSetting.ThreadDeletedId;
break;
}
if (id is null or 0)

View File

@@ -143,6 +143,12 @@ public partial class Administration
return l.LogVoicePresenceTTSId;
case LogType.UserMuted:
return l.UserMutedId;
case LogType.UserWarned:
return l.LogWarnsId;
case LogType.ThreadDeleted:
return l.ThreadDeletedId;
case LogType.ThreadCreated:
return l.ThreadCreatedId;
default:
return null;
}

View File

@@ -91,14 +91,10 @@ public partial class Gambling
{
if (await _bank.AwardAsync(userId, amount))
{
await ReplyErrorLocalizedAsync(strs.take_fail(N(amount),
_client.GetUser(userId)?.ToString()
?? userId.ToString(),
CurrencySign));
await ctx.OkAsync();
return;
}
await ctx.OkAsync();
}
[Cmd]

View File

@@ -840,7 +840,7 @@ public partial class Gambling : GamblingModule<GamblingService>
else if (result.Result == RpsResultType.Win)
{
if ((long)result.Won > 0)
embed.AddField(GetText(strs.won), N(amount.Value));
embed.AddField(GetText(strs.won), N((long)result.Won));
msg = GetText(strs.rps_win(ctx.User.Mention,
GetRpsPick(pick),

View File

@@ -36,7 +36,7 @@ public partial class Games
var (opts, _) = OptionsParser.ParseFrom(new TriviaOptions(), args);
var config = _gamesConfig.Data;
if (config.Trivia.MinimumWinReq > 0 && config.Trivia.MinimumWinReq > opts.WinRequirement)
if (opts.WinRequirement != 0 && config.Trivia.MinimumWinReq > 0 && config.Trivia.MinimumWinReq > opts.WinRequirement)
return;
var trivia = new TriviaGame(opts, _cache);

View File

@@ -157,7 +157,7 @@ public sealed class TriviaGame
var isWin = false;
// if user won the game, tell the game to stop
if (val >= _opts.WinRequirement)
if (_opts.WinRequirement != 0 && val >= _opts.WinRequirement)
{
_isStopped = true;
isWin = true;

View File

@@ -550,15 +550,20 @@ public partial class Utility : NadekoModule
return;
}
var embed = msg.Embeds.FirstOrDefault();
if (embed is null)
if (!msg.Embeds.Any())
{
await ReplyErrorLocalizedAsync(strs.not_found);
return;
}
var json = SmartEmbedText.FromEmbed(embed, msg.Content).ToJson(_showEmbedSerializerOptions);
await SendConfirmAsync(Format.Sanitize(json).Replace("](", "]\\("));
var json = new SmartEmbedTextArray()
{
Content = msg.Content,
Embeds = msg.Embeds
.Map(x => new SmartEmbedArrayElementText(x))
}.ToJson(_showEmbedSerializerOptions);
await SendConfirmAsync(Format.Code(json, "json").Replace("](", "]\\("));
}
[Cmd]

View File

@@ -7,7 +7,7 @@ namespace NadekoBot.Services;
public sealed class StatsService : IStatsService, IReadyExecutor, INService
{
public const string BOT_VERSION = "4.3.14";
public const string BOT_VERSION = "4.3.16";
public string Author
=> "Kwoth#2452";

View File

@@ -1559,7 +1559,7 @@ timezones:
args:
- ""
timezone:
desc: "Sets this guilds timezone. This affects bot's time output in this server (logs, etc..)"
desc: "Sets this guilds timezone. This affects bot's time output in this server (logs, etc..) **Setting timezone requires Administrator server permission.**"
args:
- ""
- "GMT Standard Time"