├── package.json ├── LICENSE ├── ai.js ├── README.md └── index.js /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vid", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "@discordjs/voice": "^0.6.0", 14 | "axios": "^0.27.2", 15 | "discord-speech-recognition": "^2.2.0", 16 | "discord.js": "^13.8.0", 17 | "dotenv": "^16.0.1", 18 | "node-fetch": "^2.6.1", 19 | "tweetnacl": "^1.0.3" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 UltraX 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ai.js: -------------------------------------------------------------------------------- 1 | const fetch = require("node-fetch") // axios, https, etc... (node-fetch@2.1.0) 2 | let webhookId = 'b7938fcc-be70-48cd-b54e-5c76cddcc17b' 3 | let a; 4 | 5 | async function reply(sessionId, msg) { 6 | a = await fetch("https://dialogflow.cloud.google.com/v1/integrations/messenger/webhook/" + webhookId + "/sessions/" + sessionId +"?platform=webdemo", { 7 | "headers": { 8 | "accept": "*/*", 9 | "accept-language": "en-US,en;q=0.9", 10 | "content-type": "application/json", 11 | "sec-fetch-dest": "empty", 12 | "sec-fetch-mode": "cors", 13 | "sec-fetch-site": "cross-site" 14 | }, 15 | 16 | "referrerPolicy": "no-referrer", 17 | "body": "{\"queryInput\":{\"text\":{\"text\":\"" + msg + "\",\"languageCode\":\"en\"}}}", 18 | "method": "POST", 19 | "mode": "cors" 20 | 21 | }) 22 | 23 | .then(a => { 24 | // If you're using axios put this line =>>> a = a.data 25 | return a.text(); 26 | }); 27 | a = JSON.parse(a.slice(5)).queryResult.fulfillmentText; 28 | if (!a) a = "No Response"; 29 | 30 | // take an action 31 | return a 32 | } 33 | 34 | module.exports = reply -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Girlfriend Bot 2 | This repo is basically the source code for the main youtube video which was basically me creating a girlfriend that i can talk to in VC and her replying to me. Don't worry i'm not down bad, it was just suggested by some members, so i'm fine. 3 | 4 | YouTube Video: https://www.youtube.com/watch?v=DyWYb83uYwE&ab_channel=UltraX 5 | 6 | ## Guide 7 | Follow these steps to be able to start the bot properly. 8 | 9 | ### Step 1: 10 | You're gonna star this repo and click on the green download button and download the code (ZIP) 11 | 12 | ### Step 2: 13 | Once that's done, you're going to open the folder in your IDE and do `npm install`, Note that you need to have [node.js](https://nodejs.org/en/) installed. 14 | 15 | ### Step 3: 16 | You're gonna create a new file and name it `.env` and put the following code 17 | ```env 18 | TOKEN= 19 | X= 20 | ``` 21 | - Next to the token, you will grab your bot's token that can be obtained from the [discord developers portal](https://discord.com/developers/applications) 22 | - Next to `X` you're going to grab an api key from [UltraX API](https://ultrax-yt.com) and put it there. It takes a while to receive the verification code and it might be in your spam category. 23 | - P.S. The website (UltraX) isn't designed for phone usage. 24 | 25 | ### Step 4 26 | Now you can enjoy your bot by starting it, type `node .` in the terminal to run the bot 27 | 28 | ### Note: 29 | The bot will require a while to be able to work in vc, so maybe let it be online for 1 minute, then add it to the vc using `!callMyGF` and wait for 10 seconds or so. If you faced any issues you can always join our [discord server](https://ultrax-yt.com/discord)! 30 | 31 | # Update 32 | The Dialogflow webhook in the video doesn't work anymore, so you can make your own dialogflow and [this is how](https://www.youtube.com/watch?v=JC3srf7U4TE) 33 | 34 | ##### Donation: _you can help me buy a new laptop by [donating to me](https://ultrax-yt.com/paypal), would be appreciated!_ 35 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config(); 2 | const { Client, Intents } = require("discord.js"); 3 | const { joinVoiceChannel, createAudioResource, createAudioPlayer, getVoiceConnection } = require("@discordjs/voice"); 4 | const { addSpeechEvent } = require("discord-speech-recognition"); 5 | const reply = require('./ai') 6 | const client = new Client({ 7 | intents: [ 8 | Intents.FLAGS.GUILDS, 9 | Intents.FLAGS.GUILD_VOICE_STATES, 10 | Intents.FLAGS.GUILD_MESSAGES 11 | ], 12 | }); 13 | 14 | client.login(process.env.TOKEN); 15 | addSpeechEvent(client, { lang: 'en-US' }); 16 | 17 | client.on("ready", () => { 18 | console.log(`Your gf is ready to serve you!`); 19 | }); 20 | 21 | 22 | client.on("messageCreate", (message) => { 23 | if(message.author.bot) return; 24 | if(message.content == "!callMyGF"){ 25 | const voiceChannel = message.member?.voice.channel; 26 | if(!voiceChannel)return message.reply("You need to be in a voice channel to use this command"); 27 | joinVoiceChannel({ 28 | channelId: voiceChannel.id, 29 | guildId: voiceChannel.guild.id, 30 | adapterCreator: voiceChannel.guild.voiceAdapterCreator, 31 | selfDeaf: false, 32 | }); 33 | } 34 | }); 35 | 36 | client.on("speech", async (message) => { 37 | if(!message.content) return; 38 | message.content = message.content.replace('f***', 'fuck') 39 | console.log(message.content) 40 | let a; 41 | let resource; 42 | const player = createAudioPlayer() 43 | let voiceConnection = await getVoiceConnection(message.guild.id); 44 | 45 | a = await reply(message.author.id, message.content) 46 | 47 | // to see all supported languages head to "https://api.ultrax-yt.com/v1/details/supported-tts-languages" 48 | // and add at the end of the URL << &language=en >> ofc change en with your prefered language. 49 | resource = createAudioResource(`https://api.ultrax-yt.com/v1/tts?key=${process.env.X}&query=${a}`) 50 | 51 | voiceConnection.subscribe(player) 52 | if(a == "Nooo, i still want you to stay, but if you need to go then bye, i'll miss you!") { 53 | await player.play(resource) 54 | setTimeout(() => { 55 | voiceConnection.disconnect() 56 | }, 7000) 57 | } 58 | else player.play(resource) 59 | }); 60 | --------------------------------------------------------------------------------