-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
7 changed files
with
139 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,29 @@ | ||
using Discord; | ||
using System.ComponentModel.DataAnnotations; | ||
using Discord; | ||
using Discord.Interactions; | ||
using Discord.WebSocket; | ||
using Microsoft.EntityFrameworkCore; | ||
using OpenShock.DiscordBot.OpenShockDiscordDb; | ||
|
||
namespace OpenShock.DiscordBot.Commands; | ||
|
||
[CommandContextType(InteractionContextType.Guild, InteractionContextType.BotDm, InteractionContextType.PrivateChannel)] | ||
[IntegrationType(ApplicationIntegrationType.UserInstall, ApplicationIntegrationType.GuildInstall)] | ||
public sealed class ControlCommands : InteractionModuleBase | ||
{ | ||
private readonly OpenShockDiscordContext _db; | ||
|
||
public ControlCommands(OpenShockDiscordContext db) | ||
{ | ||
_db = db; | ||
} | ||
|
||
[SlashCommand("shock", "Shock a friend that has whitelisted you before")] | ||
public async Task ShockCommand(SocketUser user) | ||
public async Task ShockCommand(SocketUser user, [Range(1, 100)] byte intensity = 50, [Range(0.3, 30)] float duration = 5) | ||
{ | ||
await RespondAsync("Shocking " + user.Mention + "!"); | ||
await RespondAsync("hiii lol"); | ||
var friend = await _db.UsersFriendwhitelists.FirstOrDefaultAsync(x => x.WhitelistedFriend == Context.User.Id && x.User == user.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using Discord; | ||
using Discord.Interactions; | ||
using Microsoft.Extensions.Logging; | ||
using OpenShock.DiscordBot.OpenShockDiscordDb; | ||
using OpenShock.SDK.CSharp; | ||
|
||
namespace OpenShock.DiscordBot.Commands; | ||
|
||
[CommandContextType(InteractionContextType.Guild, | ||
InteractionContextType.BotDm, InteractionContextType.PrivateChannel)] | ||
public sealed class SetupCommands : InteractionModuleBase | ||
{ | ||
private readonly OpenShockDiscordContext _db; | ||
private readonly ILogger<SetupCommand> _logger; | ||
|
||
/// <summary> | ||
/// Default constructor for the SetupCommand | ||
/// </summary> | ||
/// <param name="db"></param> | ||
/// <param name="logger"></param> | ||
public SetupCommands(OpenShockDiscordContext db, ILogger<SetupCommand> logger) | ||
{ | ||
_db = db; | ||
_logger = logger; | ||
} | ||
|
||
[SlashCommand("shocker", "Configure or refresh your shocker settings")] | ||
public async Task ShockerConfig() | ||
Check warning on line 28 in DiscordBot/Commands/SetupCommands.cs GitHub Actions / build
Check warning on line 28 in DiscordBot/Commands/SetupCommands.cs GitHub Actions / build
|
||
{ | ||
// var openShockClient = new OpenShockApiClient(new ApiClientOptions() | ||
// { | ||
// Server = | ||
// }) | ||
// | ||
// _db.UsersShockers.Add(new UsersShocker() | ||
// { | ||
// User = | ||
// }); | ||
} | ||
} |
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,37 @@ | ||
using Discord; | ||
using Discord.Interactions; | ||
using Discord.WebSocket; | ||
using Microsoft.EntityFrameworkCore; | ||
using OpenShock.DiscordBot.OpenShockDiscordDb; | ||
|
||
namespace OpenShock.DiscordBot.Commands; | ||
|
||
[CommandContextType(InteractionContextType.Guild, InteractionContextType.BotDm, InteractionContextType.PrivateChannel)] | ||
[Group("whitelist", "Whitelist commands for friends to use your shockers")] | ||
public sealed class WhitelistCommands : InteractionModuleBase | ||
{ | ||
private readonly OpenShockDiscordContext _db; | ||
|
||
public WhitelistCommands(OpenShockDiscordContext db) | ||
{ | ||
_db = db; | ||
} | ||
|
||
[SlashCommand("add", "Whitelist a friend to use your shockers")] | ||
public async Task AddWhitelist(SocketUser friend) | ||
{ | ||
var alreadyWhitelisted = await _db.UsersFriendwhitelists.FirstOrDefaultAsync(x => | ||
x.User == Context.User.Id && x.WhitelistedFriend == friend.Id); | ||
|
||
if (alreadyWhitelisted != null) | ||
{ | ||
_db.UsersFriendwhitelists.Add(new UsersFriendwhitelist() | ||
{ | ||
User = Context.User.Id, | ||
WhitelistedFriend = friend.Id | ||
}); | ||
} | ||
|
||
await _db.SaveChangesAsync(); | ||
} | ||
} |
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 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 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 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,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace OpenShock.DiscordBot.OpenShockDiscordDb; | ||
|
||
public partial class UsersShocker | ||
{ | ||
public decimal User { get; set; } | ||
|
||
public Guid ShockerId { get; set; } | ||
|
||
public DateTime CreatedAt { get; set; } | ||
|
||
public virtual User UserNavigation { get; set; } = null!; | ||
} |