File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed
velog-cron/src/lib/discord
velog-scripts/lib/discord
velog-server/src/lib/discord Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -56,10 +56,10 @@ export class DiscordService {
56
56
const channel = await this . client . channels . fetch ( channelId )
57
57
58
58
if ( channel ?. isTextBased ( ) ) {
59
- if ( message . length > 2000 ) {
60
- console . log ( 'message' , message )
59
+ const chunkSize = 2000
60
+ for ( let i = 0 ; i < message . length ; i += chunkSize ) {
61
+ await channel . send ( message . slice ( i , i + chunkSize ) )
61
62
}
62
- await channel . send ( message . slice ( 0 , 2000 ) )
63
63
} else {
64
64
throw new Error ( 'Wrong channel type' )
65
65
}
Original file line number Diff line number Diff line change @@ -33,7 +33,10 @@ export class DiscordService {
33
33
const channel = await this . client . channels . fetch ( channelId )
34
34
35
35
if ( channel ?. isTextBased ( ) ) {
36
- await channel . send ( message )
36
+ const chunkSize = 2000
37
+ for ( let i = 0 ; i < message . length ; i += chunkSize ) {
38
+ await channel . send ( message . slice ( i , i + chunkSize ) )
39
+ }
37
40
} else {
38
41
throw new Error ( 'Wrong channel type' )
39
42
}
Original file line number Diff line number Diff line change @@ -60,10 +60,10 @@ export class DiscordService {
60
60
const channel = await this . client . channels . fetch ( channelId )
61
61
62
62
if ( channel ?. isTextBased ( ) ) {
63
- if ( message . length > 2000 ) {
64
- console . log ( 'message' , message )
63
+ const chunkSize = 2000
64
+ for ( let i = 0 ; i < message . length ; i += chunkSize ) {
65
+ await channel . send ( message . slice ( i , i + chunkSize ) )
65
66
}
66
- await channel . send ( message . slice ( 0 , 2000 ) )
67
67
} else {
68
68
throw new Error ( 'Wrong channel type' )
69
69
}
You can’t perform that action at this time.
0 commit comments