Revert "Adding urban dictionary lookups"
This reverts commit f87542132e
.
This commit is contained in:
parent
ca758c5898
commit
45ef05ac45
23
llamabot.js
23
llamabot.js
@ -5,8 +5,6 @@ import { resetResponses, userResetMessages } from './assets/resetMessages.js';
|
||||
import { errorMessages, busyResponses } from './assets/errorMessages.js';
|
||||
import cpuStat from 'cpu-stat';
|
||||
import os from 'os';
|
||||
import isNotDefined from 'is-not-defined'
|
||||
import urban from 'urban'
|
||||
|
||||
import {
|
||||
Client,
|
||||
@ -141,23 +139,6 @@ client.on('messageCreate', async (message) => {
|
||||
setPresenceBusy()
|
||||
setBusy(message.author.id, true);
|
||||
|
||||
|
||||
// begin commands area
|
||||
if (message.content.includes("!urban")) {
|
||||
const regex = /"([^"]+)"/g;
|
||||
const searchTerm = message.content.match(regex);
|
||||
const search = urban(searchTerm)
|
||||
search.first(function (data) {
|
||||
if (!isNotDefined(data)) {
|
||||
const lastMessageIndex = conversation.messages.length - 1;
|
||||
conversation.messages[lastMessageIndex].content = `The definition of ${searchTerm} is: ${data.definition} comment on this exact definition in detail.`;
|
||||
console.log(`Fetching urban for AI for ${searchTerm}`)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// end commands area
|
||||
|
||||
const response = await generateResponse(conversation, message);
|
||||
|
||||
// Append bot message to conversation history
|
||||
@ -209,7 +190,6 @@ import cheerio from 'cheerio';
|
||||
|
||||
async function generateResponse(conversation, message) {
|
||||
|
||||
|
||||
// Check if message contains a URL
|
||||
const urlRegex = /(https?:\/\/[^\s]+)/g;
|
||||
const urls = message.content.match(urlRegex);
|
||||
@ -264,9 +244,6 @@ async function generateResponse(conversation, message) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => {
|
||||
controller.abort();
|
||||
|
Loading…
Reference in New Issue
Block a user