Skip to content

Commit

Permalink
image seach volto
Browse files Browse the repository at this point in the history
  • Loading branch information
danielguirra committed Mar 27, 2024
1 parent bce2ae0 commit 8a53205
Show file tree
Hide file tree
Showing 11 changed files with 219 additions and 1,069 deletions.
882 changes: 62 additions & 820 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,25 @@
"dependencies": {
"@discordjs/rest": "^0.1.0-canary.0",
"@vitalets/google-translate-api": "^7.0.0",
"async-g-i-s": "^1.5.2",
"axios": "^0.21.4",
"canvas": "^2.10.2",
"cheerio": "^1.0.0-rc.10",
"cron": "^1.8.2",
"discord.js": "^14.0.3",
"express": "^4.17.1",
"lodash": "^4.17.21",
"request": "^2.88.2",
"sequelize": "^6.37.1",
"sqlite3": "^5.1.7",
"striptags": "^3.2.0"
},
"main": "server.ts",
"devDependencies": {
"@types/cheerio": "^0.22.31",
"@types/cron": "^1.7.3",
"@types/express": "^4.17.13",
"@types/lodash": "^4.14.182",
"@types/node": "^18.19.26",
"@types/nodemailer": "^6.4.4",
"@types/request": "^2.48.8",
"@types/sequelize": "^4.28.20",
"@types/striptags": "^3.1.1",
"@types/webtorrent": "^0.109.7",
"nodemon": "^2.0.13",
"nodemon": "^2.0.22",
"ts-node": "^10.9.2"
}
}
}
9 changes: 1 addition & 8 deletions src/command/Builder.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import {
Collection,
CommandInteraction,
Interaction,
InteractionResponse,
Message,
SlashCommandBuilder,
} from 'discord.js';
import { Collection, SlashCommandBuilder } from 'discord.js';

import { allComands } from './allComands';
import { Command } from '../interfaces/Command';
Expand Down
14 changes: 10 additions & 4 deletions src/command/commandAllSkinsOfChampLol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ export const allSkinsLol: Command = {
.setRequired(true)
),
async executeMessageCommand(commandMessage: Message) {
const user = commandMessage.mentions.users.first();
if (user) {
return commandMessage.reply(
user.displayAvatarURL({ extension: 'png' })
const championName = commandMessage.content.replace('*skinlol', '');
if (championName) {
return loadinCreator(
commandMessage,
async () => {
return await LeagueOfLegendsSkins.SkinsBasedInChampName(
championName
);
},
undefined
);
}
return;
Expand Down
4 changes: 2 additions & 2 deletions src/command/commandGoogleImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ async function sendSearch(
) {
const channela = await channelItsGuildTextChannel(channel);
if (channela) {
const men = command.reply('Pesquisando ...').then(async () => {
command.reply('Pesquisando ...').then(async () => {
const id = channela.lastMessageId;
if (id) {
const mensage = await channela.messages.fetch(id);
googleImage(text, channela, mensage);
await googleImage(text, channela, mensage);
}
});
}
Expand Down
1 change: 1 addition & 0 deletions src/command/commandLove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const love: Command = {
const love = commandMessage.content.replace('*love ', '');
const channel = await channelItsGuildTextChannel(commandMessage.channel);
if (love && channel) {
commandMessage.react('❤');
const loveSend = await sendLoveMessageDaily(channel);
}
},
Expand Down
73 changes: 57 additions & 16 deletions src/command/commandMotivacao.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Message, SlashCommandBuilder } from 'discord.js';
import { ChannelType, Message, SlashCommandBuilder } from 'discord.js';

import { googleImagePensador } from '../util/googleImage';
import { pensador } from '../util/pensador';
import { Command } from '../interfaces/Command';
import { googleImage } from '../util/googleImage';
import { channelItsGuildTextChannel } from '../util/channelItsGuildTextChannel';
import { embedBuilder } from '../util/getEmbed';

/**
* Don't forget to export
Expand All @@ -15,24 +17,63 @@ export const motivacao: Command = {
.setName('motivacao')
.setDescription('motivacao uma mensagem motivacional será enviada'),
async executeMessageCommand(commandMessage: Message) {
const motivacaoFunc = await pensador.getFromMotivacionais();
if (motivacaoFunc) {
const embed = await googleImagePensador(
embedAux,
motivacaoFunc,
commandMessage
);
const data = await pensador.getFromMotivacionais();
if (data) {
commandMessage.reply('Carregando').then(async (Interaction) => {
if (commandMessage.channel.type == ChannelType.GuildText) {
const image = await googleImage(data.author);

if (typeof image == 'string') {
const url = new URL(
'https://www.google.com/search?q=' + data.author
);

const embed = embedBuilder(
'Motivacional Por ' + data.author + ' 🤯',
data.message,
image,
data.author,
image,
undefined,
'Random',
url.href
);
await Interaction.edit({ embeds: [embed] });
}
}
});
}
},
async executeSlashCommand(commandSlash) {
if (!commandSlash.isChatInputCommand()) return;
const motivacaoFunc = await pensador.getFromMotivacionais();
if (motivacaoFunc) {
const embed = await googleImagePensador(
embedAux,
motivacaoFunc,
commandSlash
);
const data = await pensador.getFromMotivacionais();
if (data) {
commandSlash.reply('Carregando').then(async (Interaction) => {
if (
commandSlash.channel &&
commandSlash.channel.type == ChannelType.GuildText
) {
const image = await googleImage(data.author);

if (typeof image == 'string') {
const url = new URL(
'https://www.google.com/search?q=' + data.author
);

const embed = embedBuilder(
'Motivacional Por ' + data.author + ' 🤯',
data.message,
image,
data.author,
image,
undefined,
'Random',
url.href
);
await Interaction.edit({ embeds: [embed] });
}
}
});
}
},
};
Expand Down
79 changes: 59 additions & 20 deletions src/command/commandPensador.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Message, SlashCommandBuilder } from 'discord.js';
import { ChannelType, Message, SlashCommandBuilder } from 'discord.js';

import { googleImagePensador } from '../util/googleImage';
import { pensador as uga } from '../util/pensador';
import { Command } from '../interfaces/Command';
import { embedBuilder } from '../util/getEmbed';
import { googleImage } from '../util/googleImage';

/**
* Don't forget to export
Expand All @@ -15,28 +16,66 @@ export const pensador: Command = {
.setName('pensador')
.setDescription('pensador'),
async executeMessageCommand(commandMessage: Message) {
const soltas = await uga.getFromSoltas();
if (soltas) {
const embed = await googleImagePensador(
embedAux,
soltas,
commandMessage
);
const data = await uga.getFromSoltas();
if (data) {
commandMessage.reply('Carregando').then(async (Interaction) => {
if (
commandMessage.channel &&
commandMessage.channel.type == ChannelType.GuildText
) {
const image = await googleImage(data.author);

if (typeof image == 'string') {
const url = new URL(
'https://www.google.com/search?q=' + data.author
);

const embed = embedBuilder(
'Soltas Por ' + data.author + ' 🤯',
data.message,
image,
data.author,
image,
undefined,
'Random',
url.href
);
await Interaction.edit({ embeds: [embed] });
}
}
});
}
},
async executeSlashCommand(commandSlash) {
if (!commandSlash.isChatInputCommand()) return;
const soltas = await uga.getFromSoltas();
if (soltas) {
const embed = await googleImagePensador(
embedAux,
soltas,
commandSlash
);
const data = await uga.getFromSoltas();
if (data) {
commandSlash.reply('Carregando').then(async (Interaction) => {
if (
commandSlash.channel &&
commandSlash.channel.type == ChannelType.GuildText
) {
const image = await googleImage(data.author);

if (typeof image == 'string') {
const url = new URL(
'https://www.google.com/search?q=' + data.author
);

const embed = embedBuilder(
'Soltas Por ' + data.author + ' 🤯',
data.message,
image,
data.author,
image,
undefined,
'Random',
url.href
);
await Interaction.edit({ embeds: [embed] });
}
}
});
}
},
};

const embedAux = {
embedTitle: 'Pensador Frases Soltas',
};
1 change: 0 additions & 1 deletion src/service/senders/sendDaily.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { GuildTextBasedChannel } from 'discord.js';

import { googleImagePensador } from '../../util/googleImage';
import { IPensador } from '../../interfaces/PensadorMessage';
import { pensador } from '../../util/pensador';
import { embedBuilder } from '../../util/getEmbed';
Expand Down
8 changes: 4 additions & 4 deletions src/service/senders/sendLoveMessageDaily.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { GuildTextBasedChannel } from 'discord.js';

import { googleImagePensador } from '../../util/googleImage';
import { IPensador } from '../../interfaces/PensadorMessage';
import { pensador } from '../../util/pensador';
import { embedBuilder } from '../../util/getEmbed';
import { URL } from 'url';
import { googleImage } from '../../util/googleImage';

export const sendLoveMessageDaily = async (
channelLove?: GuildTextBasedChannel
Expand All @@ -13,13 +13,13 @@ export const sendLoveMessageDaily = async (
const data: IPensador = await pensador.getFromAmor();

const url = new URL('https://www.google.com/search?q=' + data.author);

const image = (await googleImage(data.author)) as string;
const embed = embedBuilder(
'💕 Por ' + data.author + ' 💕',
data.message,
undefined,
image,
data.author,
undefined,
image,
undefined,
'DarkVividPink',
url.href
Expand Down
Loading

0 comments on commit 8a53205

Please sign in to comment.