diff --git a/src/bot.js b/src/bot.js
index 36ec6af..1418d87 100644
--- a/src/bot.js
+++ b/src/bot.js
@@ -61,6 +61,7 @@ client.on(Events.Ready, () => {
try {
await client.login(token);
+ // await db.check_connection();
console.log('Gateway connected');
} catch (err) {
console.error('Login failed:', err);
diff --git a/src/helpers/memberHelper.js b/src/helpers/memberHelper.js
index f9d3ada..3a0d596 100644
--- a/src/helpers/memberHelper.js
+++ b/src/helpers/memberHelper.js
@@ -208,7 +208,7 @@ mh.checkImageFormatValidity = async function(imageUrl) {
if (blobFile.size > 1000000 || !acceptableImages.includes(blobFile.type)) throw new Error(enums.err.PROPIC_FAILS_REQUIREMENTS);
return true;
}).catch((error) => {
- throw new Error(`${enums.err.PROPIC_CANNOT_LOAD}: ${error.message}`);
+ throw new Error(`${enums.err.PROPIC_CANNOT_LOAD}: ${error.message}, ${error.cause}`);
});
}
@@ -249,7 +249,7 @@ mh.removeMember = async function(authorId, args) {
* @throws {Error | RangeError} When the member already exists, there are validation errors, or adding a member doesn't work.
*/
mh.addFullMember = async function(authorId, memberName, displayName = null, proxy = null, propic= null) {
- const member = await mh.getMemberByName(authorId, memberName).catch((e) =>{console.log("Now we can add the member.")});
+ const member = await mh.getMemberByName(authorId, memberName).catch(() =>{console.log("Now we can add the member.")});
if (member) {
throw new Error(`Can't add ${memberName}. ${enums.err.MEMBER_EXISTS}`);
}
@@ -263,10 +263,7 @@ mh.addFullMember = async function(authorId, memberName, displayName = null, prox
await mh.checkIfProxyExists(authorId, proxy).catch((e) =>{throw e});
}
if (propic) {
- const isValidImage = await mh.checkImageFormatValidity(img).catch((e) =>{throw e});
- if (isValidImage) {
- return await mh.updateMemberField(authorId, updatedArgs).catch((e) =>{throw e});
- }
+ await mh.checkImageFormatValidity(propic).catch((e) =>{throw e});
}
return await db.members.create({
@@ -300,7 +297,7 @@ mh.updateMemberField = async function(authorId, args) {
fluxerPropicWarning = mh.setExpirationWarning(args[3]);
}
return await db.members.update({[columnName]: value}, { where: { name: memberName, userid: authorId } }).then(() => {
- return `Updated ${columnName} for ${memberName} to "${value}"${fluxerPropicWarning ?? ''}.`;
+ return `Updated ${columnName} for ${memberName} to ${value}${fluxerPropicWarning ?? ''}.`;
}).catch(e => {
if (e === EmptyResultError) {
throw new EmptyResultError(`Can't update ${memberName}. ${enums.err.NO_MEMBER}: ${e.message}`);
@@ -321,7 +318,7 @@ mh.setExpirationWarning = function(expirationString) {
let expirationDate = new Date(expirationString);
if (!isNaN(expirationDate.valueOf())) {
expirationDate = expirationDate.toDateString();
- return `\n**NOTE:** Because this profile picture was uploaded via Fluxer, it will currently expire on *${expirationDate}*. To avoid this, upload the picture to another website like and link to it directly.`
+ return `\n**NOTE:** Because this profile picture was uploaded via Fluxer, it will currently expire on *${expirationDate}*. To avoid this, upload the picture to another website like and link to it directly`
}
}
diff --git a/src/import.js b/src/import.js
index d60af6e..1f05522 100644
--- a/src/import.js
+++ b/src/import.js
@@ -22,9 +22,7 @@ ih.pluralKitImport = async function (authorId, attachmentUrl) {
const addedMembers = [];
for (let pkMember of pkMembers) {
const proxy = pkMember.proxy_tags[0] ? `${pkMember.proxy_tags[0].prefix ?? ''}text${pkMember.proxy_tags[0].suffix ?? ''}` : null;
-
- // can't add profile pic until i figure out how to convert webp
- await memberHelper.addFullMember(authorId, pkMember.name, pkMember.display_name, proxy).then((member) => {
+ await memberHelper.addFullMember(authorId, pkMember.name, pkMember.display_name, proxy, pkMember.avatar_url).then((member) => {
addedMembers.push(member.name);
}).catch(e => {
errors.push(`${pkMember.name}: ${e.message}`);