Skip to content

Commit

Permalink
Don't clobber accounts during migration by src==dest
Browse files Browse the repository at this point in the history
  • Loading branch information
themrrobert committed Jun 11, 2024
1 parent c5ffb35 commit c9f47ab
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/mahoji/commands/rp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ const itemFilters = [
];

function isProtectedAccount(user: MUser) {
if ([...ADMIN_IDS, ...OWNER_IDS].includes(user.id)) return true;
const botAccounts = ['303730326692429825', '729244028989603850', '969542224058654790'];
if ([...ADMIN_IDS, ...OWNER_IDS, ...botAccounts].includes(user.id)) return true;
if ([BitField.isModerator, BitField.isContributor].some(bf => user.bitfield.includes(bf))) return true;
return false;
}
Expand Down Expand Up @@ -809,7 +810,12 @@ ORDER BY item_id ASC;`);
if (!isOwner && !isAdmin) {
return randArrItem(gifs);
}

const { source, dest, reason } = options.player.migrate_user;

if (source.user.id === dest.user.id) {
return 'Destination cannot be the same as the source!';
}
const sourceUser = await mUserFetch(source.user.id);
const destUser = await mUserFetch(dest.user.id);

Expand Down

0 comments on commit c9f47ab

Please sign in to comment.