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:
parent
2342116e87
commit
40c0cf04b8
8 changed files with 61 additions and 1 deletions
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -34,7 +34,7 @@ public static class BuildInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsDirty
|
public static bool IsDirty
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
6
src/Messages.Designer.cs
generated
6
src/Messages.Designer.cs
generated
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Add table
Reference in a new issue