v3.1.0 #317
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) {
|
||||
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.');
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue