Compare commits

...

10 Commits

Author SHA1 Message Date
Lamp f6c71c94bd
disable broken bot sort 2019-10-12 16:51:57 -07:00
Lamp 2be4884dc9
fojat 2019-10-12 16:22:36 -07:00
Lamp 3e0052a87a
fix d2r avatar 2019-10-08 18:20:27 -07:00
Lamp f6177a853e port richembed support for discord2rocket 2019-10-08 18:02:04 -07:00
Lamp a1aab3e89c sdfsfjdjsfghadga 2019-10-08 16:57:18 -07:00
Lamp 894fda7ae3 AAAAAAAAAAAA 2019-10-08 16:56:19 -07:00
Lamp 2e9d838995 fof 2019-10-08 16:53:47 -07:00
Lamp 2607e5e3ad ofo port d.jsv11 code to v12 2019-10-08 16:45:21 -07:00
Lamp f24dbd5e57 fojac 2019-10-08 16:43:24 -07:00
Lamp 3de31864c3 gha, Array.prototype.random broke node-rest-client
TypeError: props[propIndex].split is not a function
https://github.com/aacerox/node-rest-client/issues/154
2019-10-08 16:35:47 -07:00
6 changed files with 36 additions and 25 deletions

View File

@ -139,10 +139,10 @@ commands.color = {
var role = colorRoles.findColorRole(message.member); var role = colorRoles.findColorRole(message.member);
if (!role) { if (!role) {
if (message.member.presence.status == "offline") if (message.member.presence.status == "offline")
return message.reply([ return message.reply(random([
"You are offline.", "You are offline.",
"I can't change your color when you're invisible." "I can't change your color when you're invisible."
].random()); ]));
else { else {
await colorRoles.update(message.member); await colorRoles.update(message.member);
role = colorRoles.findColorRole(message.member); role = colorRoles.findColorRole(message.member);
@ -169,10 +169,10 @@ commands.title = {
var role = colorRoles.findColorRole(message.member); var role = colorRoles.findColorRole(message.member);
if (!role) { if (!role) {
if (message.member.presence.status == "offline") if (message.member.presence.status == "offline")
return message.reply([ return message.reply(random([
"You are offline.", "You are offline.",
"I can't change your color when you're invisible." "I can't change your color when you're invisible."
].random()); ]));
else { else {
await colorRoles.update(message.member); await colorRoles.update(message.member);
role = colorRoles.findColorRole(message.member); role = colorRoles.findColorRole(message.member);

View File

@ -141,10 +141,10 @@ dClient.on('local_message', async message => {
(res) => { (res) => {
switch (res) { switch (res) {
case "ENOTBRIDGE": case "ENOTBRIDGE":
message.channel.send([ message.channel.send(random([
`This is not a bridged channel.`, `This is not a bridged channel.`,
`You can only use this command in a bridged channel.` `You can only use this command in a bridged channel.`
].random()); ]));
break; break;
case "EBADUSG": case "EBADUSG":
message.channel.send(`**Usage:** \`!${commandName} ${command.usage}\``); message.channel.send(`**Usage:** \`!${commandName} ${command.usage}\``);

View File

@ -48,9 +48,9 @@
}*/// didn't work D: }*/// didn't work D:
// arrange bots at bottom of list /*// arrange bots at bottom of list
(async function(){ (async function(){
let prefix = "\udb40\uddf0"; let prefix = "\udb40\uddf0";//TODO find new chars that aren't filtered
let onNick = async member => { let onNick = async member => {
if (member.user.bot && !member.displayName.startsWith(prefix)) if (member.user.bot && !member.displayName.startsWith(prefix))
await member.setNickname(`${prefix}${member.displayName}`.substr(0,32)); await member.setNickname(`${prefix}${member.displayName}`.substr(0,32));
@ -59,7 +59,7 @@
dClient.on('local_guildMemberUpdate', async (oldMember, newMember) => { dClient.on('local_guildMemberUpdate', async (oldMember, newMember) => {
if (newMember.displayName != oldMember.displayName) await onNick(newMember); if (newMember.displayName != oldMember.displayName) await onNick(newMember);
}); });
})(); })();*/
// prevent identical display names // prevent identical display names

View File

@ -74,13 +74,11 @@ global.createMPPbridge = function createMPPbridge(room, DiscordChannelID, site =
gClient.on('hi', ()=>{ gClient.on('hi', ()=>{
console.log(`[${site}][${room}] Received greeting`); console.log(`[${site}][${room}] Received greeting`);
if (!testmode) { if (!testmode) {
/*if (site == "MPP") { if (site == "MPP" && room == "lobby") {
if (room != "lobby") {
gClient.sendArray([{m: "userset", set: {name: "Anonymous" }}]); gClient.sendArray([{m: "userset", set: {name: "Anonymous" }}]);
} } else {
} else {*/
gClient.sendArray([{m: "userset", set: {name: config.mppname }}]); gClient.sendArray([{m: "userset", set: {name: config.mppname }}]);
//} }
} }
gClient.sendArray([{m:'m',x:Math.floor(Math.random()*100),y:Math.floor(Math.random()*100)}]) gClient.sendArray([{m:'m',x:Math.floor(Math.random()*100),y:Math.floor(Math.random()*100)}])
}); });

View File

@ -24,16 +24,28 @@
rcmsg.rid = rid; rcmsg.rid = rid;
rcmsg.msg = message.cleanContent; rcmsg.msg = message.cleanContent;
rcmsg.alias = message.member && message.member.displayName || message.author.username; rcmsg.alias = message.member && message.member.displayName || message.author.username;
rcmsg.avatar = message.author.avatarURL || message.author.defaultAvatarURL; rcmsg.avatar = message.author.avatarURL({size:64}) || message.author.defaultAvatarURL;
rcmsg.attachments = message.attachments.map(attachment => ({ rcmsg.attachments = message.attachments.array().map(attachment => ({
title: attachment.filename, title: attachment.filename,
title_link: attachment.url, title_link: attachment.url,
title_link_download: true, title_link_download: true,
image_url: attachment.width ? attachment.url : undefined, image_url: attachment.width ? attachment.url : undefined,
audio_url: [".ogg", ".mp3", ".wav", ".flac"].some(ext=>attachment.filename.endsWith(ext)) ? attachment.url : undefined, audio_url: [".ogg", ".mp3", ".wav", ".flac"].some(ext=>attachment.name.endsWith(ext)) ? attachment.url : undefined,
video_url: [".mp4", ".webm", ".mov", ".avi"].some(ext=>attachment.filename.endsWith(ext)) ? attachment.url : undefined video_url: [".mp4", ".webm", ".mov", ".avi"].some(ext=>attachment.name.endsWith(ext)) ? attachment.url : undefined
})).concat(message.embeds.map(embed => embed.type == "rich" ? {
})); author_name: embed.author && embed.author.name,
author_link: embed.author && embed.author.url,
author_icon: embed.author && embed.author.iconURL,
title: embed.title,
title_link: embed.url,
title_link_download: false,
color: embed.hexColor,
text: embed.description,
image_url: embed.image && embed.image.url,
thumb_url: embed.thumbnail && embed.thumbnail.url,
fields: embed.fields && embed.fields.map(f => ({title: f.name, value: f.value, short: f.inline})),
ts: embed.timestamp
} : undefined)).filter(x=>x);
message.rcmsg = await driver.sendMessage(rcmsg); message.rcmsg = await driver.sendMessage(rcmsg);
}); });
dClient.on("local_messageUpdate", async function (oldMessage, newMessage) { dClient.on("local_messageUpdate", async function (oldMessage, newMessage) {
@ -64,7 +76,8 @@
else receivedRcMsgIDs.push(m._id); else receivedRcMsgIDs.push(m._id);
if (m.u._id == driver.userId) return; if (m.u._id == driver.userId) return;
if (!m.mentions && !m.channels) return; if (!m.mentions && !m.channels) return;
for (var dcid in channelIdMap) if (channelIdMap[did] == m.rid) break; // hhh var dcid;
for (let x in channelIdMap) if (channelIdMap[x] == m.rid) dcid = x;
if (!dcid) return; if (!dcid) return;
var dc = dClient.channels.get(dcid); var dc = dClient.channels.get(dcid);
if (!dc.wh) { if (!dc.wh) {

View File

@ -1,6 +1,6 @@
Array.prototype.random = function () { global.random = function (array) {
return this[Math.floor(Math.random() * this.length)] return array[Math.floor(Math.random() * array.length)]
} }
global.sanitizeName = function sanitizeName(str){ // for showing names in discord global.sanitizeName = function sanitizeName(str){ // for showing names in discord