mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 09:31:20 -04:00
here goes nothin'
This commit is contained in:
@@ -14,7 +14,7 @@ function createDeterCommand({ listDeterredUsers, listVerifiedUsers, deterUser, u
|
||||
if (action === 'list') {
|
||||
const users = listDeterredUsers();
|
||||
if (!users.length) return message.reply({ content: 'No deterred users.', allowedMentions: { parse: [], repliedUser: false } });
|
||||
const lines = users.map((entry, idx) => `${idx + 1}. ${entry.id} | ${entry.nickname || 'unknown'} | ${mask(entry.cookieUserId)}`);
|
||||
const lines = users.map((entry, idx) => `${idx + 1}. ${entry.userId || entry.id} | ${entry.nickname || 'unknown'} | ${mask(entry.cookieUserId)}`);
|
||||
return message.reply({ content: ['Deterred users:', ...lines].join('\n').slice(0, 1900), allowedMentions: { parse: [], repliedUser: false } });
|
||||
}
|
||||
if (action === 'ban') {
|
||||
@@ -28,7 +28,7 @@ function createDeterCommand({ listDeterredUsers, listVerifiedUsers, deterUser, u
|
||||
// Ban reasons were deliberately removed from the command grammar. The
|
||||
// full remaining text is now always the selector, which lets lockdown
|
||||
// admins deter multi-word nicknames without quoting or delimiter rules.
|
||||
const stableSelector = verifiedMatch.record?.cookieUserId || selector;
|
||||
const stableSelector = verifiedMatch.record?.userId || verifiedMatch.record?.id || verifiedMatch.record?.cookieUserId || selector;
|
||||
const deterred = deterUser(stableSelector, { actor: message.author?.id || null });
|
||||
return message.reply({ content: sanitizeMentions(`${deterred.created ? 'Deterred' : 'Updated deterrence for'} ${deterred.nickname || 'unknown'} (${mask(deterred.cookieUserId)}).`), allowedMentions: { parse: [], repliedUser: false } });
|
||||
} catch (err) {
|
||||
|
||||
@@ -89,19 +89,25 @@ function resolveRoverSelector(selector, rovers) {
|
||||
function createIdentityCandidates(records = [], { includeId = true } = {}) {
|
||||
return (Array.isArray(records) ? records : []).map((record) => {
|
||||
const id = normalizeText(record?.id);
|
||||
const userId = normalizeText(record?.userId);
|
||||
const cookieUserId = normalizeText(record?.cookieUserId);
|
||||
const fingerprintId = normalizeText(record?.fingerprintId);
|
||||
const nickname = normalizeText(record?.nickname);
|
||||
const knownIps = Array.isArray(record?.knownIps) ? record.knownIps.map(normalizeText).filter(Boolean) : [];
|
||||
return {
|
||||
key: id || cookieUserId || nickname,
|
||||
key: userId || id || cookieUserId || fingerprintId || nickname,
|
||||
id,
|
||||
userId,
|
||||
cookieUserId,
|
||||
fingerprintId,
|
||||
nickname,
|
||||
knownIps,
|
||||
label: compactJoin([nickname || 'unknown', includeId && id ? id : '', cookieUserId ? mask(cookieUserId) : '']),
|
||||
label: compactJoin([nickname || 'unknown', includeId && (userId || id) ? (userId || id) : '', cookieUserId ? mask(cookieUserId) : '']),
|
||||
record,
|
||||
searchId: normalizeSearchText(id),
|
||||
searchUserId: normalizeSearchText(userId),
|
||||
searchCookie: normalizeSearchText(cookieUserId),
|
||||
searchFingerprint: normalizeSearchText(fingerprintId),
|
||||
searchNickname: normalizeSearchText(nickname),
|
||||
searchIps: knownIps.map(normalizeSearchText),
|
||||
};
|
||||
@@ -118,7 +124,9 @@ function resolveIdentitySelector(selector, records = [], options = {}) {
|
||||
|
||||
const exact = candidates.filter((entry) => (
|
||||
entry.searchId === normalized ||
|
||||
entry.searchUserId === normalized ||
|
||||
entry.searchCookie === normalized ||
|
||||
entry.searchFingerprint === normalized ||
|
||||
entry.searchNickname === normalized ||
|
||||
(ip && entry.searchIps.includes(normalizeSearchText(ip)))
|
||||
));
|
||||
@@ -132,6 +140,7 @@ function resolveIdentitySelector(selector, records = [], options = {}) {
|
||||
keys: [
|
||||
{ name: 'nickname', weight: 0.78 },
|
||||
{ name: 'cookieUserId', weight: 0.12 },
|
||||
{ name: 'fingerprintId', weight: 0.08 },
|
||||
{ name: 'id', weight: 0.08 },
|
||||
{ name: 'knownIps', weight: 0.02 },
|
||||
],
|
||||
|
||||
@@ -13,7 +13,7 @@ function createVerifyCommand({ listVerifiedUsers, removeVerifiedUser, isLockdown
|
||||
if (action === 'list') {
|
||||
const users = listVerifiedUsers();
|
||||
if (!users.length) return message.reply({ content: 'No verified users.', allowedMentions: { parse: [], repliedUser: false } });
|
||||
const lines = users.map((entry, idx) => `${idx + 1}. ${entry.nickname || 'unknown'} | ${mask(entry.cookieUserId)}`);
|
||||
const lines = users.map((entry, idx) => `${idx + 1}. ${entry.nickname || 'unknown'} | ${entry.userId || entry.id} | ${mask(entry.cookieUserId)}`);
|
||||
return message.reply({ content: ['Verified users:', ...lines].join('\n').slice(0, 1900), allowedMentions: { parse: [], repliedUser: false } });
|
||||
}
|
||||
if (action === 'remove') {
|
||||
@@ -26,7 +26,7 @@ function createVerifyCommand({ listVerifiedUsers, removeVerifiedUser, isLockdown
|
||||
// The command resolver only turns a human-friendly or fuzzy nickname
|
||||
// into the stable cookie id so the service does not need Discord/Web
|
||||
// command concerns baked into its storage API.
|
||||
const removed = removeVerifiedUser(resolved.record.cookieUserId, message.author?.id || null);
|
||||
const removed = removeVerifiedUser(resolved.record.userId || resolved.record.id || resolved.record.cookieUserId, message.author?.id || null);
|
||||
return message.reply({ content: `Removed verified user ${sanitizeMentions(removed.nickname || 'unknown')} (${mask(removed.cookieUserId)}).`, allowedMentions: { parse: [], repliedUser: false } });
|
||||
} catch (err) {
|
||||
return message.reply({ content: sanitizeMentions(`Failed to remove verified user: ${err.message}`), allowedMentions: { parse: [], repliedUser: false } });
|
||||
|
||||
Reference in New Issue
Block a user