This commit is contained in:
parent
efd213d085
commit
c12644d537
3 changed files with 13 additions and 8 deletions
|
@ -14,12 +14,17 @@ export default class Ignore extends Command {
|
||||||
|
|
||||||
public override async execute(interaction: CommandInteraction) {
|
public override async execute(interaction: CommandInteraction) {
|
||||||
if (!interaction.guildId) return;
|
if (!interaction.guildId) return;
|
||||||
|
|
||||||
const isChannelIgnored = await IgnoredChannel.IsChannelIgnored(interaction.guildId);
|
const isChannelIgnored = await IgnoredChannel.IsChannelIgnored(interaction.guildId);
|
||||||
|
|
||||||
if (isChannelIgnored) {
|
if (isChannelIgnored) {
|
||||||
const entity = await IgnoredChannel.FetchOneById(IgnoredChannel, interaction.guildId);
|
const entity = await IgnoredChannel.FetchOneById(IgnoredChannel, interaction.guildId);
|
||||||
|
|
||||||
|
if (!entity) {
|
||||||
|
await interaction.reply('Unable to find channel.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await IgnoredChannel.Remove(IgnoredChannel, entity);
|
await IgnoredChannel.Remove(IgnoredChannel, entity);
|
||||||
|
|
||||||
await interaction.reply('This channel will start being logged again.');
|
await interaction.reply('This channel will start being logged again.');
|
||||||
|
|
|
@ -34,22 +34,22 @@ export default class Audit extends BaseEntity {
|
||||||
@Column()
|
@Column()
|
||||||
ServerId: string;
|
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 connection = getConnection();
|
||||||
|
|
||||||
const repository = connection.getRepository(Audit);
|
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;
|
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 connection = getConnection();
|
||||||
|
|
||||||
const repository = connection.getRepository(Audit);
|
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;
|
return single;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ export default class IgnoredChannel extends BaseEntity {
|
||||||
|
|
||||||
const repository = connection.getRepository(IgnoredChannel);
|
const repository = connection.getRepository(IgnoredChannel);
|
||||||
|
|
||||||
const single = await repository.findOne(channelId);
|
const single = await repository.findOne({ where: { Id: channelId } });
|
||||||
|
|
||||||
return single != undefined;
|
return single != undefined;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue