Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const prefix = "ca!";
- const botname = "CannyBOT Plus! playing: ca!help";
- const version = "1.3 Rev 2";
- var help = "__CannyBOT Plus! Commands__\n ca!help, ca!joke, ca!fact, ca!image {IMAGE_URL}, ca!video {VIDEO_URL}, ca!crosscolor {CROSSCOLOR_URL}, ca!default, ca!incredibleroll, ca!weather {WEATHER_LOCATION}, ca!version, ca!roominfo";
- var botinfo = "CannyBOT Plus! " + version + ". Find CannyBOT at: https://pastebin.com/Sc5Cmbgt";
- const incrediblerollPics = [
- "https://media.discordapp.net/attachments/1107412342960033832/1114622683460685854/dfa4skp-4ef45bab-b574-4b4d-aac2-12cf5b53b6c6.png?width=634&height=630",
- "https://media.discordapp.net/attachments/1114637956079173722/1114638247361003541/mr-incredible-becoming-uncanny-phase-1.png?width=722&height=630",
- "https://media.discordapp.net/attachments/1114637956079173722/1114638247642026025/latest.png",
- "https://media.discordapp.net/attachments/1114637956079173722/1114638247973355570/latest.png",
- "https://media.discordapp.net/attachments/1114637956079173722/1114638248258584627/images.png",
- "https://media.discordapp.net/attachments/1114637956079173722/1114638248501858444/images.png",
- "https://media.discordapp.net/attachments/1114637956079173722/1114638248824799332/latest.png",
- "https://media.discordapp.net/attachments/1114637956079173722/1114638486935449782/latest.png",
- "https://media.discordapp.net/attachments/1114637956079173722/1114638487237443584/latest.png",
- "https://media.discordapp.net/attachments/1114637956079173722/1114638487526854737/latest.png",
- "https://media.discordapp.net/attachments/1114637956079173722/1114638487849807872/350.png",
- "https://i1.sndcdn.com/artworks-JeZQh6Hbil2Er51B-U9rx3A-t500x500.jpg",
- "https://i1.sndcdn.com/avatars-RNXmlKLL2AHsRPaz-8LVOoA-t500x500.jpg",
- "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcR8FcyNrd8y5BmEwp9xYLRjvYxDlheS4DjwgmLZIEvBO2yHIvCv",
- "https://pbs.twimg.com/media/FTHtsuDVUAIjUnO.jpg",
- "https://i.ytimg.com/vi/Zne8JgObXBc/maxresdefault.jpg",
- "https://i.ytimg.com/vi/BFFIS5r7Aj0/maxresdefault.jpg?sqp=-oaymwEmCIAKENAF8quKqQMa8AEB-AH-CYAC0AWKAgwIABABGH8gFSgTMA8=&rs=AOn4CLB0OOFdzym2aFPtk2jqd4beTm8baA",
- "https://i.ytimg.com/vi/TNpQGA762UU/mqdefault.jpg",
- "https://media.discordapp.net/attachments/1114860678000431254/1114864540321062952/latest.png?width=635&height=630",
- "https://media.discordapp.net/attachments/1114860678000431254/1114864540614660166/latest.png?width=635&height=630",
- "https://media.discordapp.net/attachments/1114860678000431254/1114864540899881030/latest.png?width=635&height=630",
- "https://media.discordapp.net/attachments/1114860678000431254/1114864541155725382/latest.png?width=635&height=630",
- "https://media.discordapp.net/attachments/1114860678000431254/1114864541617106985/latest.png?width=635&height=630",
- "https://media.discordapp.net/attachments/1114860678000431254/1114864541961035866/latest.png?width=646&height=630",
- "https://media.discordapp.net/attachments/1114860678000431254/1114864542409822298/latest.png?width=759&height=630",
- "https://media.discordapp.net/attachments/1114860678000431254/1127302563356741765/1000.png?width=630&height=630",
- "https://media.discordapp.net/attachments/1114860678000431254/1127302563713269851/1000.png?width=630&height=630",
- "https://media.discordapp.net/attachments/1114860678000431254/1127302564011069530/latest.png?width=747&height=630",
- "https://media.discordapp.net/attachments/1114860678000431254/1127302564430487613/1000.png?width=630&height=630",
- "https://media.discordapp.net/attachments/1114860678000431254/1127302564896067635/1000.png",
- "https://media.discordapp.net/attachments/1114860678000431254/1127302565260959744/latest.png",
- "https://media.discordapp.net/attachments/1114860678000431254/1127302701642956860/latest.png",
- "https://media.discordapp.net/attachments/1114860678000431254/1127302701974294699/1000.png?width=630&height=630",
- "https://media.discordapp.net/attachments/1114860678000431254/1127302702569902180/latest.png?width=761&height=630",
- "https://media.discordapp.net/attachments/1114860678000431254/1127302702288879797/1000.png?width=630&height=630",
- ];
- function getRandomPic(picsArray) {
- const randomIndex = Math.floor(Math.random() * picsArray.length);
- return picsArray[randomIndex];
- }
- function sendMsg(msg) {
- setTimeout(() => {
- socket.emit("talk", { text: msg });
- }, 1100);
- }
- setTimeout(() => {
- socket.emit("command", { list: ["name", "CannyBOT Plus! playing: ca!help"] });
- }, 1000);
- setTimeout(() => {
- socket.emit("command", { list: ["color", "https://media.discordapp.net/attachments/1079083903433846836/1127298039825059970/i-tools.png"] });
- }, 2100);
- setTimeout(() => {
- sendMsg("CannyBOT Plus! is online. Type " + prefix + "help to see commands.");
- setInterval(() => {
- sendMsg("CannyBOT Plus! is online. Type " + prefix + "help to see commands.");
- }, 60000);
- }, 3200);
- socket.on("talk", function (message) {
- if (message.text === prefix + "help") {
- sendMsg(help);
- } else if (message.text === prefix + "joke") {
- setTimeout(() => {
- socket.emit("command", { list: ["joke"] });
- }, 1100);
- } else if (message.text === prefix + "fact") {
- setTimeout(() => {
- socket.emit("command", { list: ["fact"] });
- }, 1100);
- } else if (message.text.startsWith(prefix + "image")) {
- const imageUrl = message.text.substring(prefix.length + 6);
- setTimeout(() => {
- socket.emit("command", { list: ["image", imageUrl] });
- }, 1100);
- } else if (message.text === prefix + "incredibleroll") {
- const randomPic = getRandomPic(incrediblerollPics);
- setTimeout(() => {
- socket.emit("command", { list: ["image", randomPic] });
- }, 1100);
- } else if (message.text.startsWith(prefix + "weather")) {
- const location = message.text.substring(prefix.length + 8);
- getWeather(location);
- } else if (message.text === prefix + "roominfo") {
- sendMsg("Amount of users in the room: " + window.usersAmt);
- } else if (message.text === prefix + "version") {
- sendMsg(botinfo);
- } else if (message.text.startsWith(prefix + "video")) {
- const videoUrl = message.text.substring(prefix.length + 6);
- setTimeout(() => {
- socket.emit("command", { list: ["video", videoUrl] });
- }, 1100);
- } else if (message.text.startsWith(prefix + "crosscolor")) {
- const crosscolorUrl = message.text.substring(prefix.length + 11);
- setTimeout(() => {
- socket.emit("command", { list: ["crosscolor", crosscolorUrl] });
- }, 1100);
- } else if (message.text === prefix + "default") {
- setTimeout(() => {
- socket.emit("command", { list: ["crosscolor", "https://media.discordapp.net/attachments/1079083903433846836/1127298039825059970/i-tools.png"] });
- }, 1100);
- }
- });
- function getWeather(location) {
- const apiKey = "dcc6b2a3fa3d4fe58d9193316232905";
- const apiUrl = `https://api.weatherapi.com/v1/current.json?key=${apiKey}&q=${encodeURIComponent(location)}`;
- fetch(apiUrl)
- .then((response) => response.json())
- .then((data) => {
- if (data.error) {
- sendMsg("Unable to retrieve weather information. Please check the location.");
- } else {
- const weather = data.current;
- const weatherInfo = `Weather in ${data.location.name}, ${data.location.country}:\nCondition: ${weather.condition.text}\nTemperature: ${weather.temp_c}°C\nHumidity: ${weather.humidity}%\nWind Speed: ${weather.wind_kph} km/h\n`;
- sendMsg(weatherInfo);
- }
- })
- .catch((error) => {
- console.error("Error:", error);
- sendMsg("An error occurred while retrieving weather information.");
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement