2020-07-05 13:16:21 +02:00
using System.Text ;
2020-02-12 15:16:19 +01:00
2020-12-25 12:56:46 +01:00
using Myriad.Builders ;
2020-12-22 16:55:13 +01:00
using Myriad.Cache ;
using Myriad.Extensions ;
using Myriad.Types ;
2020-02-12 15:16:19 +01:00
using PluralKit.Core ;
2019-06-21 13:49:58 +02:00
2021-11-26 21:10:56 -05:00
namespace PluralKit.Bot ;
public class ServerConfig
2019-06-21 13:49:58 +02:00
{
2021-11-26 21:10:56 -05:00
private readonly IDiscordCache _cache ;
2022-01-22 03:05:01 -05:00
public ServerConfig ( IDiscordCache cache )
2021-11-26 21:10:56 -05:00
{
_cache = cache ;
}
2024-11-10 15:46:36 +13:00
private record PaginatedConfigItem ( string Key , string Description , string? CurrentValue , string DefaultValue ) ;
private string EnabledDisabled ( bool value ) = > value ? "enabled" : "disabled" ;
public async Task ShowConfig ( Context ctx )
{
await ctx . CheckGuildContext ( ) . CheckAuthorPermission ( PermissionSet . ManageGuild , "Manage Server" ) ;
var items = new List < PaginatedConfigItem > ( ) ;
items . Add ( new (
"log cleanup" ,
"Whether to clean up other bots' log channels" ,
EnabledDisabled ( ctx . GuildConfig ! . LogCleanupEnabled ) ,
"disabled"
) ) ;
items . Add ( new (
"invalid command error" ,
"Whether to show an error message when an unknown command is sent" ,
EnabledDisabled ( ctx . GuildConfig ! . InvalidCommandResponseEnabled ) ,
"enabled"
) ) ;
items . Add ( new (
"require tag" ,
"Whether server users are required to have a system tag on proxied messages" ,
EnabledDisabled ( ctx . GuildConfig ! . RequireSystemTag ) ,
"disabled"
) ) ;
2024-12-30 04:33:17 +00:00
items . Add ( new (
"suppress notifications" ,
"Whether all proxied messages will have notifications suppressed (sent as `@silent` messages)" ,
EnabledDisabled ( ctx . GuildConfig ! . SuppressNotifications ) ,
"disabled"
) ) ;
2024-11-12 05:19:44 +09:00
items . Add ( new (
"log channel" ,
"Channel to log proxied messages to" ,
ctx . GuildConfig ! . LogChannel ! = null ? $"<#{ctx.GuildConfig.LogChannel}>" : "none" ,
"none"
) ) ;
2024-12-31 08:09:18 -07:00
string ChannelListMessage ( int count , string cmd ) = > $"{count} channels, use `{ctx.DefaultPrefix}scfg {cmd}` to view/update" ;
2024-11-12 05:19:44 +09:00
items . Add ( new (
"log blacklist" ,
"Channels whose proxied messages will not be logged" ,
ChannelListMessage ( ctx . GuildConfig ! . LogBlacklist . Length , "log blacklist" ) ,
ChannelListMessage ( 0 , "log blacklist" )
) ) ;
items . Add ( new (
"proxy blacklist" ,
"Channels where message proxying is disabled" ,
ChannelListMessage ( ctx . GuildConfig ! . Blacklist . Length , "proxy blacklist" ) ,
ChannelListMessage ( 0 , "proxy blacklist" )
) ) ;
2024-11-10 15:46:36 +13:00
await ctx . Paginate < PaginatedConfigItem > (
items . ToAsyncEnumerable ( ) ,
items . Count ,
10 ,
"Current settings for this server" ,
null ,
( eb , l ) = >
{
var description = new StringBuilder ( ) ;
foreach ( var item in l )
{
description . Append ( item . Key . AsCode ( ) ) ;
description . Append ( $" **({item.CurrentValue ?? item.DefaultValue})**" ) ;
if ( item . CurrentValue ! = null & & item . CurrentValue ! = item . DefaultValue )
description . Append ( "\ud83d\udd39" ) ;
description . AppendLine ( ) ;
description . Append ( item . Description ) ;
description . AppendLine ( ) ;
description . AppendLine ( ) ;
}
eb . Description ( description . ToString ( ) ) ;
// using *large* blue diamond here since it's easier to see in the small footer
2024-12-31 08:09:18 -07:00
eb . Footer ( new ( $"\U0001f537 means this setting was changed. Type `{ctx.DefaultPrefix}serverconfig <setting name> clear` to reset it to the default." ) ) ;
2024-11-10 15:46:36 +13:00
return Task . CompletedTask ;
}
) ;
}
2021-11-26 21:10:56 -05:00
public async Task SetLogChannel ( Context ctx )
2019-06-21 13:49:58 +02:00
{
2021-11-26 21:10:56 -05:00
await ctx . CheckGuildContext ( ) . CheckAuthorPermission ( PermissionSet . ManageGuild , "Manage Server" ) ;
2022-01-22 03:05:01 -05:00
var settings = await ctx . Repository . GetGuild ( ctx . Guild . Id ) ;
2021-11-26 21:10:56 -05:00
2022-12-01 07:16:36 +00:00
if ( ctx . MatchClear ( ) & & await ctx . ConfirmClear ( "the server log channel" ) )
2019-06-21 13:49:58 +02:00
{
2022-01-22 03:05:01 -05:00
await ctx . Repository . UpdateGuild ( ctx . Guild . Id , new GuildPatch { LogChannel = null } ) ;
2021-11-26 21:10:56 -05:00
await ctx . Reply ( $"{Emojis.Success} Proxy logging channel cleared." ) ;
return ;
2019-10-05 07:41:00 +02:00
}
2021-11-26 21:10:56 -05:00
if ( ! ctx . HasNext ( ) )
2019-10-05 07:41:00 +02:00
{
2021-11-26 21:10:56 -05:00
if ( settings . LogChannel = = null )
2021-10-29 13:28:27 -04:00
{
2021-11-26 21:10:56 -05:00
await ctx . Reply ( "This server does not have a log channel set." ) ;
2021-10-29 13:28:27 -04:00
return ;
}
2021-08-27 11:03:47 -04:00
2021-11-26 21:10:56 -05:00
await ctx . Reply ( $"This server's log channel is currently set to <#{settings.LogChannel}>." ) ;
return ;
2019-06-21 13:49:58 +02:00
}
2019-11-03 19:15:50 +01:00
2021-11-26 21:10:56 -05:00
Channel channel = null ;
var channelString = ctx . PeekArgument ( ) ;
channel = await ctx . MatchChannel ( ) ;
if ( channel = = null | | channel . GuildId ! = ctx . Guild . Id ) throw Errors . ChannelNotFound ( channelString ) ;
2023-03-24 11:18:23 -04:00
if ( channel . Type ! = Channel . ChannelType . GuildText & & channel . Type ! = Channel . ChannelType . GuildPublicThread & & channel . Type ! = Channel . ChannelType . GuildPrivateThread )
2021-11-26 21:10:56 -05:00
throw new PKError ( "PluralKit cannot log messages to this type of channel." ) ;
2024-09-14 12:19:47 +09:00
var perms = await _cache . BotPermissionsIn ( ctx . Guild . Id , channel . Id ) ;
2021-11-26 21:10:56 -05:00
if ( ! perms . HasFlag ( PermissionSet . SendMessages ) )
throw new PKError ( "PluralKit is missing **Send Messages** permissions in the new log channel." ) ;
if ( ! perms . HasFlag ( PermissionSet . EmbedLinks ) )
throw new PKError ( "PluralKit is missing **Embed Links** permissions in the new log channel." ) ;
2022-01-22 03:05:01 -05:00
await ctx . Repository . UpdateGuild ( ctx . Guild . Id , new GuildPatch { LogChannel = channel . Id } ) ;
2021-11-26 21:10:56 -05:00
await ctx . Reply ( $"{Emojis.Success} Proxy logging channel set to <#{channel.Id}>." ) ;
}
2019-11-03 19:15:50 +01:00
2024-11-12 05:19:44 +09:00
// legacy behaviour: enable/disable logging for commands
// new behaviour is add/remove from log blacklist (see #LogBlacklistNew)
2021-11-26 21:10:56 -05:00
public async Task SetLogEnabled ( Context ctx , bool enable )
{
await ctx . CheckGuildContext ( ) . CheckAuthorPermission ( PermissionSet . ManageGuild , "Manage Server" ) ;
var affectedChannels = new List < Channel > ( ) ;
if ( ctx . Match ( "all" ) )
affectedChannels = ( await _cache . GetGuildChannels ( ctx . Guild . Id ) )
. Where ( x = > x . Type = = Channel . ChannelType . GuildText ) . ToList ( ) ;
else if ( ! ctx . HasNext ( ) ) throw new PKSyntaxError ( "You must pass one or more #channels." ) ;
else
while ( ctx . HasNext ( ) )
{
var channelString = ctx . PeekArgument ( ) ;
var channel = await ctx . MatchChannel ( ) ;
if ( channel = = null | | channel . GuildId ! = ctx . Guild . Id ) throw Errors . ChannelNotFound ( channelString ) ;
affectedChannels . Add ( channel ) ;
}
2019-11-03 19:15:50 +01:00
2021-11-26 21:10:56 -05:00
ulong? logChannel = null ;
2022-01-22 03:05:01 -05:00
var config = await ctx . Repository . GetGuild ( ctx . Guild . Id ) ;
2021-11-26 21:10:56 -05:00
logChannel = config . LogChannel ;
2021-08-27 11:03:47 -04:00
2021-11-26 21:10:56 -05:00
var blacklist = config . LogBlacklist . ToHashSet ( ) ;
if ( enable )
blacklist . ExceptWith ( affectedChannels . Select ( c = > c . Id ) ) ;
else
blacklist . UnionWith ( affectedChannels . Select ( c = > c . Id ) ) ;
2021-09-29 21:51:38 -04:00
2022-01-22 03:05:01 -05:00
await ctx . Repository . UpdateGuild ( ctx . Guild . Id , new GuildPatch { LogBlacklist = blacklist . ToArray ( ) } ) ;
2020-06-13 13:58:27 +02:00
2021-11-26 21:10:56 -05:00
await ctx . Reply (
$"{Emojis.Success} Message logging for the given channels {(enable ? " enabled " : " disabled ")}." +
( logChannel = = null
2024-12-31 08:09:18 -07:00
? $"\n{Emojis.Warn} Please note that no logging channel is set, so there is nowhere to log messages to. You can set a logging channel using `{ctx.DefaultPrefix}serverconfig log channel #your-log-channel`."
2021-11-26 21:10:56 -05:00
: "" ) ) ;
}
2020-07-05 06:54:27 -04:00
2024-11-12 05:19:44 +09:00
public async Task ShowProxyBlacklisted ( Context ctx )
2021-11-26 21:10:56 -05:00
{
await ctx . CheckGuildContext ( ) . CheckAuthorPermission ( PermissionSet . ManageGuild , "Manage Server" ) ;
2020-07-05 06:54:27 -04:00
2022-01-22 03:05:01 -05:00
var blacklist = await ctx . Repository . GetGuild ( ctx . Guild . Id ) ;
2021-08-27 11:03:47 -04:00
2021-11-26 21:10:56 -05:00
// Resolve all channels from the cache and order by position
var channels = ( await Task . WhenAll ( blacklist . Blacklist
2024-09-14 12:19:47 +09:00
. Select ( id = > _cache . TryGetChannel ( ctx . Guild . Id , id ) ) ) )
2021-11-26 21:10:56 -05:00
. Where ( c = > c ! = null )
. OrderBy ( c = > c . Position )
. ToList ( ) ;
2020-07-05 06:54:27 -04:00
2021-11-26 21:10:56 -05:00
if ( channels . Count = = 0 )
{
2024-11-12 05:19:44 +09:00
await ctx . Reply ( "This server has no channels where proxying is disabled." ) ;
2021-11-26 21:10:56 -05:00
return ;
}
2020-07-05 13:08:18 +02:00
2021-11-26 21:10:56 -05:00
await ctx . Paginate ( channels . ToAsyncEnumerable ( ) , channels . Count , 25 ,
$"Blacklisted channels for {ctx.Guild.Name}" ,
null ,
async ( eb , l ) = >
{
async Task < string > CategoryName ( ulong? id ) = >
2024-09-14 12:19:47 +09:00
id ! = null ? ( await _cache . GetChannel ( ctx . Guild . Id , id . Value ) ) . Name : "(no category)" ;
2021-08-27 11:03:47 -04:00
2021-11-26 21:10:56 -05:00
ulong? lastCategory = null ;
2020-07-05 13:16:21 +02:00
2021-11-26 21:10:56 -05:00
var fieldValue = new StringBuilder ( ) ;
foreach ( var channel in l )
{
if ( lastCategory ! = channel ! . ParentId & & fieldValue . Length > 0 )
2020-07-05 13:16:21 +02:00
{
2021-11-26 21:10:56 -05:00
eb . Field ( new Embed . Field ( await CategoryName ( lastCategory ) , fieldValue . ToString ( ) ) ) ;
fieldValue . Clear ( ) ;
}
else
{
fieldValue . Append ( "\n" ) ;
2020-07-05 13:16:21 +02:00
}
2021-11-26 21:10:56 -05:00
fieldValue . Append ( channel . Mention ( ) ) ;
lastCategory = channel . ParentId ;
2021-08-27 11:03:47 -04:00
}
2021-11-26 21:10:56 -05:00
eb . Field ( new Embed . Field ( await CategoryName ( lastCategory ) , fieldValue . ToString ( ) ) ) ;
} ) ;
}
2021-08-27 11:03:47 -04:00
2022-06-02 22:36:42 -04:00
public async Task ShowLogDisabledChannels ( Context ctx )
{
await ctx . CheckGuildContext ( ) . CheckAuthorPermission ( PermissionSet . ManageGuild , "Manage Server" ) ;
var config = await ctx . Repository . GetGuild ( ctx . Guild . Id ) ;
// Resolve all channels from the cache and order by position
2024-09-14 12:19:47 +09:00
// todo: GetAllChannels?
2022-06-02 22:36:42 -04:00
var channels = ( await Task . WhenAll ( config . LogBlacklist
2024-09-14 12:19:47 +09:00
. Select ( id = > _cache . TryGetChannel ( ctx . Guild . Id , id ) ) ) )
2022-06-02 22:36:42 -04:00
. Where ( c = > c ! = null )
. OrderBy ( c = > c . Position )
. ToList ( ) ;
if ( channels . Count = = 0 )
{
await ctx . Reply ( "This server has no channels where logging is disabled." ) ;
return ;
}
await ctx . Paginate ( channels . ToAsyncEnumerable ( ) , channels . Count , 25 ,
$"Channels where logging is disabled for {ctx.Guild.Name}" ,
null ,
async ( eb , l ) = >
{
async Task < string > CategoryName ( ulong? id ) = >
2024-09-14 12:19:47 +09:00
id ! = null ? ( await _cache . GetChannel ( ctx . Guild . Id , id . Value ) ) . Name : "(no category)" ;
2022-06-02 22:36:42 -04:00
ulong? lastCategory = null ;
var fieldValue = new StringBuilder ( ) ;
foreach ( var channel in l )
{
if ( lastCategory ! = channel ! . ParentId & & fieldValue . Length > 0 )
{
eb . Field ( new Embed . Field ( await CategoryName ( lastCategory ) , fieldValue . ToString ( ) ) ) ;
fieldValue . Clear ( ) ;
}
else
{
fieldValue . Append ( "\n" ) ;
}
fieldValue . Append ( channel . Mention ( ) ) ;
lastCategory = channel . ParentId ;
}
eb . Field ( new Embed . Field ( await CategoryName ( lastCategory ) , fieldValue . ToString ( ) ) ) ;
} ) ;
}
2024-11-12 05:19:44 +09:00
public async Task SetProxyBlacklisted ( Context ctx , bool shouldAdd )
2021-11-26 21:10:56 -05:00
{
await ctx . CheckGuildContext ( ) . CheckAuthorPermission ( PermissionSet . ManageGuild , "Manage Server" ) ;
var affectedChannels = new List < Channel > ( ) ;
if ( ctx . Match ( "all" ) )
affectedChannels = ( await _cache . GetGuildChannels ( ctx . Guild . Id ) )
2024-10-04 04:58:24 -06:00
// All the channel types you can proxy in
. Where ( x = > DiscordUtils . IsValidGuildChannel ( x ) ) . ToList ( ) ;
2021-11-26 21:10:56 -05:00
else if ( ! ctx . HasNext ( ) ) throw new PKSyntaxError ( "You must pass one or more #channels." ) ;
else
while ( ctx . HasNext ( ) )
{
var channelString = ctx . PeekArgument ( ) ;
var channel = await ctx . MatchChannel ( ) ;
if ( channel = = null | | channel . GuildId ! = ctx . Guild . Id ) throw Errors . ChannelNotFound ( channelString ) ;
affectedChannels . Add ( channel ) ;
}
2021-09-29 21:51:38 -04:00
2022-01-22 03:05:01 -05:00
var guild = await ctx . Repository . GetGuild ( ctx . Guild . Id ) ;
2019-11-03 19:15:50 +01:00
2021-11-26 21:10:56 -05:00
var blacklist = guild . Blacklist . ToHashSet ( ) ;
if ( shouldAdd )
blacklist . UnionWith ( affectedChannels . Select ( c = > c . Id ) ) ;
else
blacklist . ExceptWith ( affectedChannels . Select ( c = > c . Id ) ) ;
2020-02-15 00:12:03 +01:00
2022-01-22 03:05:01 -05:00
await ctx . Repository . UpdateGuild ( ctx . Guild . Id , new GuildPatch { Blacklist = blacklist . ToArray ( ) } ) ;
2020-02-15 00:12:03 +01:00
2021-11-26 21:10:56 -05:00
await ctx . Reply (
$"{Emojis.Success} Channels {(shouldAdd ? " added to " : " removed from ")} the proxy blacklist." ) ;
}
2020-06-13 13:58:27 +02:00
2024-11-12 05:19:44 +09:00
public async Task SetLogBlacklisted ( Context ctx , bool shouldAdd )
{
await ctx . CheckGuildContext ( ) . CheckAuthorPermission ( PermissionSet . ManageGuild , "Manage Server" ) ;
var affectedChannels = new List < Channel > ( ) ;
if ( ctx . Match ( "all" ) )
affectedChannels = ( await _cache . GetGuildChannels ( ctx . Guild . Id ) )
// All the channel types you can proxy in
. Where ( x = > DiscordUtils . IsValidGuildChannel ( x ) ) . ToList ( ) ;
else if ( ! ctx . HasNext ( ) ) throw new PKSyntaxError ( "You must pass one or more #channels." ) ;
else
while ( ctx . HasNext ( ) )
{
var channelString = ctx . PeekArgument ( ) ;
var channel = await ctx . MatchChannel ( ) ;
if ( channel = = null | | channel . GuildId ! = ctx . Guild . Id ) throw Errors . ChannelNotFound ( channelString ) ;
affectedChannels . Add ( channel ) ;
}
var guild = await ctx . Repository . GetGuild ( ctx . Guild . Id ) ;
var blacklist = guild . LogBlacklist . ToHashSet ( ) ;
if ( shouldAdd )
blacklist . UnionWith ( affectedChannels . Select ( c = > c . Id ) ) ;
else
blacklist . ExceptWith ( affectedChannels . Select ( c = > c . Id ) ) ;
await ctx . Repository . UpdateGuild ( ctx . Guild . Id , new GuildPatch { LogBlacklist = blacklist . ToArray ( ) } ) ;
await ctx . Reply (
2024-11-14 11:35:02 +09:00
$"{Emojis.Success} Channels {(shouldAdd ? " added to " : " removed from ")} the logging blacklist." +
( guild . LogChannel = = null
2024-12-31 08:09:18 -07:00
? $"\n{Emojis.Warn} Please note that no logging channel is set, so there is nowhere to log messages to. You can set a logging channel using `{ctx.DefaultPrefix}serverconfig log channel #your-log-channel`."
2024-11-14 11:35:02 +09:00
: "" ) ) ;
2024-11-12 05:19:44 +09:00
}
2021-11-26 21:10:56 -05:00
public async Task SetLogCleanup ( Context ctx )
{
2022-01-22 03:05:01 -05:00
var botList = string . Join ( ", " , LoggerCleanService . Bots . Select ( b = > b . Name ) . OrderBy ( x = > x . ToLowerInvariant ( ) ) ) ;
2022-06-21 11:13:24 -04:00
var eb = new EmbedBuilder ( )
. Title ( "Log cleanup settings" )
. Field ( new Embed . Field ( "Supported bots" , botList ) ) ;
2020-06-29 15:20:28 +02:00
2022-06-21 11:13:24 -04:00
if ( ctx . Guild = = null )
2021-11-26 21:10:56 -05:00
{
2022-06-21 11:13:24 -04:00
eb . Description ( "Run this command in a server to enable/disable log cleanup." ) ;
await ctx . Reply ( embed : eb . Build ( ) ) ;
return ;
2021-11-26 21:10:56 -05:00
}
2022-06-21 11:13:24 -04:00
await ctx . CheckGuildContext ( ) . CheckAuthorPermission ( PermissionSet . ManageGuild , "Manage Server" ) ;
bool? newValue = ctx . MatchToggleOrNull ( ) ;
if ( newValue = = null )
{
2024-11-10 15:46:36 +13:00
if ( ctx . GuildConfig ! . LogCleanupEnabled )
2021-11-26 21:10:56 -05:00
eb . Description (
2024-12-31 08:09:18 -07:00
$"Log cleanup is currently **on** for this server. To disable it, type `{ctx.DefaultPrefix}serverconfig logclean off`." ) ;
2020-06-13 13:58:27 +02:00
else
2021-11-26 21:10:56 -05:00
eb . Description (
2024-12-31 08:09:18 -07:00
$"Log cleanup is currently **off** for this server. To enable it, type `{ctx.DefaultPrefix}serverconfig logclean on`." ) ;
2021-11-26 21:10:56 -05:00
await ctx . Reply ( embed : eb . Build ( ) ) ;
return ;
2020-02-15 00:12:03 +01:00
}
2021-11-26 21:10:56 -05:00
2022-06-21 11:13:24 -04:00
await ctx . Repository . UpdateGuild ( ctx . Guild . Id , new GuildPatch { LogCleanupEnabled = newValue . Value } ) ;
2021-11-26 21:10:56 -05:00
2022-06-21 11:13:24 -04:00
if ( newValue . Value )
2021-11-26 21:10:56 -05:00
await ctx . Reply (
$"{Emojis.Success} Log cleanup has been **enabled** for this server. Messages deleted by PluralKit will now be cleaned up from logging channels managed by the following bots:\n- **{botList}**\n\n{Emojis.Note} Make sure PluralKit has the **Manage Messages** permission in the channels in question.\n{Emojis.Note} Also, make sure to blacklist the logging channel itself from the bots in question to prevent conflicts." ) ;
else
await ctx . Reply ( $"{Emojis.Success} Log cleanup has been **disabled** for this server." ) ;
2019-06-21 13:49:58 +02:00
}
2024-11-10 15:46:36 +13:00
public async Task InvalidCommandResponse ( Context ctx )
{
await ctx . CheckGuildContext ( ) . CheckAuthorPermission ( PermissionSet . ManageGuild , "Manage Server" ) ;
if ( ! ctx . HasNext ( ) )
{
var msg = $"Error responses for unknown/invalid commands are currently **{EnabledDisabled(ctx.GuildConfig!.InvalidCommandResponseEnabled)}**." ;
await ctx . Reply ( msg ) ;
return ;
}
var newVal = ctx . MatchToggle ( false ) ;
await ctx . Repository . UpdateGuild ( ctx . Guild . Id , new ( ) { InvalidCommandResponseEnabled = newVal } ) ;
await ctx . Reply ( $"Error responses for unknown/invalid commands are now {EnabledDisabled(newVal)}." ) ;
}
public async Task RequireSystemTag ( Context ctx )
{
await ctx . CheckGuildContext ( ) . CheckAuthorPermission ( PermissionSet . ManageGuild , "Manage Server" ) ;
if ( ! ctx . HasNext ( ) )
{
var msg = $"System tags are currently **{(ctx.GuildConfig!.RequireSystemTag ? " required " : " not required ")}** for PluralKit users in this server." ;
await ctx . Reply ( msg ) ;
return ;
}
var newVal = ctx . MatchToggle ( false ) ;
await ctx . Repository . UpdateGuild ( ctx . Guild . Id , new ( ) { RequireSystemTag = newVal } ) ;
await ctx . Reply ( $"System tags are now **{(newVal ? " required " : " not required ")}** for PluralKit users in this server." ) ;
}
2024-12-30 04:33:17 +00:00
public async Task SuppressNotifications ( Context ctx )
{
await ctx . CheckGuildContext ( ) . CheckAuthorPermission ( PermissionSet . ManageGuild , "Manage Server" ) ;
if ( ! ctx . HasNext ( ) )
{
var msg = $"Suppressing notifications for proxied messages is currently **{EnabledDisabled(ctx.GuildConfig!.SuppressNotifications)}**." ;
await ctx . Reply ( msg ) ;
return ;
}
var newVal = ctx . MatchToggle ( false ) ;
await ctx . Repository . UpdateGuild ( ctx . Guild . Id , new ( ) { SuppressNotifications = newVal } ) ;
await ctx . Reply ( $"Suppressing notifications for proxied messages is now {EnabledDisabled(newVal)}." ) ;
}
2019-06-21 13:49:58 +02:00
}