v3.1.0 #317

Merged
Vylpes merged 76 commits from develop into main 2023-07-08 13:30:22 +01:00
3 changed files with 13 additions and 8 deletions
Showing only changes of commit c12644d537 - Show all commits

View file

@ -14,12 +14,17 @@ export default class Ignore extends Command {
public override async execute(interaction: CommandInteraction) {
if (!interaction.guildId) return;
const isChannelIgnored = await IgnoredChannel.IsChannelIgnored(interaction.guildId);
if (isChannelIgnored) {
const entity = await IgnoredChannel.FetchOneById(IgnoredChannel, interaction.guildId);
if (!entity) {
await interaction.reply('Unable to find channel.');
return;
}
await IgnoredChannel.Remove(IgnoredChannel, entity);
await interaction.reply('This channel will start being logged again.');

View file

@ -34,22 +34,22 @@ export default class Audit extends BaseEntity {
@Column()
ServerId: string;
public static async FetchAuditsByUserId(userId: string, serverId: string): Promise<Audit[] | undefined> {
public static async FetchAuditsByUserId(userId: string, serverId: string): Promise<Audit[] | null> {
const connection = getConnection();
const repository = connection.getRepository(Audit);
const all = await repository.find({ UserId: userId, ServerId: serverId });
const all = await repository.find({ where: { UserId: userId, ServerId: serverId } });
return all;
}
public static async FetchAuditByAuditId(auditId: string, serverId: string): Promise<Audit | undefined> {
public static async FetchAuditByAuditId(auditId: string, serverId: string): Promise<Audit | null> {
const connection = getConnection();
const repository = connection.getRepository(Audit);
const single = await repository.findOne({ AuditId: auditId, ServerId: serverId });
const single = await repository.findOne({ where: { AuditId: auditId, ServerId: serverId } });
return single;
}

View file

@ -14,7 +14,7 @@ export default class IgnoredChannel extends BaseEntity {
const repository = connection.getRepository(IgnoredChannel);
const single = await repository.findOne(channelId);
const single = await repository.findOne({ where: { Id: channelId } });
return single != undefined;
}