1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-20 00:43:36 +03:00

Disable issue report button if dirty version detected

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
Macintxsh 2024-03-19 21:05:36 +03:00
parent 2342116e87
commit 40c0cf04b8
Signed by: mctaylors
GPG key ID: 7181BEBE676903C1
8 changed files with 61 additions and 1 deletions

View file

@ -663,4 +663,7 @@
<data name="SettingsWelcomeMessagesChannel" xml:space="preserve"> <data name="SettingsWelcomeMessagesChannel" xml:space="preserve">
<value>Welcome messages channel</value> <value>Welcome messages channel</value>
</data> </data>
<data name="ButtonDirty" xml:space="preserve">
<value>Can't report an issue in the dirty version</value>
</data>
</root> </root>

View file

@ -663,4 +663,7 @@
<data name="SettingsWelcomeMessagesChannel" xml:space="preserve"> <data name="SettingsWelcomeMessagesChannel" xml:space="preserve">
<value>Канал для приветствий</value> <value>Канал для приветствий</value>
</data> </data>
<data name="ButtonDirty" xml:space="preserve">
<value>Нельзя сообщить о проблеме в dirty версии</value>
</data>
</root> </root>

View file

@ -663,4 +663,7 @@
<data name="SettingsWelcomeMessagesChannel" xml:space="preserve"> <data name="SettingsWelcomeMessagesChannel" xml:space="preserve">
<value>канал куда говорить здравствуйте</value> <value>канал куда говорить здравствуйте</value>
</data> </data>
<data name="ButtonDirty" xml:space="preserve">
<value>вот иди сам и почини что сломал</value>
</data>
</root> </root>

View file

@ -34,7 +34,7 @@ public static class BuildInfo
} }
} }
private static bool IsDirty public static bool IsDirty
{ {
get get
{ {

View file

@ -111,6 +111,22 @@ public class AboutCommandGroup : CommandGroup
URL: BuildInfo.RepositoryUrl URL: BuildInfo.RepositoryUrl
); );
if (BuildInfo.IsDirty)
{
var dirtyButton = new ButtonComponent(
ButtonComponentStyle.Link,
Messages.ButtonDirty,
new PartialEmoji(Name: "⚠️"),
IsDisabled: true
);
return await _feedback.SendContextualEmbedResultAsync(embed,
new FeedbackMessageOptions(MessageComponents: new[]
{
new ActionRowComponent(new[] { repositoryButton, dirtyButton })
}), ct);
}
var issuesButton = new ButtonComponent( var issuesButton = new ButtonComponent(
ButtonComponentStyle.Link, ButtonComponentStyle.Link,
Messages.ButtonReportIssue, Messages.ButtonReportIssue,

View file

@ -68,6 +68,22 @@ public class ErrorLoggingPostExecutionEvent : IPostExecutionEvent
.WithColour(ColorsList.Red) .WithColour(ColorsList.Red)
.Build(); .Build();
if (BuildInfo.IsDirty)
{
var dirtyButton = new ButtonComponent(
ButtonComponentStyle.Link,
Messages.ButtonDirty,
new PartialEmoji(Name: "⚠️"),
IsDisabled: true
);
return await _feedback.SendContextualEmbedResultAsync(embed,
new FeedbackMessageOptions(MessageComponents: new[]
{
new ActionRowComponent(new[] { dirtyButton })
}), ct);
}
var issuesButton = new ButtonComponent( var issuesButton = new ButtonComponent(
ButtonComponentStyle.Link, ButtonComponentStyle.Link,
Messages.ButtonReportIssue, Messages.ButtonReportIssue,

View file

@ -1196,5 +1196,11 @@ namespace Octobot {
return ResourceManager.GetString("SettingsWelcomeMessagesChannel", resourceCulture); return ResourceManager.GetString("SettingsWelcomeMessagesChannel", resourceCulture);
} }
} }
internal static string ButtonDirty {
get {
return ResourceManager.GetString("ButtonDirty", resourceCulture);
}
}
} }
} }

View file

@ -113,6 +113,19 @@ public class GuildLoadedResponder : IResponder<IGuildCreate>
.WithColour(ColorsList.Red) .WithColour(ColorsList.Red)
.Build(); .Build();
if (BuildInfo.IsDirty)
{
var dirtyButton = new ButtonComponent(
ButtonComponentStyle.Link,
Messages.ButtonDirty,
new PartialEmoji(Name: "⚠️"),
IsDisabled: true
);
return await _channelApi.CreateMessageWithEmbedResultAsync(channel, embedResult: errorEmbed,
components: new[] { new ActionRowComponent(new[] { dirtyButton }) }, ct: ct);
}
var issuesButton = new ButtonComponent( var issuesButton = new ButtonComponent(
ButtonComponentStyle.Link, ButtonComponentStyle.Link,
Messages.ButtonReportIssue, Messages.ButtonReportIssue,