rename string into clean & add settings
This commit is contained in:
parent
4d309e2e9e
commit
65e09de7e2
10 changed files with 24 additions and 10 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import detector from "./detector.js";
|
||||
import { cleanMessageContent } from "../utils/strings.js";
|
||||
import { cleanMessageContent } from "../utils/clean.js";
|
||||
|
||||
/*check the regex for "quoi"
|
||||
trigger if it's at the end of the sentence (tu fais quoi)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { getSetting } from '../utils/settings.js';
|
||||
|
||||
export const TriggerState = {
|
||||
untriggered: 0,
|
||||
replied: 1,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import detector from "./detector.js";
|
||||
import { cleanMessageContent } from "../utils/strings.js";
|
||||
import { cleanMessageContent } from "../utils/clean.js";
|
||||
|
||||
/*check if someone reply to a "quoi" with a "feur" or "quoifeur"
|
||||
send praise
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import detector from "./detector.js";
|
||||
import { cleanMessageContent } from "../utils/strings.js";
|
||||
import { cleanMessageContent } from "../utils/clean.js";
|
||||
|
||||
//check if the bot is pinged by someone
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import detector from "./detector.js";
|
||||
import { cleanMessageContent } from "../utils/strings.js";
|
||||
import { cleanMessageContent } from "../utils/clean.js";
|
||||
|
||||
/*check if someone reply to a "quoi" with a "quoicoubeh" or "coubeh"
|
||||
send roasts
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import detector from "./detector.js";
|
||||
import { cleanMessageContent } from "../utils/strings.js";
|
||||
import { cleanMessageContent } from "../utils/clean.js";
|
||||
|
||||
const suffixes = [
|
||||
", je crois",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import detector from "./detector.js";
|
|||
import compromise from 'fr-compromise';
|
||||
import conj from 'conjugation-fr';
|
||||
import { toInfinitive } from "../data/index.js";
|
||||
import { cleanMessageContent } from "../utils/strings.js";
|
||||
import { cleanMessageContent } from "../utils/clean.js";
|
||||
|
||||
/*check the pronoun / subject of the question to answer properly by conjugating
|
||||
exemple : tu fais quoi ? je fais feur
|
||||
|
|
|
|||
3
index.js
3
index.js
|
|
@ -5,8 +5,7 @@ import firstDetector from './detectors/allDetector.js';
|
|||
|
||||
const client = new Client({
|
||||
makeCache: Options.cacheWithLimits({
|
||||
MessageManager: 0, // Très bien pour la RAM
|
||||
// Ajoute ceci pour économiser encore plus :
|
||||
MessageManager: 0, //opti de RAM
|
||||
UserManager: 0,
|
||||
GuildMemberManager: 0,
|
||||
ThreadManager: 0,
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@
|
|||
*/
|
||||
|
||||
export function cleanMessageContent(message) {
|
||||
// Sécurité si le message est vide ou bizarre
|
||||
// securite si le message est vide ou bizarre
|
||||
if (!message) return "";
|
||||
|
||||
// On privilégie cleanContent qui est plus propre pour la lecture humaine
|
||||
// privilegier cleanContent pour la lecture humaine
|
||||
const text = message.cleanContent || message.content || "";
|
||||
|
||||
return text.trim();
|
||||
13
utils/settings.js
Normal file
13
utils/settings.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
const defaultSettings = {
|
||||
quoiAnswerPercentage: 100,
|
||||
feurAnswerPercentage: 100,
|
||||
mentionAnswerPercentage: 100,
|
||||
quoicoubehAnswerPercentage: 100,
|
||||
ignoredRoleId: null, // ajouter ID au besoin
|
||||
forcedAnswerRoleId: null // ajouter ID au besoin
|
||||
};
|
||||
|
||||
export function getSetting(guildId, key) {
|
||||
// brancher une BDD plus tard
|
||||
return defaultSettings[key] ?? null;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue