mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-11 02:16:23 +00:00
Use helper function in replacement
This commit is contained in:
parent
8cd00a3c05
commit
a4d91fb739
1 changed files with 5 additions and 2 deletions
|
@ -28,12 +28,15 @@ export default definePlugin({
|
||||||
find: "=\"SYSTEM_TAG\"",
|
find: "=\"SYSTEM_TAG\"",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=className:\i\.username,style:.{0,50}:void 0,)/,
|
match: /(?<=className:\i\.username,style:.{0,50}:void 0,)/,
|
||||||
replace: "style:{color:$self.calculateNameColor(BigInt(arguments[0].message.author.id))}"
|
replace: "style:{color:$self.calculateNameColorForContext(arguments[0])}"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
// Calculate a CSS color string based on the user ID
|
// Calculate a CSS color string based on the user ID
|
||||||
calculateNameColor(id: bigint) {
|
calculateNameColorForContext(context: any) {
|
||||||
|
return this.calculateNameColorForUser(BigInt(context.message.author.id));
|
||||||
|
},
|
||||||
|
calculateNameColorForUser(id: bigint) {
|
||||||
// Compute a 64-bit FNV-1a hash of the passed data
|
// Compute a 64-bit FNV-1a hash of the passed data
|
||||||
function hash(data: ArrayBuffer) {
|
function hash(data: ArrayBuffer) {
|
||||||
const fnvPrime = 1099511628211n;
|
const fnvPrime = 1099511628211n;
|
||||||
|
|
Loading…
Reference in a new issue