From 774cef3c23ef697fdb6f2052f062c2acd781c1c4 Mon Sep 17 00:00:00 2001 From: nolan Date: Thu, 10 Jun 2021 23:03:32 -0700 Subject: [PATCH] Apparently RegExp creation in the file only works 1/2 of the time? Somebody explain this fuckery. --- structure/moderation/infractions/Nickname.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/structure/moderation/infractions/Nickname.js b/structure/moderation/infractions/Nickname.js index b39e57e..9e804e9 100644 --- a/structure/moderation/infractions/Nickname.js +++ b/structure/moderation/infractions/Nickname.js @@ -8,8 +8,6 @@ const Constants = { RandomNames: ["Ashly Armistead", "Jenifer James", "Eleonora Espinosa", "Eleanore Ellerbee", "Marguerite Means", "Lore Lazar", "Cherilyn Calero", "Olevia Olvera", "Herman Horvat", "Elvin Elfrink", "Jennine Julian", "Pei Plude", "Kenisha Kirts", "Sherly Starbird", "Lashanda Louder", "Elizabeth Eakle", "Lyda Leard", "Penelope Petri", "Kimi Kissel", "Crista Crowe", "Mallory Mehta", "Bettina Bregman", "Marcie Moran", "James Jiles", "Clifton Capshaw", "Cher Curlee", "Brigid Bonier", "Lana Lehman", "Carletta Chalker", "Valene Viator", "Eugena Eder", "Samatha Shivers", "Hoyt Hard", "Karena King", "Tiffani Trott", "Joye Jeremiah", "Emely Espino", "Rowena Rowan", "Gillian Godbey", "Hailey Huggard", "Lillian Lander", "Shani Szabo", "Liberty Lamorte", "Tomika Thrift", "Garrett Grogan", "Vallie Valazquez", "Shin Secor", "Deangelo Divito", "Kacy Kimball", "Norris Northway", "Evelia Ernest", "Horacio Huey", "Christen Cyr", "Jada Janus", "Vanita Valero", "Abdul Addario", "Daniell Dingle", "Tangela Trull", "Jeanmarie Jimenez", "Georgia Gourlay", "Valery Vergara", "Chasidy Conrad", "Marlena Malin", "Kristeen Kesselman", "Jo Jeffries", "Terina Tworek", "Geri Gilbert", "Phuong Pratte", "Juanita Jess", "Audrea Ammon", "Shakita Stalter", "Rosamond Reese", "Shani Solorio", "Archie Augustyn", "Bridgett Behrman", "Susann Schmaltz", "Edgardo Engman", "Valerie Vice", "Cheyenne Claeys", "Kristina Kastner", "Lanita Labrum", "Kai Knick", "Lucien Lee", "Tameika Turley", "Octavia Obermiller", "Kia Kravitz", "Justina Jury", "Cortney Coppa", "Johnathan Joshi", "Arden Alphin", "Francis Feinberg", "Sal Suits", "Myles Marden", "Emmitt Engelmann", "Tara Tibbits", "Su Sprowl", "Isadora Ingrassia", "Janell Jarrard", "Kenyatta Kenley", "Mabelle Mccrady"] }; -const Regex = new RegExp(`(^(?:${Constants.Characters.map((c) => escapeRegex(c)).join('|')}*)*)(.*)`, 'gui'); - class NicknameInfraction extends Infraction { constructor(client, opts = {}) { @@ -38,10 +36,9 @@ class NicknameInfraction extends Infraction { this.data.oldName = this.member.nickname || this.member.user.username; if(dehoist) { - console.log(Regex); - console.log(this.data.oldName); + const Regex = new RegExp(`(^(?:${Constants.Characters.map((c) => escapeRegex(c)).join('|')}*)*)(.*)`, 'gui'); + const [, removed, fixed] = Regex.exec(this.data.oldName); - console.log("Succeeded"); if(!removed) return this._fail('C_NICKNAME_NOCHARACTERS'); if(fixed) { this.data.name = fixed;