Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

208
Views
Multiple Prefix Discord.js

How to use multi prefix in this code? I have tried various ways but nothing works.

let prefix = [ 'e', 'E' ];
        if (message.guild) {
            client.prefixes.ensure(message.guild.id, { prefix: 'e' });
            let guildPrefix = client.prefixes.get(message.guild.id, "e");

            prefix = guildPrefix ? guildPrefix : 'e';
        }   
        
        if(!(message.content.startsWith(prefix[0])||message.content.startsWith(prefix[1]))) { return; }

        const args = message.content.slice(prefix.length).trim().split(/ +/);

This is the code, its not work, i dont know why? can u help me guys? i use discord.js v13

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

if(!(message.content.startsWith(prefix[0])||message.content.startsWith(prefix[1]))) { return; }

It will not start with an array, so you have to split the condition. However there might be a more elegant solution to this.

Edit: The elegant solution is in the comments.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!