File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,12 +14,17 @@ export default class Ignore extends Command {
1414
1515 public override async execute ( interaction : CommandInteraction ) {
1616 if ( ! interaction . guildId ) return ;
17-
17+
1818 const isChannelIgnored = await IgnoredChannel . IsChannelIgnored ( interaction . guildId ) ;
19-
19+
2020 if ( isChannelIgnored ) {
2121 const entity = await IgnoredChannel . FetchOneById ( IgnoredChannel , interaction . guildId ) ;
22-
22+
23+ if ( ! entity ) {
24+ await interaction . reply ( 'Unable to find channel.' ) ;
25+ return ;
26+ }
27+
2328 await IgnoredChannel . Remove ( IgnoredChannel , entity ) ;
2429
2530 await interaction . reply ( 'This channel will start being logged again.' ) ;
Original file line number Diff line number Diff line change @@ -34,22 +34,22 @@ export default class Audit extends BaseEntity {
3434 @Column ( )
3535 ServerId : string ;
3636
37- public static async FetchAuditsByUserId ( userId : string , serverId : string ) : Promise < Audit [ ] | undefined > {
37+ public static async FetchAuditsByUserId ( userId : string , serverId : string ) : Promise < Audit [ ] | null > {
3838 const connection = getConnection ( ) ;
3939
4040 const repository = connection . getRepository ( Audit ) ;
4141
42- const all = await repository . find ( { UserId : userId , ServerId : serverId } ) ;
42+ const all = await repository . find ( { where : { UserId : userId , ServerId : serverId } } ) ;
4343
4444 return all ;
4545 }
4646
47- public static async FetchAuditByAuditId ( auditId : string , serverId : string ) : Promise < Audit | undefined > {
47+ public static async FetchAuditByAuditId ( auditId : string , serverId : string ) : Promise < Audit | null > {
4848 const connection = getConnection ( ) ;
4949
5050 const repository = connection . getRepository ( Audit ) ;
5151
52- const single = await repository . findOne ( { AuditId : auditId , ServerId : serverId } ) ;
52+ const single = await repository . findOne ( { where : { AuditId : auditId , ServerId : serverId } } ) ;
5353
5454 return single ;
5555 }
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ export default class IgnoredChannel extends BaseEntity {
1414
1515 const repository = connection . getRepository ( IgnoredChannel ) ;
1616
17- const single = await repository . findOne ( channelId ) ;
17+ const single = await repository . findOne ( { where : { Id : channelId } } ) ;
1818
1919 return single != undefined ;
2020 }
You can’t perform that action at this time.
0 commit comments