.boostmsg will now properly show boost, and not greet message

This commit is contained in:
Kwoth
2021-09-13 12:59:47 +02:00
parent 8c5214def2
commit a5f9ac1540
3 changed files with 22 additions and 1 deletions

View File

@@ -4,7 +4,13 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
## Unreleased ## Unreleased
### Changed
- Ban `.warnp` will now prune user's messages
### Fixed
- `.boostmsg` will now properly show boost, and not greet message
## [3.0.2] - 12.09.2021 ## [3.0.2] - 12.09.2021

View File

@@ -41,6 +41,15 @@ namespace NadekoBot.Modules.Administration
await ReplyPendingLocalizedAsync(strs.boostdel_off).ConfigureAwait(false); await ReplyPendingLocalizedAsync(strs.boostdel_off).ConfigureAwait(false);
} }
[NadekoCommand, Aliases]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageGuild)]
public Task BoostMsg()
{
var boostMessage = _service.GetBoostMessage(ctx.Guild.Id);
return ReplyConfirmLocalizedAsync(strs.boostmsg_cur(boostMessage?.SanitizeMentions()));
}
[NadekoCommand, Aliases] [NadekoCommand, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageGuild)] [UserPerm(GuildPerm.ManageGuild)]
@@ -48,7 +57,7 @@ namespace NadekoBot.Modules.Administration
{ {
if (string.IsNullOrWhiteSpace(text)) if (string.IsNullOrWhiteSpace(text))
{ {
await GreetMsg().ConfigureAwait(false); await BoostMsg().ConfigureAwait(false);
return; return;
} }

View File

@@ -172,6 +172,12 @@ namespace NadekoBot.Services
return uow.GuildConfigsForId(gid, set => set).ChannelGreetMessageText; return uow.GuildConfigsForId(gid, set => set).ChannelGreetMessageText;
} }
} }
public string GetBoostMessage(ulong gid)
{
using var uow = _db.GetDbContext();
return uow.GuildConfigsForId(gid, set => set).BoostMessage;
}
private Task ByeUsers(GreetSettings conf, ITextChannel channel, IUser user) private Task ByeUsers(GreetSettings conf, ITextChannel channel, IUser user)
=> ByeUsers(conf, channel, new[] {user}); => ByeUsers(conf, channel, new[] {user});