mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 09:18:27 -04:00
Compare commits
32 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
93df4f3bf3 | ||
|
073b832065 | ||
|
a01e580e03 | ||
|
6124e2fab5 | ||
|
4dd31d6a0b | ||
|
e8706d4006 | ||
|
140cc43c98 | ||
|
26b7149435 | ||
|
b354ee7269 | ||
|
b829ca0109 | ||
|
37acdb81e8 | ||
|
a9aea65134 | ||
|
5c03c5ba16 | ||
|
42f00c08fa | ||
|
598d3b8967 | ||
|
8df41c749b | ||
|
0eaa8be2d2 | ||
|
bdbe76f9f8 | ||
|
08b609a4b4 | ||
|
42d13b32b2 | ||
|
096ada367f | ||
|
0fed33ebda | ||
|
cb9e918681 | ||
|
bbf167df4d | ||
|
595a2b401c | ||
|
5713e8414e | ||
|
a551caf0da | ||
|
b13f05c4c0 | ||
|
9ef3646711 | ||
|
9c174b8b6f | ||
|
657c1e461c | ||
|
f5a4a698bd |
31
CHANGELOG.md
31
CHANGELOG.md
@@ -2,6 +2,25 @@
|
||||
|
||||
Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o
|
||||
|
||||
## [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
|
||||
|
||||
- Fixed voice hearbeat issue
|
||||
- `.banktake` had ok/error responses flipped. No functional change
|
||||
- PermRole should deny messages in threads todo
|
||||
- Fixed chucknorris jokes
|
||||
- `.logserver` will now
|
||||
|
||||
## [4.3.13] - 20.02.2023
|
||||
|
||||
### Fixed
|
||||
@@ -16,7 +35,7 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
|
||||
|
||||
- Fixed `.betstats` not working on european locales
|
||||
- Timed `.ban` will work on users who are not in the server
|
||||
- Fixed some bugs in the medusa system
|
||||
- Fixed some bugs in the medusa system
|
||||
|
||||
## [4.3.11] - 21.01.2023
|
||||
|
||||
@@ -52,7 +71,7 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
|
||||
|
||||
## [4.3.10] - 10.11.2022
|
||||
|
||||
### Added
|
||||
### Added
|
||||
|
||||
- `.filterlist` / `.fl` command which lists link and invite filtering channels and status
|
||||
- Added support for `%target%` placeholder in `.alias` command
|
||||
@@ -61,13 +80,13 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
|
||||
|
||||
### Changed
|
||||
|
||||
- .meload and .meunload are now case sensitive. Previously loaded medusae may need to be reloaded or data/medusae/medusa.yml may need to be edited manually
|
||||
- .meload and .meunload are now case sensitive. Previously loaded medusae may need to be reloaded or data/medusae/medusa.yml may need to be edited manually
|
||||
- Several club related command have their error messages improved
|
||||
- Updated help text for .antispam and .antiraid
|
||||
- You can now specify time and date (time is optional) in `.remind` command instead of relative time, in the format `HH:mm dd.MM.YYYY`
|
||||
- OwnerId will be automatically added to `creds.yml` at bot startup if it's missing
|
||||
- OwnerId will be automatically added to `creds.yml` at bot startup if it's missing
|
||||
|
||||
### Fixed
|
||||
### Fixed
|
||||
|
||||
- Fixed `.cmdcd` console error
|
||||
- Fixed an error when currency is add per xp
|
||||
@@ -79,7 +98,7 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
|
||||
|
||||
## [4.3.9] - 12.10.2022
|
||||
|
||||
### Added
|
||||
### Added
|
||||
|
||||
- `.betstats` shows sum of all bets, payouts and the payout rate in %. Updates once an hour
|
||||
|
||||
|
@@ -24,6 +24,10 @@ The list below is not complete. Use commands above to see up-to-date list for yo
|
||||
|
||||
`trivia.min_win_req` - Restricts a user's ability to make a trivia game with a win requirement less than the set value.
|
||||
`trivia.currency_reward` - Sets the amount of currency a user will win if they place first in a completed trivia game.
|
||||
`hangman.currency_reward` - Sets the amount of currency a user will win if they win a game of hangman.
|
||||
`chatbot` - Sets which chatbot API the bot should use, values: `gpt3`, `cleverbot`.
|
||||
`gpt.model` - Sets which GPT-3 model the bot should use, values: `ada001`, `babbage001`, `curie001`, `davinci003`.
|
||||
`gpt.max_tokens` - Sets the limit of tokens GPT-3 can use per call. Find out more about tokens [here](https://help.openai.com/en/articles/4936856-what-are-tokens-and-how-to-count-them).
|
||||
|
||||
*more settings may be available in `data/games.yml` file*
|
||||
|
||||
|
@@ -20,7 +20,7 @@ It is recommended that you use **Ubuntu 20.04**, as there have been nearly no pr
|
||||
|
||||
##### Compatible operating systems:
|
||||
|
||||
- Ubuntu: 16.04, 18.04, 20.04, 21.04, 21.10
|
||||
- Ubuntu: 16.04, 18.04, 20.04
|
||||
- Mint: 19, 20
|
||||
- Debian: 10, 11
|
||||
- CentOS: 7
|
||||
|
@@ -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
|
||||
|
@@ -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)
|
||||
|
||||

|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -46,9 +46,7 @@ public sealed class CommandOrExprTypeReader : NadekoTypeReader<CommandOrExprInfo
|
||||
|
||||
public override async ValueTask<TypeReaderResult<CommandOrExprInfo>> ReadAsync(ICommandContext ctx, string input)
|
||||
{
|
||||
input = input.ToUpperInvariant();
|
||||
|
||||
if (_exprs.ExpressionExists(ctx.Guild?.Id, input) || _exprs.ExpressionExists(null, input))
|
||||
if (_exprs.ExpressionExists(ctx.Guild?.Id, input))
|
||||
return TypeReaderResult.FromSuccess(new CommandOrExprInfo(input, CommandOrExprInfo.Type.Custom));
|
||||
|
||||
var cmd = await new CommandTypeReader(_commandHandler, _cmds).ReadAsync(ctx, input);
|
||||
|
@@ -12,10 +12,4 @@ public static class NadekoExpressionExtensions
|
||||
|
||||
public static IEnumerable<NadekoExpression> ForId(this DbSet<NadekoExpression> exprs, ulong id)
|
||||
=> exprs.AsNoTracking().AsQueryable().Where(x => x.GuildId == id).ToList();
|
||||
|
||||
public static NadekoExpression GetByGuildIdAndInput(
|
||||
this DbSet<NadekoExpression> exprs,
|
||||
ulong? guildId,
|
||||
string input)
|
||||
=> exprs.FirstOrDefault(x => x.GuildId == guildId && x.Trigger.ToUpper() == input);
|
||||
}
|
@@ -19,6 +19,7 @@ public class MuteService : INService
|
||||
|
||||
private static readonly OverwritePermissions _denyOverwrite = new(addReactions: PermValue.Deny,
|
||||
sendMessages: PermValue.Deny,
|
||||
sendMessagesInThreads: PermValue.Deny,
|
||||
attachFiles: PermValue.Deny);
|
||||
|
||||
public event Action<IGuildUser, IUser, MuteType, string> UserMuted = delegate { };
|
||||
|
@@ -311,7 +311,8 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||
logSetting.UserLeftId = logSetting.UserBannedId = logSetting.UserUnbannedId = logSetting.UserUpdatedId =
|
||||
logSetting.ChannelCreatedId = logSetting.ChannelDestroyedId = logSetting.ChannelUpdatedId =
|
||||
logSetting.LogUserPresenceId = logSetting.LogVoicePresenceId = logSetting.UserMutedId =
|
||||
logSetting.LogVoicePresenceTTSId = value ? channelId : null;
|
||||
logSetting.LogVoicePresenceTTSId = logSetting.ThreadCreatedId = logSetting.ThreadDeletedId
|
||||
= logSetting.LogWarnsId = value ? channelId : null;
|
||||
await uow.SaveChangesAsync();
|
||||
GuildLogSettings.AddOrUpdate(guildId, _ => logSetting, (_, _) => logSetting);
|
||||
}
|
||||
|
@@ -34,14 +34,14 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor
|
||||
";
|
||||
|
||||
private static readonly ISerializer _exportSerializer = new SerializerBuilder()
|
||||
.WithEventEmitter(args
|
||||
=> new MultilineScalarFlowStyleEmitter(args))
|
||||
.WithNamingConvention(CamelCaseNamingConvention.Instance)
|
||||
.WithIndentedSequences()
|
||||
.ConfigureDefaultValuesHandling(DefaultValuesHandling
|
||||
.OmitDefaults)
|
||||
.DisableAliases()
|
||||
.Build();
|
||||
.WithEventEmitter(args
|
||||
=> new MultilineScalarFlowStyleEmitter(args))
|
||||
.WithNamingConvention(CamelCaseNamingConvention.Instance)
|
||||
.WithIndentedSequences()
|
||||
.ConfigureDefaultValuesHandling(DefaultValuesHandling
|
||||
.OmitDefaults)
|
||||
.DisableAliases()
|
||||
.Build();
|
||||
|
||||
public int Priority
|
||||
=> 0;
|
||||
@@ -57,8 +57,8 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor
|
||||
// 1. expressions are almost never added (compared to how many times they are being looped through)
|
||||
// 2. only need write locks for this as we'll rebuild+replace the array on every edit
|
||||
// 3. there's never many of them (at most a thousand, usually < 100)
|
||||
private NadekoExpression[] globalExpressions;
|
||||
private ConcurrentDictionary<ulong, NadekoExpression[]> newguildExpressions;
|
||||
private NadekoExpression[] globalExpressions = Array.Empty<NadekoExpression>();
|
||||
private ConcurrentDictionary<ulong, NadekoExpression[]> newguildExpressions = new();
|
||||
|
||||
private readonly DbService _db;
|
||||
private readonly DiscordSocketClient _client;
|
||||
@@ -112,20 +112,20 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor
|
||||
{
|
||||
await using var uow = _db.GetDbContext();
|
||||
var guildItems = await uow.Expressions.AsNoTracking()
|
||||
.Where(x => allGuildIds.Contains(x.GuildId.Value))
|
||||
.ToListAsync();
|
||||
.Where(x => allGuildIds.Contains(x.GuildId.Value))
|
||||
.ToListAsync();
|
||||
|
||||
newguildExpressions = guildItems.GroupBy(k => k.GuildId!.Value)
|
||||
.ToDictionary(g => g.Key,
|
||||
g => g.Select(x =>
|
||||
{
|
||||
x.Trigger = x.Trigger.Replace(MENTION_PH, _bot.Mention);
|
||||
return x;
|
||||
})
|
||||
.ToArray())
|
||||
.ToConcurrent();
|
||||
.ToDictionary(g => g.Key,
|
||||
g => g.Select(x =>
|
||||
{
|
||||
x.Trigger = x.Trigger.Replace(MENTION_PH, _bot.Mention);
|
||||
return x;
|
||||
})
|
||||
.ToArray())
|
||||
.ToConcurrent();
|
||||
|
||||
_disabledGlobalExpressionGuilds = new (await uow.GuildConfigs
|
||||
_disabledGlobalExpressionGuilds = new(await uow.GuildConfigs
|
||||
.Where(x => x.DisableGlobalExpressions)
|
||||
.Select(x => x.GuildId)
|
||||
.ToListAsyncLinqToDB());
|
||||
@@ -133,14 +133,14 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor
|
||||
lock (_gexprWriteLock)
|
||||
{
|
||||
var globalItems = uow.Expressions.AsNoTracking()
|
||||
.Where(x => x.GuildId == null || x.GuildId == 0)
|
||||
.AsEnumerable()
|
||||
.Select(x =>
|
||||
{
|
||||
x.Trigger = x.Trigger.Replace(MENTION_PH, _bot.Mention);
|
||||
return x;
|
||||
})
|
||||
.ToArray();
|
||||
.Where(x => x.GuildId == null || x.GuildId == 0)
|
||||
.AsEnumerable()
|
||||
.Select(x =>
|
||||
{
|
||||
x.Trigger = x.Trigger.Replace(MENTION_PH, _bot.Mention);
|
||||
return x;
|
||||
})
|
||||
.ToArray();
|
||||
|
||||
globalExpressions = globalItems;
|
||||
}
|
||||
@@ -167,7 +167,7 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor
|
||||
|
||||
if (_disabledGlobalExpressionGuilds.Contains(channel.Guild.Id))
|
||||
return null;
|
||||
|
||||
|
||||
var localGrs = globalExpressions;
|
||||
|
||||
return MatchExpressions(content, localGrs);
|
||||
@@ -466,7 +466,7 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
expr = uow.Expressions.GetById(id);
|
||||
|
||||
|
||||
if (expr is null || expr.GuildId != guildId)
|
||||
return (false, false);
|
||||
if (field == ExprField.AutoDelete)
|
||||
@@ -509,9 +509,25 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor
|
||||
|
||||
public bool ExpressionExists(ulong? guildId, string input)
|
||||
{
|
||||
using var uow = _db.GetDbContext();
|
||||
var expr = uow.Expressions.GetByGuildIdAndInput(guildId, input);
|
||||
return expr is not null;
|
||||
input = input.ToLowerInvariant();
|
||||
|
||||
var gexprs = globalExpressions;
|
||||
foreach (var t in gexprs)
|
||||
{
|
||||
if (t.Trigger == input)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guildId is ulong gid && newguildExpressions.TryGetValue(gid, out var guildExprs))
|
||||
{
|
||||
foreach (var t in guildExprs)
|
||||
{
|
||||
if (t.Trigger == input)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public string ExportExpressions(ulong? guildId)
|
||||
@@ -542,17 +558,17 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor
|
||||
{
|
||||
var trigger = entry.Key;
|
||||
await uow.Expressions.AddRangeAsync(entry.Value.Where(expr => !string.IsNullOrWhiteSpace(expr.Res))
|
||||
.Select(expr => new NadekoExpression
|
||||
{
|
||||
GuildId = guildId,
|
||||
Response = expr.Res,
|
||||
Reactions = expr.React?.Join("@@@"),
|
||||
Trigger = trigger,
|
||||
AllowTarget = expr.At,
|
||||
ContainsAnywhere = expr.Ca,
|
||||
DmResponse = expr.Dm,
|
||||
AutoDeleteTrigger = expr.Ad
|
||||
}));
|
||||
.Select(expr => new NadekoExpression
|
||||
{
|
||||
GuildId = guildId,
|
||||
Response = expr.Res,
|
||||
Reactions = expr.React?.Join("@@@"),
|
||||
Trigger = trigger,
|
||||
AllowTarget = expr.At,
|
||||
ContainsAnywhere = expr.Ca,
|
||||
DmResponse = expr.Dm,
|
||||
AutoDeleteTrigger = expr.Ad
|
||||
}));
|
||||
}
|
||||
|
||||
await uow.SaveChangesAsync();
|
||||
@@ -725,12 +741,12 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor
|
||||
var gc = ctx.GuildConfigsForId(guildId, set => set);
|
||||
var toReturn = gc.DisableGlobalExpressions = !gc.DisableGlobalExpressions;
|
||||
await ctx.SaveChangesAsync();
|
||||
|
||||
|
||||
if (toReturn)
|
||||
_disabledGlobalExpressionGuilds.Add(guildId);
|
||||
else
|
||||
_disabledGlobalExpressionGuilds.TryRemove(guildId);
|
||||
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
}
|
@@ -77,28 +77,24 @@ public partial class Gambling
|
||||
{
|
||||
if (await _bank.TakeAsync(userId, amount))
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.take_fail(N(amount),
|
||||
_client.GetUser(userId)?.ToString()
|
||||
?? userId.ToString(),
|
||||
CurrencySign));
|
||||
await ctx.OkAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
await ctx.OkAsync();
|
||||
|
||||
await ReplyErrorLocalizedAsync(strs.take_fail(N(amount),
|
||||
_client.GetUser(userId)?.ToString()
|
||||
?? userId.ToString(),
|
||||
CurrencySign));
|
||||
}
|
||||
|
||||
private async Task BankAwardInternalAsync(long amount, ulong userId)
|
||||
{
|
||||
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]
|
||||
|
@@ -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),
|
||||
|
@@ -108,10 +108,10 @@ public sealed partial class GamesConfig : ICloneable<GamesConfig>
|
||||
public sealed partial class ChatGptConfig
|
||||
{
|
||||
[Comment(@"Which GPT-3 Model should bot use.
|
||||
'ada' - cheapest and fastest
|
||||
'babbage' - 2nd option
|
||||
'curie' - 3rd option
|
||||
'davinci' - Most expensive, slowest")]
|
||||
'ada001' - cheapest and fastest
|
||||
'babbage001' - 2nd option
|
||||
'curie001' - 3rd option
|
||||
'davinci003' - Most expensive, slowest")]
|
||||
public Gpt3Model Model { get; set; } = Gpt3Model.Ada001;
|
||||
|
||||
[Comment(@"The maximum number of tokens to use per GPT-3 API call")]
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -39,7 +39,7 @@ public partial class Searches
|
||||
[Cmd]
|
||||
public async Task MagicItem()
|
||||
{
|
||||
if (!_service.WowJokes.Any())
|
||||
if (!_service.MagicItems.Any())
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.magicitems_not_loaded);
|
||||
return;
|
||||
|
@@ -199,7 +199,7 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
if (!await ValidateQuery(ffs))
|
||||
return;
|
||||
|
||||
var shortenedUrl = await _google.ShortenUrl($"https://lmgtfy.com/?q={Uri.EscapeDataString(ffs)}");
|
||||
var shortenedUrl = await _google.ShortenUrl($"https://letmegooglethat.com/?q={Uri.EscapeDataString(ffs)}");
|
||||
await SendConfirmAsync($"<{shortenedUrl}>");
|
||||
}
|
||||
|
||||
|
@@ -296,8 +296,8 @@ public class SearchesService : INService
|
||||
public async Task<string> GetChuckNorrisJoke()
|
||||
{
|
||||
using var http = _httpFactory.CreateClient();
|
||||
var response = await http.GetStringAsync(new Uri("http://api.icndb.com/jokes/random/"));
|
||||
return JObject.Parse(response)["value"]["joke"] + " 😆";
|
||||
var response = await http.GetStringAsync(new Uri("https://api.chucknorris.io/jokes/random"));
|
||||
return JObject.Parse(response)["value"] + " 😆";
|
||||
}
|
||||
|
||||
public async Task<MtgData> GetMtgCardAsync(string search)
|
||||
|
@@ -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]
|
||||
|
@@ -7,7 +7,7 @@ namespace NadekoBot.Services;
|
||||
|
||||
public sealed class StatsService : IStatsService, IReadyExecutor, INService
|
||||
{
|
||||
public const string BOT_VERSION = "4.3.13";
|
||||
public const string BOT_VERSION = "4.3.15";
|
||||
|
||||
public string Author
|
||||
=> "Kwoth#2452";
|
||||
|
@@ -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"
|
||||
|
@@ -237,20 +237,25 @@ namespace Ayu.Discord.Voice
|
||||
_udpEp = new(IPAddress.Parse(ready.Ip), ready.Port);
|
||||
|
||||
var ssrcBytes = BitConverter.GetBytes(Ssrc);
|
||||
var ipDiscoveryData = new byte[70];
|
||||
Buffer.BlockCopy(ssrcBytes, 0, ipDiscoveryData, 0, ssrcBytes.Length);
|
||||
Array.Reverse(ssrcBytes);
|
||||
var ipDiscoveryData = new byte[74];
|
||||
Buffer.BlockCopy(ssrcBytes, 0, ipDiscoveryData, 4, ssrcBytes.Length);
|
||||
ipDiscoveryData[0] = 0x00;
|
||||
ipDiscoveryData[1] = 0x01;
|
||||
ipDiscoveryData[2] = 0x00;
|
||||
ipDiscoveryData[3] = 0x46;
|
||||
await _udpClient.SendAsync(ipDiscoveryData, ipDiscoveryData.Length, _udpEp);
|
||||
while (true)
|
||||
{
|
||||
var buffer = _udpClient.Receive(ref _udpEp);
|
||||
|
||||
if (buffer.Length == 70)
|
||||
if (buffer.Length == 74)
|
||||
{
|
||||
//Log.Information("Received IP discovery data.");
|
||||
|
||||
var myIp = Encoding.UTF8.GetString(buffer, 4, buffer.Length - 8);
|
||||
var myIp = Encoding.UTF8.GetString(buffer, 8, buffer.Length - 10);
|
||||
MyIp = myIp.TrimEnd('\0');
|
||||
MyPort = BitConverter.ToUInt16(buffer, buffer.Length - 2);
|
||||
MyPort = (ushort)((buffer[^2] << 8) | buffer[^1]);
|
||||
|
||||
//Log.Information("{MyIp}:{MyPort}", MyIp, MyPort);
|
||||
|
||||
@@ -367,4 +372,4 @@ namespace Ayu.Discord.Voice
|
||||
await complete.Task;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user