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

mixed changes for eel on cod

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
Macintxsh 2023-12-17 20:45:44 +03:00
parent 4581b402aa
commit 7565f83013
Signed by: mctaylors
GPG key ID: 7181BEBE676903C1
9 changed files with 74 additions and 20 deletions

View file

@ -348,7 +348,7 @@
<data name="DescriptionExternalEventCreated" xml:space="preserve">
<value>The event will start at {0} until {1} in {2}</value>
</data>
<data name="OpenEventInfoButton" xml:space="preserve">
<data name="ButtonOpenEventInfo" xml:space="preserve">
<value>Open Event Info</value>
</data>
<data name="EventDuration" xml:space="preserve">
@ -396,7 +396,7 @@
<data name="AboutTitleDevelopers" xml:space="preserve">
<value>Developers:</value>
</data>
<data name="AboutTitleRepository" xml:space="preserve">
<data name="ButtonOpenRepository" xml:space="preserve">
<value>Octobot's source code</value>
</data>
<data name="AboutBot" xml:space="preserve">
@ -582,4 +582,7 @@
<data name="ContactDevelopers" xml:space="preserve">
<value>Contact the developers if the problem occurs again.</value>
</data>
<data name="ButtonReportIssue" xml:space="preserve">
<value>Report an issue</value>
</data>
</root>

View file

@ -345,7 +345,7 @@
<data name="DescriptionExternalEventCreated" xml:space="preserve">
<value>Событие пройдёт с {0} до {1} в {2}</value>
</data>
<data name="OpenEventInfoButton" xml:space="preserve">
<data name="ButtonOpenEventInfo" xml:space="preserve">
<value>Открыть сведения о событии</value>
</data>
<data name="EventDuration" xml:space="preserve">
@ -396,7 +396,7 @@
<data name="AboutTitleDevelopers" xml:space="preserve">
<value>Разработчики:</value>
</data>
<data name="AboutTitleRepository" xml:space="preserve">
<data name="ButtonOpenRepository" xml:space="preserve">
<value>Исходный код Octobot</value>
</data>
<data name="AboutBot" xml:space="preserve">
@ -582,4 +582,7 @@
<data name="ContactDevelopers" xml:space="preserve">
<value>Обратись к разработчикам, если проблема возникнет снова.</value>
</data>
<data name="ButtonReportIssue" xml:space="preserve">
<value>Сообщить о проблеме</value>
</data>
</root>

View file

@ -348,7 +348,7 @@
<data name="DescriptionExternalEventCreated" xml:space="preserve">
<value>движуха будет происходить с {0} до {1} в {2}</value>
</data>
<data name="OpenEventInfoButton" xml:space="preserve">
<data name="ButtonOpenEventInfo" xml:space="preserve">
<value>открыть ивент</value>
</data>
<data name="EventDuration" xml:space="preserve">
@ -396,7 +396,7 @@
<data name="AboutTitleDevelopers" xml:space="preserve">
<value>девелоперы:</value>
</data>
<data name="AboutTitleRepository" xml:space="preserve">
<data name="ButtonOpenRepository" xml:space="preserve">
<value>репа Octobot (тык)</value>
</data>
<data name="AboutBot" xml:space="preserve">
@ -582,4 +582,7 @@
<data name="ContactDevelopers" xml:space="preserve">
<value>если ты это читаешь второй раз за сегодня, пиши разрабам</value>
</data>
<data name="ButtonReportIssue" xml:space="preserve">
<value>зарепортить баг</value>
</data>
</root>

View file

@ -33,8 +33,6 @@ public class AboutCommandGroup : CommandGroup
("neroduckale", new Snowflake(474943797063843851))
};
private const string RepositoryUrl = "https://github.com/LabsDevelopment/Octobot";
private readonly ICommandContext _context;
private readonly IFeedbackService _feedback;
private readonly GuildDataService _guildData;
@ -101,16 +99,24 @@ public class AboutCommandGroup : CommandGroup
.WithImageUrl("https://cdn.mctaylors.ru/octobot-banner.png")
.Build();
var button = new ButtonComponent(
var repositoryButton = new ButtonComponent(
ButtonComponentStyle.Link,
Messages.AboutTitleRepository,
URL: RepositoryUrl
Messages.ButtonOpenRepository,
new PartialEmoji(Name: "🌐"),
URL: Links.Repository
);
var issuesButton = new ButtonComponent(
ButtonComponentStyle.Link,
Messages.ButtonReportIssue,
new PartialEmoji(Name: "⚠️"),
URL: Links.Issues
);
return await _feedback.SendContextualEmbedResultAsync(embed,
new FeedbackMessageOptions(MessageComponents: new[]
{
new ActionRowComponent(new[] { button })
new ActionRowComponent(new[] { repositoryButton, issuesButton })
}), ct);
}
}

View file

@ -1,8 +1,11 @@
using JetBrains.Annotations;
using Microsoft.Extensions.Logging;
using Octobot.Extensions;
using Remora.Discord.API.Abstractions.Objects;
using Remora.Discord.API.Abstractions.Rest;
using Remora.Discord.API.Objects;
using Remora.Discord.Commands.Contexts;
using Remora.Discord.Commands.Feedback.Messages;
using Remora.Discord.Commands.Feedback.Services;
using Remora.Discord.Commands.Services;
using Remora.Discord.Extensions.Embeds;
@ -65,6 +68,17 @@ public class ErrorLoggingPostExecutionEvent : IPostExecutionEvent
.WithColour(ColorsList.Red)
.Build();
return await _feedback.SendContextualEmbedResultAsync(embed, ct: ct);
var issuesButton = new ButtonComponent(
ButtonComponentStyle.Link,
Messages.ButtonReportIssue,
new PartialEmoji(Name: "⚠️"),
URL: Links.Issues
);
return await _feedback.SendContextualEmbedResultAsync(embed,
new FeedbackMessageOptions(MessageComponents: new[]
{
new ActionRowComponent(new[] { issuesButton })
}), ct);
}
}

View file

@ -534,9 +534,9 @@ namespace Octobot {
}
}
internal static string OpenEventInfoButton {
internal static string ButtonOpenEventInfo {
get {
return ResourceManager.GetString("OpenEventInfoButton", resourceCulture);
return ResourceManager.GetString("ButtonOpenEventInfo", resourceCulture);
}
}
@ -630,9 +630,9 @@ namespace Octobot {
}
}
internal static string AboutTitleRepository {
internal static string ButtonOpenRepository {
get {
return ResourceManager.GetString("AboutTitleRepository", resourceCulture);
return ResourceManager.GetString("ButtonOpenRepository", resourceCulture);
}
}
@ -1028,5 +1028,13 @@ namespace Octobot {
return ResourceManager.GetString("ContactDevelopers", resourceCulture);
}
}
internal static string ButtonReportIssue
{
get
{
return ResourceManager.GetString("ButtonReportIssue", resourceCulture);
}
}
}
}

View file

@ -17,3 +17,12 @@ public static class ColorsList
public static readonly Color Black = Color.Black;
public static readonly Color White = Color.WhiteSmoke;
}
/// <summary>
/// Contains all links used in buttons.
/// </summary>
public static class Links
{
public const string Repository = "https://github.com/LabsDevelopment/Octobot";
public const string Issues = $"{Repository}/issues";
}

View file

@ -7,6 +7,7 @@ using Remora.Discord.API.Abstractions.Gateway.Events;
using Remora.Discord.API.Abstractions.Objects;
using Remora.Discord.API.Abstractions.Rest;
using Remora.Discord.API.Gateway.Events;
using Remora.Discord.API.Objects;
using Remora.Discord.Extensions.Embeds;
using Remora.Discord.Gateway.Responders;
using Remora.Results;
@ -112,7 +113,14 @@ public class GuildLoadedResponder : IResponder<IGuildCreate>
.WithColour(ColorsList.Red)
.Build();
return await _channelApi.CreateMessageWithEmbedResultAsync(
channel, embedResult: errorEmbed, ct: ct);
var issuesButton = new ButtonComponent(
ButtonComponentStyle.Link,
Messages.ButtonReportIssue,
new PartialEmoji(Name: "⚠️"),
URL: Links.Issues
);
return await _channelApi.CreateMessageWithEmbedResultAsync(channel, embedResult: errorEmbed,
components: new[] { new ActionRowComponent(new[] { issuesButton }) }, ct: ct);
}
}

View file

@ -222,7 +222,7 @@ public sealed class ScheduledEventUpdateService : BackgroundService
var button = new ButtonComponent(
ButtonComponentStyle.Link,
Messages.OpenEventInfoButton,
Messages.ButtonOpenEventInfo,
new PartialEmoji(Name: "📋"),
URL: $"https://discord.com/events/{scheduledEvent.GuildID}/{scheduledEvent.ID}"
);