3
3
type APIEmbed ,
4
4
type Message ,
5
5
type PartialMessage ,
6
+ type TextChannel ,
6
7
} from 'discord.js' ;
7
8
import { checkContent } from '../alexjs/checkContent.js' ;
8
9
import { checkBannedWords } from '../alexjs/checkBannedWords.js' ;
@@ -33,7 +34,9 @@ export const onUpdate = async (
33
34
34
35
const linkMessage = await checkLinks ( bot , newMessage ) ;
35
36
if ( linkMessage ) {
36
- const adminChannel = bot . channels . cache . get ( process . env . ADMIN_CHANNEL ! ) ;
37
+ const adminChannel = bot . channels . cache . get (
38
+ process . env . ADMIN_CHANNEL ! ,
39
+ ) as TextChannel ;
37
40
if ( adminChannel && adminChannel . isTextBased ( ) ) {
38
41
await adminChannel . send ( {
39
42
embeds : [ linkMessage ] ,
@@ -47,7 +50,9 @@ export const onUpdate = async (
47
50
const newContent = newMessage . content ;
48
51
49
52
if ( oldContent !== newContent ) {
50
- const logChannel = bot . channels . cache . get ( process . env . ADMIN_CHANNEL ! ) ;
53
+ const logChannel = bot . channels . cache . get (
54
+ process . env . ADMIN_CHANNEL ! ,
55
+ ) as TextChannel ;
51
56
if ( logChannel && logChannel . isTextBased ( ) ) {
52
57
const logEmbed = new EmbedBuilder ( )
53
58
. setTitle ( `Message Updated by "${ newMessage . author ?. username } "` )
@@ -103,7 +108,8 @@ export const onUpdate = async (
103
108
104
109
// when edit results in new warning, but no existing warning
105
110
if ( ! savedWarning && triggeredWarnings . length ) {
106
- const sent = await newMessage . channel . send ( {
111
+ const channel = newMessage . channel as TextChannel ;
112
+ const sent = await channel . send ( {
107
113
embeds : triggeredWarnings . slice ( 0 , 1 ) ,
108
114
} ) ;
109
115
await Warnings . create ( {
0 commit comments