sfgdfshsty

This commit is contained in:
Neko Life 2021-06-28 19:12:17 +09:00
parent 11332eadc6
commit 27a6ecddc6
3 changed files with 6 additions and 3 deletions

View file

@ -61,7 +61,7 @@ client.on("message", async msg => {
if (msg.mentions.has(client.user) && !msg.isCommand) {
const u = msg.cleanContent.replace(new RegExp("@" + (msg.guild ? msg.guild.member(client.user).displayName : msg.author.username)), "").trim();
if (u.length > 0) trySend(client, msg, await chatAnswer(u));
if (u.length > 0) await trySend(client, msg, await chatAnswer(u));
}
if (!msg.guild) {

View file

@ -169,7 +169,7 @@ async function trySend(client, msgOrChannel, content, checkAd = true) {
for (const f of content.fields) fLength.push(f.value.length);
console.log("Embed", content.title, timestampAt(client), "\n", content.description, content.description?.length, "\n", content.fields, fLength)
}*/
if (!client || !msgOrChannel) return;
if (!client || !msgOrChannel || !content) return;
if (typeof msgOrChannel === "string") msgOrChannel = client.channels.cache.get(msgOrChannel);
if (!client.user.typingIn(msgOrChannel.channel || msgOrChannel)) (msgOrChannel.channel || msgOrChannel).startTyping();
if (client.owners.includes(msgOrChannel.author)) {
@ -409,6 +409,7 @@ function getUTCComparison(compare) {
* @returns {MessageEmbed}
*/
function defaultEventLogEmbed(guild) {
if (!guild) return;
return new MessageEmbed()
.setAuthor(guild.name)
.setFooter((guild.defaultEmbed?.footerQuote ? guild.defaultEmbed.footerQuote : ""), guild.iconURL({ format: "png", size: 128, dynamic: true }))

View file

@ -24,7 +24,9 @@ const URL = [
async function chatAnswer(message) {
// return axios.post("https://rebot.me/ask", { username: "simsimi", question: message }).then(r => r.data).catch(() => { });
console.log(message);
return axios.get(`https://api.simsimi.net/v1/?text=${message.replace(/( |\n|\t)+/, "+").slice(0, 1000)}&lang=en`).then(r => {
const u = message.replace(/( |\n|\t)+/g, "+").slice(0, 1000);
console.log(u);
return axios.get(`https://api.simsimi.net/v1/?text=${u}&lang=en`).then(r => {
console.log(r.data);
return r.data.success.replace(/Sim doesn't know what you are talking about. Please teach me/, "Sorry but i don't speak gibberish");
}).catch(() => { });