mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
Added DmHelpTextKeywords to data/bot.yml
- Bot now sends dm help text ONLY if the message contains one of the keywords specified - If no keywords are specified, bot will reply to every DM (like before) - Fixed several commands which used error color for success confirmation messages
This commit is contained in:
@@ -7,13 +7,16 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
|
|||||||
### Added
|
### Added
|
||||||
- Fully translated to Brazilian Portuguese 🎉
|
- Fully translated to Brazilian Portuguese 🎉
|
||||||
- Added `%server.boosters%` and `%server.boost_level%` placeholders
|
- Added `%server.boosters%` and `%server.boost_level%` placeholders
|
||||||
|
- Added `DmHelpTextKeywords` to `data/bot.yml`
|
||||||
|
- Bot now sends dm help text ONLY if the message contains one of the keywords specified
|
||||||
|
- If no keywords are specified, bot will reply to every DM (like before)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Possible fix for `.repeat` bug
|
- Possible fix for `.repeat` bug
|
||||||
- Slight adjustment for repeater logic
|
- Slight adjustment for repeater logic
|
||||||
- Timer should no longer increase on some repeaters
|
- Timer should no longer increase on some repeaters
|
||||||
- Repeaters should no longer have periods when they're missing from the list
|
- Repeaters should no longer have periods when they're missing from the list
|
||||||
|
- Fixed several commands which used error color for success confirmation messages
|
||||||
|
|
||||||
## [3.0.3] - 15.09.2021
|
## [3.0.3] - 15.09.2021
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@ namespace NadekoBot.Common.Configs
|
|||||||
public sealed partial class BotConfig : ICloneable<BotConfig>
|
public sealed partial class BotConfig : ICloneable<BotConfig>
|
||||||
{
|
{
|
||||||
[Comment(@"DO NOT CHANGE")]
|
[Comment(@"DO NOT CHANGE")]
|
||||||
public int Version { get; set; }
|
public int Version { get; set; } = 2;
|
||||||
|
|
||||||
[Comment(@"Most commands, when executed, have a small colored line
|
[Comment(@"Most commands, when executed, have a small colored line
|
||||||
next to the response. The color depends whether the command
|
next to the response. The color depends whether the command
|
||||||
@@ -48,6 +48,11 @@ they will receive this message. Leave empty for no response. The string which wi
|
|||||||
Supports embeds. How it looks: https://puu.sh/B0BLV.png")]
|
Supports embeds. How it looks: https://puu.sh/B0BLV.png")]
|
||||||
[YamlMember(ScalarStyle = ScalarStyle.Literal)]
|
[YamlMember(ScalarStyle = ScalarStyle.Literal)]
|
||||||
public string DmHelpText { get; set; }
|
public string DmHelpText { get; set; }
|
||||||
|
|
||||||
|
[Comment(@"Only users who send a DM to the bot containing one of the specified words will get a DmHelpText response.
|
||||||
|
Case insensitive.
|
||||||
|
Leave empty to reply with DmHelpText to every DM.")]
|
||||||
|
public List<string> DmHelpTextKeywords { get; set; }
|
||||||
|
|
||||||
[Comment(@"This is the response for the .h command")]
|
[Comment(@"This is the response for the .h command")]
|
||||||
[YamlMember(ScalarStyle = ScalarStyle.Literal)]
|
[YamlMember(ScalarStyle = ScalarStyle.Literal)]
|
||||||
@@ -89,7 +94,6 @@ See RotatingStatuses submodule in Administration.")]
|
|||||||
|
|
||||||
public BotConfig()
|
public BotConfig()
|
||||||
{
|
{
|
||||||
Version = 1;
|
|
||||||
var color = new ColorConfig();
|
var color = new ColorConfig();
|
||||||
Color = color;
|
Color = color;
|
||||||
DefaultLocale = new CultureInfo("en-US");
|
DefaultLocale = new CultureInfo("en-US");
|
||||||
@@ -127,6 +131,14 @@ See RotatingStatuses submodule in Administration.")]
|
|||||||
Prefix = ".";
|
Prefix = ".";
|
||||||
RotateStatuses = false;
|
RotateStatuses = false;
|
||||||
GroupGreets = false;
|
GroupGreets = false;
|
||||||
|
DmHelpTextKeywords = new List<string>()
|
||||||
|
{
|
||||||
|
"help",
|
||||||
|
"commands",
|
||||||
|
"cmds",
|
||||||
|
"module",
|
||||||
|
"can you do"
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -88,7 +88,7 @@ namespace NadekoBot.Modules.Administration
|
|||||||
};
|
};
|
||||||
_service.AddNewAutoCommand(cmd);
|
_service.AddNewAutoCommand(cmd);
|
||||||
|
|
||||||
await ReplyErrorLocalizedAsync(strs.autocmd_add(Format.Code(Format.Sanitize(cmdText)), cmd.Interval));
|
await ReplyConfirmLocalizedAsync(strs.autocmd_add(Format.Code(Format.Sanitize(cmdText)), cmd.Interval));
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Aliases]
|
[NadekoCommand, Aliases]
|
||||||
@@ -226,7 +226,7 @@ namespace NadekoBot.Modules.Administration
|
|||||||
if (enabled)
|
if (enabled)
|
||||||
await ReplyConfirmLocalizedAsync(strs.fwdm_start).ConfigureAwait(false);
|
await ReplyConfirmLocalizedAsync(strs.fwdm_start).ConfigureAwait(false);
|
||||||
else
|
else
|
||||||
await ReplyConfirmLocalizedAsync(strs.fwdm_stop).ConfigureAwait(false);
|
await ReplyPendingLocalizedAsync(strs.fwdm_stop).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Aliases]
|
[NadekoCommand, Aliases]
|
||||||
@@ -238,7 +238,7 @@ namespace NadekoBot.Modules.Administration
|
|||||||
if (enabled)
|
if (enabled)
|
||||||
await ReplyConfirmLocalizedAsync(strs.fwall_start).ConfigureAwait(false);
|
await ReplyConfirmLocalizedAsync(strs.fwall_start).ConfigureAwait(false);
|
||||||
else
|
else
|
||||||
await ReplyConfirmLocalizedAsync(strs.fwall_stop).ConfigureAwait(false);
|
await ReplyPendingLocalizedAsync(strs.fwall_stop).ConfigureAwait(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,7 +376,7 @@ namespace NadekoBot.Modules.Administration
|
|||||||
var curUser = await ctx.Guild.GetCurrentUserAsync().ConfigureAwait(false);
|
var curUser = await ctx.Guild.GetCurrentUserAsync().ConfigureAwait(false);
|
||||||
await curUser.ModifyAsync(u => u.Nickname = newNick).ConfigureAwait(false);
|
await curUser.ModifyAsync(u => u.Nickname = newNick).ConfigureAwait(false);
|
||||||
|
|
||||||
await ReplyErrorLocalizedAsync(strs.bot_nick(Format.Bold(newNick) ?? "-"));
|
await ReplyConfirmLocalizedAsync(strs.bot_nick(Format.Bold(newNick) ?? "-"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Aliases]
|
[NadekoCommand, Aliases]
|
||||||
@@ -395,7 +395,7 @@ namespace NadekoBot.Modules.Administration
|
|||||||
|
|
||||||
await gu.ModifyAsync(u => u.Nickname = newNick).ConfigureAwait(false);
|
await gu.ModifyAsync(u => u.Nickname = newNick).ConfigureAwait(false);
|
||||||
|
|
||||||
await ReplyErrorLocalizedAsync(strs.user_nick(Format.Bold(gu.ToString()), Format.Bold(newNick) ?? "-"));
|
await ReplyConfirmLocalizedAsync(strs.user_nick(Format.Bold(gu.ToString()), Format.Bold(newNick) ?? "-"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Aliases]
|
[NadekoCommand, Aliases]
|
||||||
@@ -496,7 +496,7 @@ namespace NadekoBot.Modules.Administration
|
|||||||
public async Task ImagesReload()
|
public async Task ImagesReload()
|
||||||
{
|
{
|
||||||
await _service.ReloadImagesAsync();
|
await _service.ReloadImagesAsync();
|
||||||
await ReplyErrorLocalizedAsync(strs.images_loading);
|
await ReplyConfirmLocalizedAsync(strs.images_loading);
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Aliases]
|
[NadekoCommand, Aliases]
|
||||||
|
@@ -44,6 +44,11 @@ namespace NadekoBot.Modules.Help.Services
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(settings.DmHelpText) || settings.DmHelpText == "-")
|
if (string.IsNullOrWhiteSpace(settings.DmHelpText) || settings.DmHelpText == "-")
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|
||||||
|
// only send dm help text if it contains one of the keywords, if they're specified
|
||||||
|
// if they're not, then reply to every DM
|
||||||
|
if (settings.DmHelpTextKeywords.Any() && !settings.DmHelpTextKeywords.Any(k => msg.Content.Contains(k)))
|
||||||
|
return Task.CompletedTask;
|
||||||
|
|
||||||
var rep = new ReplacementBuilder()
|
var rep = new ReplacementBuilder()
|
||||||
.WithOverride("%prefix%", () => _bss.Data.Prefix)
|
.WithOverride("%prefix%", () => _bss.Data.Prefix)
|
||||||
|
@@ -30,7 +30,7 @@ namespace NadekoBot.Modules.Xp.Services
|
|||||||
|
|
||||||
private void Migrate()
|
private void Migrate()
|
||||||
{
|
{
|
||||||
if (_data.Version <= 1)
|
if (_data.Version < 2)
|
||||||
{
|
{
|
||||||
ModifyConfig(c =>
|
ModifyConfig(c =>
|
||||||
{
|
{
|
||||||
|
@@ -28,19 +28,15 @@ namespace NadekoBot.Services
|
|||||||
AddParsedProp("locale", bs => bs.DefaultLocale, ConfigParsers.Culture, ConfigPrinters.Culture);
|
AddParsedProp("locale", bs => bs.DefaultLocale, ConfigParsers.Culture, ConfigPrinters.Culture);
|
||||||
AddParsedProp("prefix", bs => bs.Prefix, ConfigParsers.String, ConfigPrinters.ToString);
|
AddParsedProp("prefix", bs => bs.Prefix, ConfigParsers.String, ConfigPrinters.ToString);
|
||||||
|
|
||||||
UpdateColors();
|
Migrate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateColors()
|
private void Migrate()
|
||||||
{
|
{
|
||||||
var ok = _data.Color.Ok;
|
if (_data.Version < 2)
|
||||||
var error = _data.Color.Error;
|
{
|
||||||
var pend = _data.Color.Pending;
|
ModifyConfig(c => c.Version = 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnStateUpdate()
|
|
||||||
{
|
|
||||||
UpdateColors();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
# DO NOT CHANGE
|
# DO NOT CHANGE
|
||||||
version: 1
|
version: 2
|
||||||
# Most commands, when executed, have a small colored line
|
# Most commands, when executed, have a small colored line
|
||||||
# next to the response. The color depends whether the command
|
# next to the response. The color depends whether the command
|
||||||
# is completed, errored or in progress (pending)
|
# is completed, errored or in progress (pending)
|
||||||
@@ -28,6 +28,15 @@ forwardToAllOwners: false
|
|||||||
# Supports embeds. How it looks: https://puu.sh/B0BLV.png
|
# Supports embeds. How it looks: https://puu.sh/B0BLV.png
|
||||||
dmHelpText: |-
|
dmHelpText: |-
|
||||||
{"description": "Type `%prefix%h` for help."}
|
{"description": "Type `%prefix%h` for help."}
|
||||||
|
# Only users who send a DM to the bot containing one of the specified words will get a DmHelpText response.
|
||||||
|
# Case insensitive.
|
||||||
|
# Leave empty to reply with DmHelpText to every DM.
|
||||||
|
dmHelpTextKeywords:
|
||||||
|
- help
|
||||||
|
- commands
|
||||||
|
- cmds
|
||||||
|
- module
|
||||||
|
- can you do
|
||||||
# This is the response for the .h command
|
# This is the response for the .h command
|
||||||
helpText: |-
|
helpText: |-
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user