mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-01-31 00:19:00 +03:00
Add WelcomeMessagesChannel setting (#269)
Closes #232 Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
parent
62709d927b
commit
5105b43eff
8 changed files with 25 additions and 2 deletions
|
@ -657,4 +657,7 @@
|
|||
<data name="TimeSpanExample" xml:space="preserve">
|
||||
<value>Example of a valid input: `1h30m`</value>
|
||||
</data>
|
||||
<data name="SettingsWelcomeMessagesChannel" xml:space="preserve">
|
||||
<value>Welcome messages channel</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
|
@ -657,4 +657,7 @@
|
|||
<data name="TimeSpanExample" xml:space="preserve">
|
||||
<value>Пример правильного ввода: `1ч30м`</value>
|
||||
</data>
|
||||
<data name="SettingsWelcomeMessagesChannel" xml:space="preserve">
|
||||
<value>Канал для приветствий</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
|
@ -657,4 +657,7 @@
|
|||
<data name="TimeSpanExample" xml:space="preserve">
|
||||
<value>правильно пишут так: `1h30m`</value>
|
||||
</data>
|
||||
<data name="SettingsWelcomeMessagesChannel" xml:space="preserve">
|
||||
<value>канал куда говорить здравствуйте</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
|
@ -46,6 +46,7 @@ public class SettingsCommandGroup : CommandGroup
|
|||
GuildSettings.RenameHoistedUsers,
|
||||
GuildSettings.PublicFeedbackChannel,
|
||||
GuildSettings.PrivateFeedbackChannel,
|
||||
GuildSettings.WelcomeMessagesChannel,
|
||||
GuildSettings.EventNotificationChannel,
|
||||
GuildSettings.DefaultRole,
|
||||
GuildSettings.MuteRole,
|
||||
|
|
|
@ -56,6 +56,11 @@ public static class GuildSettings
|
|||
/// </summary>
|
||||
public static readonly SnowflakeOption PrivateFeedbackChannel = new("PrivateFeedbackChannel");
|
||||
|
||||
/// <summary>
|
||||
/// Controls what channel should welcome messages be sent to.
|
||||
/// </summary>
|
||||
public static readonly SnowflakeOption WelcomeMessagesChannel = new("WelcomeMessagesChannel");
|
||||
|
||||
public static readonly SnowflakeOption EventNotificationChannel = new("EventNotificationChannel");
|
||||
public static readonly SnowflakeOption DefaultRole = new("DefaultRole");
|
||||
public static readonly SnowflakeOption MuteRole = new("MuteRole");
|
||||
|
|
|
@ -21,6 +21,7 @@ public enum AllOptionsEnum
|
|||
[UsedImplicitly] RenameHoistedUsers,
|
||||
[UsedImplicitly] PublicFeedbackChannel,
|
||||
[UsedImplicitly] PrivateFeedbackChannel,
|
||||
[UsedImplicitly] WelcomeMessagesChannel,
|
||||
[UsedImplicitly] EventNotificationChannel,
|
||||
[UsedImplicitly] DefaultRole,
|
||||
[UsedImplicitly] MuteRole,
|
||||
|
|
7
src/Messages.Designer.cs
generated
7
src/Messages.Designer.cs
generated
|
@ -1184,5 +1184,12 @@ namespace Octobot {
|
|||
return ResourceManager.GetString("TimeSpanExample", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
internal static string SettingsWelcomeMessagesChannel
|
||||
{
|
||||
get {
|
||||
return ResourceManager.GetString("SettingsWelcomeMessagesChannel", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class GuildMemberJoinedResponder : IResponder<IGuildMemberAdd>
|
|||
return Result.FromError(returnRolesResult.Error);
|
||||
}
|
||||
|
||||
if (GuildSettings.PublicFeedbackChannel.Get(cfg).Empty()
|
||||
if (GuildSettings.WelcomeMessagesChannel.Get(cfg).Empty()
|
||||
|| GuildSettings.WelcomeMessage.Get(cfg) is "off" or "disable" or "disabled")
|
||||
{
|
||||
return Result.FromSuccess();
|
||||
|
@ -76,7 +76,7 @@ public class GuildMemberJoinedResponder : IResponder<IGuildMemberAdd>
|
|||
.Build();
|
||||
|
||||
return await _channelApi.CreateMessageWithEmbedResultAsync(
|
||||
GuildSettings.PublicFeedbackChannel.Get(cfg), embedResult: embed,
|
||||
GuildSettings.WelcomeMessagesChannel.Get(cfg), embedResult: embed,
|
||||
allowedMentions: Octobot.NoMentions, ct: ct);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue