-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2ac3ff
commit cad3f5a
Showing
7 changed files
with
89 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using Discord.Interactions; | ||
using Discord.WebSocket; | ||
using Hyperstellar.Sql; | ||
|
||
namespace Hyperstellar.Dc; | ||
|
||
public class Commands : InteractionModuleBase | ||
Check warning on line 7 in Bot/Dc/Commands.cs GitHub Actions / inspect
Check warning on line 7 in Bot/Dc/Commands.cs GitHub Actions / build
|
||
{ | ||
[RequireOwner] | ||
[SlashCommand("shutdown", "Shuts down the bot")] | ||
public async Task ShutdownAsync(bool commit = true) | ||
{ | ||
await RespondAsync("Ok", ephemeral: true); | ||
if (commit) | ||
{ | ||
Db.Commit(); | ||
} | ||
Environment.Exit(0); | ||
} | ||
|
||
[RequireOwner] | ||
[SlashCommand("commit", "Commits db")] | ||
public async Task CommitAsync() | ||
{ | ||
Db.Commit(); | ||
await RespondAsync("Committed", ephemeral: true); | ||
} | ||
|
||
[RequireOwner] | ||
[SlashCommand("admin", "Makes the Discord user an admin")] | ||
public async Task AdminAsync(SocketGuildUser user) | ||
{ | ||
bool success = Db.AddAdmin(user.Id); | ||
if (success) | ||
{ | ||
await RespondAsync("Success!", ephemeral: true); | ||
} | ||
else | ||
{ | ||
await RespondAsync("Error", ephemeral: true); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using SQLite; | ||
|
||
namespace Hyperstellar.Sql; | ||
|
||
internal sealed class BotAdmin | ||
{ | ||
[PrimaryKey, NotNull] | ||
public ulong Id { get; set; } | ||
|
||
public BotAdmin() => Id = 0; | ||
|
||
public BotAdmin(ulong id) => Id = id; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters