1
1
import { AxiosResponse } from "axios" ;
2
2
import { DiscordBot } from ".." ;
3
- import { IGenerateOptions , Markov } from "../../Markov" ;
3
+ import { Markov } from "../../Markov" ;
4
4
import { TenorResponse } from "../../Tenor" ;
5
5
import { makeSpeechBubble } from "@/utils" ;
6
6
import Discord from "discord.js" ;
@@ -61,10 +61,6 @@ function getWord(msg?: string) {
61
61
return search ;
62
62
}
63
63
64
- const DefaultMarkovConfig : IGenerateOptions = {
65
- depth : ( ( Math . random ( ) * 2 ) | 0 ) + 3 , // random number from 3 to 4
66
- } ;
67
-
68
64
export const Shat = async ( options ?: {
69
65
msg ?: string ;
70
66
fallback ?: string ;
@@ -90,20 +86,17 @@ export const Shat = async (options?: {
90
86
search = getWord ( message ) ;
91
87
}
92
88
93
- let shat = await markov ?. generate (
94
- getWord ( search ?? options ?. fallback ) ,
95
- DefaultMarkovConfig
96
- ) ;
89
+ let shat = await markov ?. generate ( getWord ( search ?? options ?. fallback ) ) ;
97
90
98
- if ( ! shat ) shat = await markov ?. generate ( undefined , DefaultMarkovConfig ) ;
91
+ if ( ! shat ) shat = await markov ?. generate ( ) ;
99
92
100
93
return shat ? { content : shat } : undefined ;
101
94
} else {
102
95
const images = ( await globalThis . MetaConcord . container . getService ( "Motd" ) ) . images ;
103
96
let word =
104
97
options ?. msg && ! options . msg . startsWith ( "http" ) ? getWord ( options . msg ) : undefined ;
105
98
106
- if ( ! word ) word = getWord ( await markov ?. generate ( undefined , DefaultMarkovConfig ) ) ;
99
+ if ( ! word ) word = getWord ( await markov ?. generate ( ) ) ;
107
100
108
101
if ( images . length !== 0 && ( Math . random ( ) <= 0.5 || ! word ) ) {
109
102
const imgur = images [ ( Math . random ( ) * images . length ) | 0 ] ;
@@ -117,7 +110,7 @@ export const Shat = async (options?: {
117
110
) . search ( word ?? "random" , 4 ) ;
118
111
if ( ! res || res . data . results . length === 0 )
119
112
return {
120
- content : await markov ?. generate ( undefined , DefaultMarkovConfig ) ,
113
+ content : await markov ?. generate ( ) ,
121
114
} ; // if for some reason we get no result;
122
115
return {
123
116
content :
@@ -267,7 +260,6 @@ export default async (bot: DiscordBot) => {
267
260
const sentence = await (
268
261
await bot . container . getService ( "Markov" )
269
262
) . generate ( prefix , {
270
- ...DefaultMarkovConfig ,
271
263
continuation : false ,
272
264
} ) ;
273
265
@@ -374,7 +366,7 @@ export default async (bot: DiscordBot) => {
374
366
) {
375
367
const mk = await (
376
368
await bot . container . getService ( "Markov" )
377
- ) . generate ( reaction . emoji . toString ( ) , DefaultMarkovConfig ) ;
369
+ ) . generate ( reaction . emoji . toString ( ) ) ;
378
370
if ( mk ) {
379
371
lastReactedMessages . add ( message . id ) ;
380
372
await ( message . channel as Discord . TextChannel )
0 commit comments