working?
This commit is contained in:
parent
c9180130f9
commit
b565047517
28 changed files with 1634 additions and 1635 deletions
4
.github/dependabot.yml
vendored
4
.github/dependabot.yml
vendored
|
@ -1,4 +1,4 @@
|
||||||
# To get started with Dependabot version updates, you'll need to specify which
|
# To get started with Dependabot version updates, you'll need to specify which
|
||||||
# package ecosystems to update and where the package manifests are located.
|
# package ecosystems to update and where the package manifests are located.
|
||||||
# Please see the documentation for all configuration options:
|
# Please see the documentation for all configuration options:
|
||||||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||||
|
@ -12,7 +12,7 @@ updates:
|
||||||
open-pull-requests-limit: 5
|
open-pull-requests-limit: 5
|
||||||
reviewers:
|
reviewers:
|
||||||
- EmotionChild
|
- EmotionChild
|
||||||
target-branch: "main"
|
target-branch: "development"
|
||||||
labels:
|
labels:
|
||||||
- "nuget"
|
- "nuget"
|
||||||
- "dependencies"
|
- "dependencies"
|
2
.github/workflows/dotnet.yml
vendored
2
.github/workflows/dotnet.yml
vendored
|
@ -1,4 +1,4 @@
|
||||||
name: .NET
|
name: .NET
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
|
@ -71,7 +71,6 @@ namespace SupportChild.Commands
|
||||||
await command.RespondAsync(error);
|
await command.RespondAsync(error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -35,7 +35,7 @@ namespace SupportChild.Commands
|
||||||
DiscordEmbed error = new DiscordEmbedBuilder
|
DiscordEmbed error = new DiscordEmbedBuilder
|
||||||
{
|
{
|
||||||
Color = DiscordColor.Red,
|
Color = DiscordColor.Red,
|
||||||
Description = "Invalid list amount. (Must be an integer between 5 and 100)"
|
Description = "Invalid list amount. (Must be integer between 5 and 100)"
|
||||||
};
|
};
|
||||||
await command.RespondAsync(error);
|
await command.RespondAsync(error);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -98,7 +98,7 @@ namespace SupportChild.Commands
|
||||||
|
|
||||||
}
|
}
|
||||||
// If there is no open or closed ticket, send an error. If there is a closed ticket we will simply use the old transcript from when the ticket was closed.
|
// If there is no open or closed ticket, send an error. If there is a closed ticket we will simply use the old transcript from when the ticket was closed.
|
||||||
else if (!Database.TryGetClosedTicket(ticketID, out ticket) || ticket?.creatorID != command.Member.Id && !Database.IsStaff(command.Member.Id))
|
else if (!Database.TryGetClosedTicket(ticketID, out ticket) || (ticket?.creatorID != command.Member.Id && !Database.IsStaff(command.Member.Id)))
|
||||||
{
|
{
|
||||||
DiscordEmbed error = new DiscordEmbedBuilder
|
DiscordEmbed error = new DiscordEmbedBuilder
|
||||||
{
|
{
|
||||||
|
|
71
SupportChild/Commands/UnassignComand.cs
Normal file
71
SupportChild/Commands/UnassignComand.cs
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using DSharpPlus.CommandsNext;
|
||||||
|
using DSharpPlus.CommandsNext.Attributes;
|
||||||
|
using DSharpPlus.Entities;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace SupportChild.Commands
|
||||||
|
{
|
||||||
|
public class UnassignCommand : BaseCommandModule
|
||||||
|
{
|
||||||
|
[Command("unassign")]
|
||||||
|
[Description("Unassigns a staff member from a ticket.")]
|
||||||
|
public async Task OnExecute(CommandContext command, [RemainingText] string commandArgs)
|
||||||
|
{
|
||||||
|
// Check if the user has permission to use this command.
|
||||||
|
if (!Config.HasPermission(command.Member, "unassign"))
|
||||||
|
{
|
||||||
|
DiscordEmbed error = new DiscordEmbedBuilder
|
||||||
|
{
|
||||||
|
Color = DiscordColor.Red,
|
||||||
|
Description = "You do not have permission to use this command."
|
||||||
|
};
|
||||||
|
await command.RespondAsync(error);
|
||||||
|
command.Client.Logger.Log(LogLevel.Information, "User tried to use the unassign command but did not have permission.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if ticket exists in the database
|
||||||
|
if (!Database.TryGetOpenTicket(command.Channel.Id, out Database.Ticket ticket))
|
||||||
|
{
|
||||||
|
DiscordEmbed error = new DiscordEmbedBuilder
|
||||||
|
{
|
||||||
|
Color = DiscordColor.Red,
|
||||||
|
Description = "This channel is not a ticket."
|
||||||
|
};
|
||||||
|
await command.RespondAsync(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Database.UnassignStaff(ticket))
|
||||||
|
{
|
||||||
|
DiscordEmbed error = new DiscordEmbedBuilder
|
||||||
|
{
|
||||||
|
Color = DiscordColor.Red,
|
||||||
|
Description = "Error: Failed to unassign staff from ticket."
|
||||||
|
};
|
||||||
|
await command.RespondAsync(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DiscordEmbed message = new DiscordEmbedBuilder
|
||||||
|
{
|
||||||
|
Color = DiscordColor.Green,
|
||||||
|
Description = "Unassigned staff from ticket."
|
||||||
|
};
|
||||||
|
await command.RespondAsync(message);
|
||||||
|
|
||||||
|
// Log it if the log channel exists
|
||||||
|
DiscordChannel logChannel = command.Guild.GetChannel(Config.logChannel);
|
||||||
|
if (logChannel != null)
|
||||||
|
{
|
||||||
|
DiscordEmbed logMessage = new DiscordEmbedBuilder
|
||||||
|
{
|
||||||
|
Color = DiscordColor.Green,
|
||||||
|
Description = "Staff was unassigned from " + command.Channel.Mention + " by " + command.Member.Mention + "."
|
||||||
|
};
|
||||||
|
await logChannel.SendMessageAsync(logMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,71 +0,0 @@
|
||||||
using System.Threading.Tasks;
|
|
||||||
using DSharpPlus.CommandsNext;
|
|
||||||
using DSharpPlus.CommandsNext.Attributes;
|
|
||||||
using DSharpPlus.Entities;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace SupportChild.Commands
|
|
||||||
{
|
|
||||||
public class UnassignCommand : BaseCommandModule
|
|
||||||
{
|
|
||||||
[Command("unassign")]
|
|
||||||
[Description("Unassigns a staff member from a ticket.")]
|
|
||||||
public async Task OnExecute(CommandContext command, [RemainingText] string commandArgs)
|
|
||||||
{
|
|
||||||
// Check if the user has permission to use this command.
|
|
||||||
if (!Config.HasPermission(command.Member, "unassign"))
|
|
||||||
{
|
|
||||||
DiscordEmbed error = new DiscordEmbedBuilder
|
|
||||||
{
|
|
||||||
Color = DiscordColor.Red,
|
|
||||||
Description = "You do not have permission to use this command."
|
|
||||||
};
|
|
||||||
await command.RespondAsync(error);
|
|
||||||
command.Client.Logger.Log(LogLevel.Information, "User tried to use the unassign command but did not have permission.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if ticket exists in the database
|
|
||||||
if (!Database.TryGetOpenTicket(command.Channel.Id, out Database.Ticket ticket))
|
|
||||||
{
|
|
||||||
DiscordEmbed error = new DiscordEmbedBuilder
|
|
||||||
{
|
|
||||||
Color = DiscordColor.Red,
|
|
||||||
Description = "This channel is not a ticket."
|
|
||||||
};
|
|
||||||
await command.RespondAsync(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Database.UnassignStaff(ticket))
|
|
||||||
{
|
|
||||||
DiscordEmbed error = new DiscordEmbedBuilder
|
|
||||||
{
|
|
||||||
Color = DiscordColor.Red,
|
|
||||||
Description = "Error: Failed to unassign staff from ticket."
|
|
||||||
};
|
|
||||||
await command.RespondAsync(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DiscordEmbed message = new DiscordEmbedBuilder
|
|
||||||
{
|
|
||||||
Color = DiscordColor.Green,
|
|
||||||
Description = "Unassigned staff from ticket."
|
|
||||||
};
|
|
||||||
await command.RespondAsync(message);
|
|
||||||
|
|
||||||
// Log it if the log channel exists
|
|
||||||
DiscordChannel logChannel = command.Guild.GetChannel(Config.logChannel);
|
|
||||||
if (logChannel != null)
|
|
||||||
{
|
|
||||||
DiscordEmbed logMessage = new DiscordEmbedBuilder
|
|
||||||
{
|
|
||||||
Color = DiscordColor.Green,
|
|
||||||
Description = "Staff was unassigned from " + command.Channel.Mention + " by " + command.Member.Mention + "."
|
|
||||||
};
|
|
||||||
await logChannel.SendMessageAsync(logMessage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue