Skip to content

Commit

Permalink
Merge pull request #66 from Ayrox/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Ayrox authored Jan 3, 2022
2 parents 5a05ef4 + 63e7d8c commit e32edad
Show file tree
Hide file tree
Showing 40 changed files with 1,835 additions and 101 deletions.
17 changes: 9 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"dependencies": {
"@discordjs/opus": "^0.5.3",
"@discordjs/voice": "^0.6.0",
"@distube/ytdl-core": "^4.9.4",
"@giphy/js-fetch-api": "^4.1.2",
"ascii-table": "^0.0.9",
"canvas": "^2.8.0",
Expand Down
1 change: 1 addition & 0 deletions src/Commands/Developper/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ module.exports = {
const { options, guild } = message

const Sub = options.getSubcommand(["enable", "disable", "reload"]);

if(!message.member.permissions.has("ADMINISTRATOR")) return message.reply({embeds :[errorEmbed().setDescription("You need to be an administrator to use this command.")], ephemeral: true})

let Commandfiles = [];
Expand Down
51 changes: 51 additions & 0 deletions src/Commands/Fun/cat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
const { MessageEmbed, CommandInteraction } = require("discord.js");
const { errorEmbed } = require("../../util/Embeds")
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args)); // eslint-disable-line


module.exports = {

name: "cat",
description: "Random Cat Pictures",
permission: "ADMINISTRATOR",
active: true,

/**
*
* @param {CommandInteraction} message
*/
async execute(message) {

try {

await message.deferReply().catch(() => { });

const fetchAPI = async () => {
const response = await fetch("https://some-random-api.ml/animal/cat", {
method: "GET",
});
return await response.json();
}

const data = await fetchAPI();


const embed = new MessageEmbed()
.setTitle("Cat Picture")
.setColor("#00D7FF")
.setDescription(data.fact)
.setImage(data.image)
.setFooter(`Requested by ${message.member.user.tag}`, message.member.displayAvatarURL())
.setTimestamp();

await message.editReply({ embeds: [embed] });



} catch (err) {
console.log(err)
return message.editReply({ embeds: [errorEmbed().setDescription(`Une erreur est survenue`)], ephemeral: true })
}

},
};
50 changes: 50 additions & 0 deletions src/Commands/Fun/dog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
const { MessageEmbed, CommandInteraction } = require("discord.js");
const { errorEmbed } = require("../../util/Embeds")
const fetch = (...args) => import('node-fetch').then(({ default: fetch }) => fetch(...args)); // eslint-disable-line


module.exports = {

name: "dog",
description: "Random Dog Pictures",
permission: "ADMINISTRATOR",
active: true,

/**
*
* @param {CommandInteraction} message
*/
async execute(message) {

try {

await message.deferReply().catch(() => { });

const fetchAPI = async () => {
const response = await fetch("https://some-random-api.ml/animal/dog", {
method: "GET",
});
return await response.json();
}

const data = await fetchAPI();

const embed = new MessageEmbed()
.setTitle("Dog Picture")
.setColor("#00D7FF")
.setDescription(data.fact)
.setImage(data.image)
.setFooter(`Requested by ${message.member.user.tag}`, message.member.displayAvatarURL())
.setTimestamp();

await message.editReply({ embeds: [embed] });



} catch (err) {
console.log(err)
return message.reply({ embeds: [errorEmbed().setDescription(`Une erreur est survenue`)], ephemeral: true })
}

},
};
77 changes: 77 additions & 0 deletions src/Commands/Fun/fakeYTcomment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
const { errorEmbed } = require("../../util/Embeds")
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args)); // eslint-disable-line
const { MessageEmbed, CommandInteraction, Client, MessageAttachment } = require('discord.js');


module.exports = {

name: "fakecomment",
description: "Fakes a Youtube comment",
permission: "ADMINISTRATOR",
active : true,

options: [
{
name: "comment",
description: "what do you want to comment",
type: "STRING",
required: true,

},
{
name: "user",
description: "the user writing the comment",
type: "USER",
required: false
}
],

/**
*
* @param {CommandInteraction} message
* @param {Client} client
*/

async execute(message,client) {

try {

await message.deferReply().catch(() => { });

let comment = message.options.getString("comment")
let Target = message.options.getMember("user")

if(!Target) Target = message.member

const fetchAPI = async () => {
const response = await fetch(`https://some-random-api.ml/canvas/youtube-comment?avatar=${Target.displayAvatarURL({format:"png"})}&username=${Target.user.username}&comment=${comment}`, {
method: "GET",
});
return await response;
}


const data = await fetchAPI();


const attach = new MessageAttachment(data.body, 'img.png');

const embed = new MessageEmbed()
.setDescription(`**${Target}'s Youtube comment**`)
.setColor("RED")
.setImage(`attachment://img.png`)
.setFooter(`Requested by ${message.member.user.tag}`, message.member.displayAvatarURL())
.setTimestamp();

await message.editReply({ embeds: [embed], files: [attach] });



} catch (err) {
console.log(err)
return message.editReply({ embeds: [errorEmbed().setDescription(`Une erreur est survenue`)], ephemeral: true })
}


}
}
78 changes: 78 additions & 0 deletions src/Commands/Fun/faketweet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
const { errorEmbed } = require("../../util/Embeds")
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args)); // eslint-disable-line
const { MessageEmbed, CommandInteraction, Client, MessageAttachment } = require('discord.js');


module.exports = {

name: "faketweet",
description: "Fakes a tweet",
permission: "ADMINISTRATOR",
active : true,

options: [
{
name: "tweet",
description: "what do you want to tweet",
type: "STRING",
required: true,

},
{
name: "user",
description: "the user writing the comment",
type: "USER",
required: false
}
],

/**
*
* @param {CommandInteraction} message
* @param {Client} client
*/

async execute(message,client) {

try {

await message.deferReply().catch(() => { });

let tweet = message.options.getString("tweet")
let Target = message.options.getMember("user")

if(!Target) Target = message.member

const fetchAPI = async () => {
const response = await fetch(`https://some-random-api.ml/canvas/tweet?avatar=${Target.displayAvatarURL({format:"png"})}&username=${Target.user.username}&displayname=${ Target.nickname ? Target.nickname : Target.user.username }&comment=${tweet}`, {
method: "GET",
});

return await response;
}


const data = await fetchAPI();


const attach = new MessageAttachment(data.body, 'img.png');

const embed = new MessageEmbed()
.setDescription(`**${Target}'s Tweet**`)
.setColor("#00C5FF")
.setImage(`attachment://img.png`)
.setFooter(`Requested by ${message.member.user.tag}`, message.member.displayAvatarURL())
.setTimestamp();

await message.editReply({ embeds: [embed], files: [attach] });



} catch (err) {
console.log(err)
return message.editReply({ embeds: [errorEmbed().setDescription(`Une erreur est survenue`)], ephemeral: true })
}


}
}
Loading

0 comments on commit e32edad

Please sign in to comment.