mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-20 00:43:36 +03:00
start working on /ban command
This commit is contained in:
parent
91516a899c
commit
a83aa03cf0
3 changed files with 55 additions and 7 deletions
12
Boyfriend.cs
12
Boyfriend.cs
|
@ -10,6 +10,7 @@ using Remora.Discord.API.Objects;
|
||||||
using Remora.Discord.Caching.Extensions;
|
using Remora.Discord.Caching.Extensions;
|
||||||
using Remora.Discord.Caching.Services;
|
using Remora.Discord.Caching.Services;
|
||||||
using Remora.Discord.Commands.Extensions;
|
using Remora.Discord.Commands.Extensions;
|
||||||
|
using Remora.Discord.Commands.Services;
|
||||||
using Remora.Discord.Gateway;
|
using Remora.Discord.Gateway;
|
||||||
using Remora.Discord.Gateway.Extensions;
|
using Remora.Discord.Gateway.Extensions;
|
||||||
using Remora.Discord.Hosting.Extensions;
|
using Remora.Discord.Hosting.Extensions;
|
||||||
|
@ -24,6 +25,17 @@ public class Boyfriend {
|
||||||
|
|
||||||
public static async Task Main(string[] args) {
|
public static async Task Main(string[] args) {
|
||||||
var host = CreateHostBuilder(args).UseConsoleLifetime().Build();
|
var host = CreateHostBuilder(args).UseConsoleLifetime().Build();
|
||||||
|
var services = host.Services;
|
||||||
|
var configuration = services.GetRequiredService<IConfiguration>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var slashService = services.GetRequiredService<SlashService>();
|
||||||
|
var updateSlash = await slashService.UpdateSlashCommandsAsync(new Snowflake(1115043975573811250));
|
||||||
|
if (!updateSlash.IsSuccess) {
|
||||||
|
Console.WriteLine("Failed to update slash commands: {Reason}", updateSlash.Error.Message);
|
||||||
|
}
|
||||||
await host.RunAsync();
|
await host.RunAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
36
Commands/BanCommand.cs
Normal file
36
Commands/BanCommand.cs
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
using System.ComponentModel;
|
||||||
|
using Remora.Commands.Attributes;
|
||||||
|
using Remora.Commands.Groups;
|
||||||
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
|
using Remora.Discord.API.Gateway.Events;
|
||||||
|
using Remora.Discord.API.Objects;
|
||||||
|
using Remora.Discord.Commands.Attributes;
|
||||||
|
using Remora.Discord.Commands.Feedback.Services;
|
||||||
|
using Remora.Rest.Core;
|
||||||
|
using Remora.Results;
|
||||||
|
|
||||||
|
namespace Boyfriend.Commands;
|
||||||
|
|
||||||
|
public class BanCommand : CommandGroup{
|
||||||
|
private readonly FeedbackService _feedbackService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="HttpCatCommands"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="feedbackService">The feedback service.</param>
|
||||||
|
public BanCommand(FeedbackService feedbackService)
|
||||||
|
{
|
||||||
|
_feedbackService = feedbackService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Command("ban")]
|
||||||
|
[Description("банит пидора")]
|
||||||
|
public async Task<IResult> BanAsync([Description("Юзер, кого банить")] IUser user, string reason) {
|
||||||
|
var banan = new Ban(reason, user);
|
||||||
|
var embed = new Embed(Colour: _feedbackService.Theme.Secondary, Description: "забанен нахуй");
|
||||||
|
|
||||||
|
return (Result)await _feedbackService.SendContextualEmbedAsync(embed, ct: this.CancellationToken);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue