not much, just some code changes
This commit is contained in:
parent
d6f1f68a10
commit
0d5af597f8
3 changed files with 81 additions and 50 deletions
30
.debug.js
Normal file
30
.debug.js
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
const adventurer = {
|
||||||
|
name: 'Alice',
|
||||||
|
cat: {
|
||||||
|
name: 'Dinah'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const dogName = adventurer.dog?.name;
|
||||||
|
console.log(dogName);
|
||||||
|
// expected output: undefined
|
||||||
|
|
||||||
|
console.log(adventurer.someNonExistentMethod?.());
|
||||||
|
// expected output: undefined
|
||||||
|
let a = [
|
||||||
|
{
|
||||||
|
guild: '770748282191740940',
|
||||||
|
id: 616002,
|
||||||
|
name: 'uwa uwa ao',
|
||||||
|
day: 24,
|
||||||
|
month: 2,
|
||||||
|
__v: 0
|
||||||
|
}
|
||||||
|
];
|
||||||
|
console.log(a.length)
|
||||||
|
|
||||||
|
for (let index = 0; index < 10; index++) {
|
||||||
|
var b = index
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(b)
|
|
@ -10,6 +10,7 @@ module.exports = {
|
||||||
getGifEmbed: getGifEmbed,
|
getGifEmbed: getGifEmbed,
|
||||||
getGifWithMessage: getGifWithMessage,
|
getGifWithMessage: getGifWithMessage,
|
||||||
returnPromiseString: returnPromiseString,
|
returnPromiseString: returnPromiseString,
|
||||||
|
moveMessage: moveMessage,
|
||||||
};
|
};
|
||||||
|
|
||||||
function randomColor() {
|
function randomColor() {
|
||||||
|
@ -58,3 +59,50 @@ async function returnPromiseString(guildMembers) {
|
||||||
guildMembers.fetch();
|
guildMembers.fetch();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//YouTube not working, file exceeds upload limit
|
||||||
|
function moveMessage(message, channelId) {
|
||||||
|
message.react('🐮');
|
||||||
|
|
||||||
|
const replyChannel = message.channel;
|
||||||
|
const msgToMooveId = message.reference.messageId;
|
||||||
|
const mentionedChannelId = channelId.substring(2, channelId.length - 1);
|
||||||
|
|
||||||
|
replyChannel.messages.fetch(msgToMooveId).then(msg => {
|
||||||
|
if (msg.attachments.size > 0) {
|
||||||
|
const newMsgAttachments = [];
|
||||||
|
const allAttachments = msg.attachments.values();
|
||||||
|
|
||||||
|
for (let i = 0; i < msg.attachments.size; i++) {
|
||||||
|
const currAttachment = allAttachments.next().value;
|
||||||
|
newMsgAttachments.push(new MessageAttachment(currAttachment.url));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (msg.embeds.length > 0) {
|
||||||
|
client.channels.cache.get(mentionedChannelId)
|
||||||
|
.send({ content: `Sent by ${msg.author}\nmooved ${message.author}`, embeds: msg.embeds, files: newMsgAttachments });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
client.channels.cache.get(mentionedChannelId)
|
||||||
|
.send({ content: `Sent by ${msg.author}\nmooved ${message.author}`, files: newMsgAttachments });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const embed = new Discord.MessageEmbed()
|
||||||
|
.setColor(help.randomColor())
|
||||||
|
.addField('MOO', `Sent by ${msg.author}\nmooved ${message.author}`);
|
||||||
|
if (msg.content.includes('http')) {
|
||||||
|
const file = new MessageAttachment(msg.content);
|
||||||
|
client.channels.cache.get(mentionedChannelId).send({
|
||||||
|
embeds: [embed], files: [file] });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
embed.addField('Message:', msg.content);
|
||||||
|
client.channels.cache.get(mentionedChannelId).send({
|
||||||
|
embeds: [embed] });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setTimeout(() => msg.delete(), 3000);
|
||||||
|
});
|
||||||
|
setTimeout(() => message.delete(), 3000);
|
||||||
|
}
|
53
main.js
53
main.js
|
@ -48,6 +48,7 @@ const help = require('./helpFunctions.js');
|
||||||
const resp = require('./responses.js');
|
const resp = require('./responses.js');
|
||||||
const bModel = require('./database/birthdaySchema');
|
const bModel = require('./database/birthdaySchema');
|
||||||
const eModel = require('./database/eventSchema');
|
const eModel = require('./database/eventSchema');
|
||||||
|
const { moveMessage } = require('./helpFunctions.js');
|
||||||
|
|
||||||
const turnOnMsg = ['AAAAAAAAAAAAA', 'Just turned on!', 'Just woke up!', 'May have crashed... sowwyyy >.<',
|
const turnOnMsg = ['AAAAAAAAAAAAA', 'Just turned on!', 'Just woke up!', 'May have crashed... sowwyyy >.<',
|
||||||
'Heyyyy!', 'I\'m baaaack', 'Whom\'st have summoned they ancient one?'];
|
'Heyyyy!', 'I\'m baaaack', 'Whom\'st have summoned they ancient one?'];
|
||||||
|
@ -88,7 +89,7 @@ function gotMessage(message) {
|
||||||
(message.content.includes('webm') ||
|
(message.content.includes('webm') ||
|
||||||
message.content.includes('mov') ||
|
message.content.includes('mov') ||
|
||||||
message.content.includes('mp4') ||
|
message.content.includes('mp4') ||
|
||||||
message?.embeds[0]?.type == 'video')) {
|
message.embeds[0]?.type == 'video')) {
|
||||||
const linkArr = message.content.split('https://media.discordapp.net');
|
const linkArr = message.content.split('https://media.discordapp.net');
|
||||||
message.channel.send('https://cdn.discordapp.com' + linkArr[1]);
|
message.channel.send('https://cdn.discordapp.com' + linkArr[1]);
|
||||||
}
|
}
|
||||||
|
@ -115,7 +116,7 @@ function gotMessage(message) {
|
||||||
|
|
||||||
if (message.reference != null && msgContentSplit.length == 1 &&
|
if (message.reference != null && msgContentSplit.length == 1 &&
|
||||||
message.mentions.channels.first() != undefined) {
|
message.mentions.channels.first() != undefined) {
|
||||||
move(message, msgContentSplit[0]);
|
moveMessage(message, msgContentSplit[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const isBot = message.author.bot;
|
const isBot = message.author.bot;
|
||||||
|
@ -133,54 +134,6 @@ function gotMessage(message) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function move(message, channelId) {
|
|
||||||
message.react('🐮');
|
|
||||||
|
|
||||||
const replyChannel = message.channel;
|
|
||||||
|
|
||||||
const msgToMooveId = message.reference.messageId;
|
|
||||||
|
|
||||||
const mentionedChannelId = channelId.substring(2, channelId.length - 1);
|
|
||||||
|
|
||||||
replyChannel.messages.fetch(msgToMooveId).then(msg => {
|
|
||||||
if (msg.attachments.size > 0) {
|
|
||||||
const newMsgAttachments = [];
|
|
||||||
const allAttachments = msg.attachments.values();
|
|
||||||
|
|
||||||
for (let i = 0; i < msg.attachments.size; i++) {
|
|
||||||
const currAttachment = allAttachments.next().value;
|
|
||||||
newMsgAttachments.push(new MessageAttachment(currAttachment.url));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (msg.embeds.length > 0) {
|
|
||||||
client.channels.cache.get(mentionedChannelId)
|
|
||||||
.send({ content: `Sent by ${msg.author}\nmooved ${message.author}`, embeds: msg.embeds, files: newMsgAttachments });
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
client.channels.cache.get(mentionedChannelId)
|
|
||||||
.send({ content: `Sent by ${msg.author}\nmooved ${message.author}`, files: newMsgAttachments });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
const embed = new Discord.MessageEmbed()
|
|
||||||
.setColor(help.randomColor())
|
|
||||||
.addField('MOO', `Sent by ${msg.author}\nmooved ${message.author}`);
|
|
||||||
if (msg.content.includes('http')) {
|
|
||||||
const file = new MessageAttachment(msg.content);
|
|
||||||
client.channels.cache.get(mentionedChannelId).send({
|
|
||||||
embeds: [embed], files: [file] });
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
embed.addField('Message:', msg.content);
|
|
||||||
client.channels.cache.get(mentionedChannelId).send({
|
|
||||||
embeds: [embed] });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setTimeout(() => msg.delete(), 3000);
|
|
||||||
});
|
|
||||||
setTimeout(() => message.delete(), 3000);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function pingEvent() {
|
async function pingEvent() {
|
||||||
const currentDay = new Date().getDate();
|
const currentDay = new Date().getDate();
|
||||||
const currentMonth = new Date().getMonth() + 1;
|
const currentMonth = new Date().getMonth() + 1;
|
||||||
|
|
Loading…
Reference in a new issue