Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discord AHelp Reply System #2315

Merged
merged 24 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bb25e58
Discord Ahelp Reply System (#2283)
Myzumi Nov 26, 2024
9304846
Merge branch 'master' of https://github.com/DeltaV-Station/Delta-v in…
sleepyyapril Nov 29, 2024
b05093e
Merge branch 'master' into discord-reply-system
sleepyyapril Nov 29, 2024
206d3d4
Merge branch 'master' into discord-reply-system
sleepyyapril Nov 29, 2024
d0a8351
Merge branch 'master' into discord-reply-system
sleepyyapril Nov 29, 2024
ef40033
Merge branch 'master' of https://github.com/DeltaV-Station/Delta-v in…
sleepyyapril Nov 29, 2024
7c1de38
Merge branch 'discord-reply-system' of https://github.com/sleepyyapri…
sleepyyapril Nov 29, 2024
da9c8e3
All the configuration
sleepyyapril Nov 30, 2024
096de51
CVar to use admin OOC color
sleepyyapril Nov 30, 2024
4378ef7
Fix description.
sleepyyapril Nov 30, 2024
cce4bf5
Merge branch 'master' into discord-reply-system
sleepyyapril Nov 30, 2024
8bd1eae
Merge branch 'master' into discord-reply-system
sleepyyapril Dec 1, 2024
54e6486
Merge branch 'master' into discord-reply-system
sleepyyapril Dec 2, 2024
b6a250a
Merge branch 'master' of https://github.com/DeltaV-Station/Delta-v in…
sleepyyapril Dec 5, 2024
b83546c
Review changes
sleepyyapril Dec 5, 2024
b7b440e
Review changes
sleepyyapril Dec 5, 2024
d729f17
Merge branch 'discord-reply-system' of https://github.com/sleepyyapri…
sleepyyapril Dec 5, 2024
5f0e63f
Merge branch 'master' into discord-reply-system
sleepyyapril Dec 6, 2024
1e5b92a
Merge branch 'master' into discord-reply-system
sleepyyapril Dec 7, 2024
999704d
Merge branch 'master' into discord-reply-system
sleepyyapril Dec 7, 2024
bd07ef9
Merge branch 'master' into discord-reply-system
sleepyyapril Dec 13, 2024
41f22d5
Merge branch 'master' of https://github.com/DeltaV-Station/Delta-v in…
sleepyyapril Jan 3, 2025
5375959
Review changes
sleepyyapril Jan 4, 2025
e55c394
Merge branch 'discord-reply-system' of https://github.com/sleepyyapri…
sleepyyapril Jan 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion Content.Server/Administration/ServerApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Threading.Tasks;
using Content.Server._NF.Administration;
sleepyyapril marked this conversation as resolved.
Show resolved Hide resolved
using Content.Server.Administration.Systems;
using Content.Server.Administration.Managers; // Frontier
using Content.Server.GameTicking;
using Content.Server.GameTicking.Presets;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Maps;
using Content.Server.RoundEnd;
using Content.Shared.Administration.Managers;
using Content.Shared.Administration; // Frontier
using Content.Shared.CCVar;
using Content.Shared.GameTicking.Components;
using Content.Shared.Prototypes;
Expand Down Expand Up @@ -48,7 +51,7 @@ public sealed partial class ServerApi : IPostInjectInit
[Dependency] private readonly IStatusHost _statusHost = default!;
[Dependency] private readonly IConfigurationManager _config = default!;
[Dependency] private readonly ISharedPlayerManager _playerManager = default!;
[Dependency] private readonly ISharedAdminManager _adminManager = default!;
[Dependency] private readonly IAdminManager _adminManager = default!; // Frontier: ISharedAdminManager<IAdminManager>
[Dependency] private readonly IGameMapManager _gameMapManager = default!;
[Dependency] private readonly IServerNetManager _netManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
Expand Down Expand Up @@ -81,6 +84,8 @@ void IPostInjectInit.PostInject()
RegisterActorHandler(HttpMethod.Post, "/admin/actions/force_preset", ActionForcePreset);
RegisterActorHandler(HttpMethod.Post, "/admin/actions/set_motd", ActionForceMotd);
RegisterActorHandler(HttpMethod.Patch, "/admin/actions/panic_bunker", ActionPanicPunker);

RegisterHandler(HttpMethod.Post, "/admin/actions/send_bwoink", ActionSendBwoink); // Frontier - Discord Ahelp Reply
}

public void Initialize()
Expand Down Expand Up @@ -394,6 +399,38 @@ await RunOnMainThread(async () =>
await RespondOk(context);
});
}
#endregion

#region Frontier
// Creating a region here incase more actions are added in the future

private async Task ActionSendBwoink(IStatusHandlerContext context)
{
var body = await ReadJson<BwoinkActionBody>(context);
if (body == null)
return;

await RunOnMainThread(async () =>
{
// Player not online or wrong Guid
if (!_playerManager.TryGetSessionById(new NetUserId(body.Guid), out var player))
{
await RespondError(
context,
ErrorCode.PlayerNotFound,
HttpStatusCode.UnprocessableContent,
"Player not found");
return;
}

var serverBwoinkSystem = _entitySystemManager.GetEntitySystem<BwoinkSystem>();
var message = new SharedBwoinkSystem.BwoinkTextMessage(player.UserId, SharedBwoinkSystem.SystemUserId, body.Text);
serverBwoinkSystem.OnWebhookBwoinkTextMessage(message, body);

sleepyyapril marked this conversation as resolved.
Show resolved Hide resolved
// Respond with OK
await RespondOk(context);
});
}

#endregion

Expand Down
Loading
Loading