Please help me :(

I would like it to generate code like this “6e4z-be4A-h62m” here is my code:

const Discord = require(‘discord.js’);
const client = new Discord.Client();

client.on(‘ready’, () => {
console.log(Started bot ${client.user.tag}!);
});

client.on(‘message’, message => {
if (message.content === ‘gift’) {
message.reply(‘Generating gift links…’);
setInterval(function() {
var links = ;
for (x = 0; x < 1; x++) {
var used = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789”;
var used2 = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789”;
var used3 = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789”;
var link = “-”;
for (var y = 0; y < 4; y++) {
used.charAt(Math.floor(Math.random() * used.length)) + link + used2.charAt(Math.floor(Math.random() * used.length)) + link + used3.charAt(Math.floor(Math.random() * used.length));
}
links.push(link);
}
message.channel.send(links.join(" "));
}, 3600);
}
});

client.login(hide)

the bot sends me its instead:


contacte me:
Ezermoz#5819

Nice attempt, and an interesting method for generating the character strings :slight_smile:

The problem is you’re pushing the separator onto the list instead of the generated string, probably got mixed up with the variable names. Try this to fix the issue:

var separator = "-";
for (var y = 0; y < 4; y++) {
  var link = used.charAt(Math.floor(Math.random() * used.length)) + separator + \
    used2.charAt(Math.floor(Math.random() * used.length)) + separator + \
    used3.charAt(Math.floor(Math.random() * used.length));
  links.push(link);
}

const Discord = require(‘discord.js’);
const client = new Discord.Client();

client.on(‘ready’, () => {
console.log(Started bot ${client.user.tag}!);
});

client.on(‘message’, message => {
if (message.content === ‘gift’) {
message.reply(‘Generating gift links…’);
setInterval(function() {
var links = ;
for (x = 0; x < 1; x++) {
var used = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789”;
var used2 = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789”;
var used3 = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789”;
var link = “-”;
for (var y = 0; y < 4; y++) {
for (var y = 0; y < 4; y++) {
var separator = “-”;
var link = used.charAt(Math.floor(Math.random() * used.length)) + separator +
used2.charAt(Math.floor(Math.random() * used.length)) + separator +
used3.charAt(Math.floor(Math.random() * used.length));
links.push(link);
}
}
message.channel.send(links.join(" "));
}, 3600);
}
});

client.login(Njc1MDE4NjI4MTE4MjE2NzM0.Xj0lWg.T_f49QTmJedcYDA6mRO5aKJBvCo)

its good ?

const Discord = require(‘discord.js’);
const client = new Discord.Client();

client.on(‘ready’, () => {
console.log(Started bot ${client.user.tag}!);
});

client.on(‘message’, message => {
if (message.content === ‘gift’) {
message.reply(‘Generating gift links…’);
setInterval(function() {
var links = ;
for (x = 0; x < 1; x++) {
var used = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789”;
var used2 = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789”;
var used3 = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789”;
var link = “-”;
for (var y = 0; y < 4; y++) {
for (var y = 0; y < 4; y++) {
var separator = “-”;
var link = used.charAt(Math.floor(Math.random() * used.length)) + separator +
used2.charAt(Math.floor(Math.random() * used.length)) + separator +
used3.charAt(Math.floor(Math.random() * used.length));
links.push(link);
}
}
message.channel.send(links.join(" "));
}, 3600);
}
});

client.login(hide)

Its good ?

Continuing the discussion from Please help me :frowning::

const Discord = require(‘discord.js’);
const client = new Discord.Client();

client.on(‘ready’, () => {
console.log(Started bot ${client.user.tag}!);
});

client.on(‘message’, message => {
if (message.content === ‘gift’) {
message.reply(‘Generating gift links…’);
setInterval(function() {
var links = ;
for (x = 0; x < 1; x++) {
var used = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789”;
var used2 = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789”;
var used3 = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789”;
var link = “-”;
for (var y = 0; y < 4; y++) {
for (var y = 0; y < 4; y++) {
var separator = “-”;
var link = used.charAt(Math.floor(Math.random() * used.length)) + separator +
used2.charAt(Math.floor(Math.random() * used.length)) + separator +
used3.charAt(Math.floor(Math.random() * used.length));
links.push(link);
}
}
message.channel.send(links.join(" "));
}, 3600);
}
});

client.login(its good ?)

Hey @Ezermoz,

Have you tried this?

var link = “”
Try removing the - as it could be causing problems

And also

var link = used.charAt(Math.floor(Math.random() * used.length)) + separator +

should be like this as that link is already declared:

link = used.charAt(Math.floor(Math.random() * used.length)) + separator +