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.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
@ -12,7 +12,7 @@ updates:
|
|||
open-pull-requests-limit: 5
|
||||
reviewers:
|
||||
- EmotionChild
|
||||
target-branch: "main"
|
||||
target-branch: "development"
|
||||
labels:
|
||||
- "nuget"
|
||||
- "dependencies"
|
2
.github/workflows/dotnet.yml
vendored
2
.github/workflows/dotnet.yml
vendored
|
@ -1,4 +1,4 @@
|
|||
name: .NET
|
||||
name: .NET
|
||||
|
||||
on:
|
||||
push:
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace SupportChild.Commands
|
|||
return;
|
||||
}
|
||||
|
||||
if (Database.AddMessage(identifier, command.Member.Id, message))
|
||||
if(Database.AddMessage(identifier, command.Member.Id, message))
|
||||
{
|
||||
DiscordEmbed error = new DiscordEmbedBuilder
|
||||
{
|
||||
|
@ -71,7 +71,6 @@ namespace SupportChild.Commands
|
|||
await command.RespondAsync(error);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -115,7 +115,7 @@ namespace SupportChild.Commands
|
|||
};
|
||||
await staffMember.SendMessageAsync(message);
|
||||
}
|
||||
catch (UnauthorizedException) { }
|
||||
catch (UnauthorizedException) {}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace SupportChild.Commands
|
|||
DiscordEmbed error = new DiscordEmbedBuilder
|
||||
{
|
||||
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);
|
||||
return;
|
||||
|
|
|
@ -121,8 +121,8 @@ namespace SupportChild.Commands
|
|||
DiscordMember staffMember = await command.Guild.GetMemberAsync(staffID);
|
||||
await staffMember.SendMessageAsync(message);
|
||||
}
|
||||
catch (NotFoundException) { }
|
||||
catch (UnauthorizedException) { }
|
||||
catch (NotFoundException) {}
|
||||
catch (UnauthorizedException) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ namespace SupportChild.Commands
|
|||
{
|
||||
Color = DiscordColor.Green,
|
||||
Description = "Ticket " + ticketChannel.Mention + " opened by " + command.Member.Mention + ".\n",
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter { Text = "Ticket " + ticketID }
|
||||
Footer = new DiscordEmbedBuilder.EmbedFooter {Text = "Ticket " + ticketID}
|
||||
};
|
||||
await logChannel.SendMessageAsync(logMessage);
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace SupportChild.Commands
|
|||
};
|
||||
await staffMember.SendMessageAsync(message);
|
||||
}
|
||||
catch (UnauthorizedException) { }
|
||||
catch (UnauthorizedException) {}
|
||||
}
|
||||
|
||||
// Log it if the log channel exists
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace SupportChild.Commands
|
|||
return;
|
||||
}
|
||||
|
||||
if (Database.RemoveMessage(identifier))
|
||||
if(Database.RemoveMessage(identifier))
|
||||
{
|
||||
DiscordEmbed error = new DiscordEmbedBuilder
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ using MySql.Data.MySqlClient;
|
|||
|
||||
namespace SupportChild.Commands
|
||||
{
|
||||
public class SetTicketCommand : BaseCommandModule
|
||||
public class SetTicketCommand :BaseCommandModule
|
||||
{
|
||||
[Command("setticket")]
|
||||
[Description("Turns a channel into a ticket, warning: this will let anyone with write access delete the channel using the close command.")]
|
||||
|
|
|
@ -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.
|
||||
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
|
||||
{
|
||||
|
|
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