#development
1 messages · Page 1272 of 1
okay uhh
i've disabled firewall completely
2020-09-26T07:59:44.223157+00:00 heroku[Worker.1]: State changed from starting to up
2020-09-26T07:59:44.232223+00:00 heroku[Worker.1]: Idling
2020-09-26T07:59:44.233776+00:00 heroku[Worker.1]: State changed from up to down
2020-09-26T07:59:44.241646+00:00 heroku[Worker.1]: Idling because quota is exhausted
2020-09-26T07:59:50.347134+00:00 app[Worker.1]: Error waiting for network: Resource temporarily unavailable
Hello ! anyone know how to get the id of the user who invited the bot to the GuildCreate Event?
How can i remove this ?
let channel = client.channels.cache.find((x) => (x.id === "753232862375051384"))
channel.join();
bot.user.setPresence({ activity: { name: 'Đ I Ξ 丶 H O M Ξ T O W N:tm: ', type: "PLAYING" }, status: 'dnd' })
console.log(`${bot.user.tag} music is setup `)
)```
By learning js syntax
Learn JS syntax will solve your problem.
pls help
also that’s glitch
@astral yoke idk maybe ask in discord.js server for help this is the first time i am seeing an error like this
hey if someone votes for my server on top.gg how can i make it so they automatically get a voter role?
hey if someone votes for my server on top.gg how can i make it so they automatically get a voter role?
@peak anchor goto the server edit page and scroll down
there should be smth to select the role which DSL will give to people
@earnest phoenix ok ty
client.on('message', message=> {
const args = ' ' + message.content.slice(prefix.length).replace(/^tweet/, '').trim()
queueMessageText= ('**A new tweet has been posted by you: **')
queueMessageText += ' ' + message.content.slice(prefix.length).replace(/^tweet/, '').trim()
if (message.content.startsWith(prefix + 'tweet')){
if (message.channel.id == '734123034243367002'){
T.post('statuses/update', { status: args }, function(err, data, response) {
console.log(data)
message.channel.send(queueMessageText)
}
``` how i automate this command to send every 5 minutes.
it worked ty
anyone recommend the best way to be able to toggle features/commands of a bot per server
like for example disabling the help command in a server
a database
bruh
i have a database
just
would you just store like one schema per server
and have each command on there
then set the command availability or whatever u wanna call it to a bool, and in ur code before running the command, check if the command is disabled or not
np
thanks @earnest phoenix !!
hmm i have encountered some problems tho:
return this.request('POST', path, params, callback)
^
TypeError: this.request is not a function
const args1 = ' ' + message.content.slice(prefix.length).replace(/^autopost/, '').trim()
queueMessageText= ('**The twitter autopost has been set to: **')
queueMessageText += ' ' + message.content.slice(prefix.length).replace(/^autopost/, '').trim()
if (message.content.startsWith(prefix + 'autopost')){
if (message.channel.id == '734123034243367002'){
setInterval(T.post, 20000)
T.post('statuses/update', { status: args1 }, function(err, data, response) {
console.log(data)
message.channel.send(queueMessageText)
}
)```
hey how i keep my bot 24/7 in online please anyone help
my code
hey how i keep my bot 24/7 in online please anyone help
@narrow cloak with a server
hey how i keep my bot 24/7 in online please anyone help
@narrow cloak you can run it on a vps using pm2 or on heroku for free.
@narrow cloak with a server
@misty sigil yes i want to keep my own bot online i have coded also
well look at a youtube tutorial
what is this.requst @eternal osprey
but when i run it seems online after it again go to offline
show ur constructor
it's in the twit package
wait
Twitter.prototype.post = function (path, params, callback) {
return this.request('POST', path, params, callback)
}
it's a npm package for javascript
but when i run it seems online after it again go to offline
@narrow cloak any help please
let channel = bot.channels.cache.find((x) => (x.id === "753232862375051384"))
channel.join();
bot.user.setPresence({ activity: { name: 'Đ I Ξ 丶 H O M Ξ T O W N:tm: ', type: "PLAYING" }, status: 'dnd' })
console.log(`${bot.user.tag} is setup `)
)```
^^^
SyntaxError: missing ) after argument list
at Module._compile (internal/modules/cjs/loader.js:703:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
at internal/main/run_main_module.js:17:11```
idk
o it would intervene
why
you can't tweet the same message 2x on twitter
@digital ibex please help me
idk what ur issue is jeffin
he wants to host his bot 24/7
i already said
find a free cloud server or a vps.
no free hosting
help me please
i coded in visual studio code
buy a vps or use glitch or heroku (i've given up with telling people not to use them)
free hosting is bad
no its not
stan
there is no free vps boi @narrow cloak
it barely has any power
if it is a small project for a small server
it’s probably leaking data around
what's the matter with that?
^^^ SyntaxError: missing ) after argument list at Module._compile (internal/modules/cjs/loader.js:703:23) at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10) at Module.load (internal/modules/cjs/loader.js:628:32) at Function.Module._load (internal/modules/cjs/loader.js:555:12) at Function.Module.runMain (internal/modules/cjs/loader.js:826:10) at internal/main/run_main_module.js:17:11```
you've not used every free hosting service have you?
i do
heroku doessn't spill any info around tho?
uGh
yea but they’ll start charging you if you use too much resources
that’s why they want your card
i have never needed to put in my card lmao
same
let channel = bot.channels.cache.find(x => x.id === "753232862375051384")
You dont need all of them () lol @next flax
also
idk where ur getting this info from, oh yeah. heroku and glitch
you need to put it in for 1000 hours?
does that guy look like he made a super powerful bot?
let channel = bot.channels.cache.find((x) => (x.id === "753232862375051384"))
You didnt need all of these
that needs lots of resources?
who?
prob not
fuck it I give up
bot.channels.cache.get("753232862375051384") 😎
yeah, so free hosting is just okay in this case. Why would you pay for a vps/server for a simple bot you made lmao.
:shrug:
@pale vessel fair enough as well lol
hey the hosting website asking url what do i
c# is cool because you can extend reference types
so you can do something like "753232862375051384".Channel()
granted, ids are ulongs, not strings
@narrow cloak you really have to watch a tutorial on youtube.
@narrow cloak you really have to watch a tutorial on youtube.
@eternal osprey I am using visual studio man
i know
you don't learn by using vs
nvm,


most people who talk in this channel dont really have their own opinions, they just coincidentally have the same opinion as someone with the nitro booster role or certified dev role its just annoying at this point
you have to put those folders (of your bot) on to heroku.
look at their fucking tutorial on yt.
You don’t put folders onto heroku iirc
You don’t put folders onto heroku iirc
@misty sigil why
idk what you do
it’s a git repo
you use the heroku scli
i have always been using git and their cli*
hey boys and girls
how do i randomly choose 4 letters ranging from a-z?
and it changes every time
and a loop
Use it like this
function makeid(length){
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
}
setInterval(T.post, 20000)
T.post('statuses/update', { status: args1 + result }, function(err, data, response) {
console.log(data)
})
```
result is not defined/
Hey I wanna make a random command for a channel I mean that u can choose what welcome channel u want with this command.
const channel = member.guild.channels.cache.find(channel => channel.name === `traffic`);
Or do I need a different code?
have you ever, trying to read what the error said
and think to your self, I should probably define that @eternal osprey
it's outside function scope
var result = ''; and result += characters.charAt(Math.floor(Math.random() * charactersLength));
oowh okay
Hey I wanna make a random command for a channel I mean that u can choose what welcome channel u want with this command.
const channel = member.guild.channels.cache.find(channel => channel.name === `traffic`);Or do I need a different code?
Anyone help?
owh yeah ofc
Please read your code before posting
sorry i just didn't notice.
and get a random element
@earnest phoenix messageArray or Math.floor?
or how do u mean?
Math floor
Since you want a random channel
you can just turn it into an array and pick a random one.
also remove the .find to make it complete random
Hey anyone familiar with canvas constructor? (DJs) how do I change the font, add bold text?
Math floor
@earnest phoenix yes but I want it to like /set welcome channelchannel
@undone carbon Have you tired google or reading their docs?
@autumn aspen could check if it mention a channel
or use that code for channel name and id
@autumn aspen could check if it mention a channel
@earnest phoenix can I send u my command?
I saw registerFont but it's still in alpha and buggy.
Lol
@autumn aspen nah m8
you can try searching djs docs
.mentions check for role, user and channel
@silent cloud ya require them
and exports the run function
Omg how the hell do u people even get your bots running
^
Ez
Lemme guess.. annoying everyone?
Omg how the hell do u people even get your bots running
@earnest phoenix clent.login('token')
oh lmao

Seems legit
@earnest phoenix the only thing that people care for is spoonfeeding
In config.json
@silent cloud my index.js is the big brain can I show u my command handler?
Dont you dare
spoonfeed
We need a rule where we ban spoonfeeders and idiots who dont wanna learn a language before asking for help
nevermind
Dont you dare
@earnest phoenix no not like that lmao
nvm
We need a rule where we ban spoonfeeders and idiots who dont wanna learn a language before asking for help
@earnest phoenix agree
A rule like that would be cool, But maybe not a instant ban
Instant ban pls
you cant kick the owner

you cant kick the owner
@digital ibex it was a joke
changing for (var i in items) to for (var i = 0; i < items.length; i++) doesnt work, i just wanna make it so when i reaches a certain value, the whole for loop stops
return this.request('POST', path, params, callback)
^
TypeError: this.request is not a function```
just use break to get out of the loop
var i of x for element inside it
var i in x for number
Or if(i >= 5) return
setInterval(T.post, 20000)
function makeid(length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
T.post('statuses/update', { status: args1 + result }, function(err, data, response) {
console.log(data)
})
}``` this is my code
from the twit npm package
it post the put-in messages to twitter
Twitter.prototype.post = function (path, params, callback) {
return this.request('POST', path, params, callback)
}
``` this is where the problem comes from
Have u tried googling
i have
you would use classes to extend the twitter prototype not like that
hallo
it just makes it a lil bit easier
owh okay
@silver lintel wdym “doesnt work”
@earnest phoenix when i consoleconsole.log(items[i]), nothing comes up
{
"thing1": {
"stuff": 69
},
"thing2": {
"random": 'poop
}
}
``
fs.readdir("./commands/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
if (!file.endsWith(".js")) return;
let props = require(`./commands/${file}`);
let commandName = file.split(".")[0];
bot.commands.set(commandName, props);
});
});``
Whats wrong, why ...
have you tried reading the error
Yep
and what does it say
bot.commands should be a discord collection from what i can see
@bot.command()
async def dep(ctx, arg: int):
await open_account(ctx.author)
users = await get_bank_data()
user = ctx.message.author
if users[str(user.id)]["wallet"] >= arg:
users[str(user.id)]["wallet"] -= arg
users[str(user.id)]["bank"] += arg
await ctx.send("succesfully transfered the cash")
elif users[str(user.id)]["wallet"] < arg:
await ctx.send("you dont have enough for that")
```why does this not work?
no errors
nothing
can anyone help?
Oh
Pyton
``const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
bot.commands.set(command.name, command);
}
``
Why...
bot.commands isnt a thing maybe
wut
bot.commands isnt a thing maybe
@digital ibex sec
bot.commands = new Discord.Collection();
how do i make an embed^
...
@earnest phoenix https://www.w3schools.com/tags/tag_meta.asp
``bot.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
bot.commands.set(command.name, command);
}
``
Thats all ...
Nah
console.log(bot.commands)
``const Discord = require('discord.js');
const bot = new Discord.Client();
const backup = require("discord-backup");
const { MessageEmbed, MessageAttachment, Collection } = require("discord.js");
const chalk = require("chalk");
const ytdl = require("ytdl-core");
const ffmpeg = require("ffmpeg");
const { TOKEN, PREFIX } = require("./config.json");
prefix = PREFIX;
backup.setStorageFolder(__dirname+"/data/");
bot.login(TOKEN);
const { readdirSync } = require("fs");
const { join } = require("path");
var queue = require("./commands/play.js");
const fs = require("fs");``
pls ```js
code here ```
const Discord = require('discord.js');
const bot = new Discord.Client();
const backup = require("discord-backup");
const { MessageEmbed, MessageAttachment, Collection } = require("discord.js");
const chalk = require("chalk");
const ytdl = require("ytdl-core");
const ffmpeg = require("ffmpeg");
const { TOKEN, PREFIX } = require("./config.json");
prefix = PREFIX;
backup.setStorageFolder(__dirname+"/data/");
bot.login(TOKEN);
const { readdirSync } = require("fs");
const { join } = require("path");
var queue = require("./commands/play.js");
const fs = require("fs");
bot.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
bot.commands.set(command.name, command);
}
Sooooo
const Discord = require('discord.js'); const bot = new Discord.Client(); const backup = require("discord-backup"); const { MessageEmbed, MessageAttachment, Collection } = require("discord.js"); const chalk = require("chalk"); const ytdl = require("ytdl-core"); const ffmpeg = require("ffmpeg"); const { TOKEN, PREFIX } = require("./config.json"); prefix = PREFIX; backup.setStorageFolder(__dirname+"/data/"); bot.login(TOKEN); const { readdirSync } = require("fs"); const { join } = require("path"); var queue = require("./commands/play.js"); const fs = require("fs"); bot.commands = new Discord.Collection(); const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); for (const file of commandFiles) { const command = require(`./commands/${file}`); bot.commands.set(command.name, command); }
@silent cloud .
const bot = new Discord.Client();
const backup = require("discord-backup");
const { MessageEmbed, MessageAttachment, Collection } = require("discord.js");
const chalk = require("chalk");
const ytdl = require("ytdl-core");
const ffmpeg = require("ffmpeg");
const { TOKEN, PREFIX } = require("./config.json");
prefix = PREFIX;
backup.setStorageFolder(__dirname+"/data/");
bot.login(TOKEN);
const { readdirSync } = require("fs");
const { join } = require("path");
var queue = require("./commands/play.js");
const fs = require("fs");
bot.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
bot.commands.set(command.name, command);
}```
Wtf
It cant do ```
i give up
send the code again, it might help
Maybe pastebin?
nah
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Bcs discord can't do it normal
Rip
@digital ibex embed doesn't work
I want it to embed like this
show ur code
<head>
<meta charset="UTF-8">
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="HTML, CSS, JavaScript">
<meta name="author" content="John Doe">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>```
show the code around it
r u using local host or have you got a domain?
I have a domain
send ur website link here
i dont see it
I got rid of it now
https://stackoverflow.com/questions/54266598/meta-tags-for-url-with-description-and-image-in-skype-discord good old stackoverflow
here to save the day
Stan
Can you help me
const bot = new Discord.Client();
const backup = require("discord-backup");
const { MessageEmbed, MessageAttachment, Collection } = require("discord.js");
const chalk = require("chalk");
const ytdl = require("ytdl-core");
const ffmpeg = require("ffmpeg");
const { TOKEN, PREFIX } = require("./config.json");
prefix = PREFIX;
backup.setStorageFolder(__dirname+"/data/");
bot.login(TOKEN);
const { readdirSync } = require("fs");
const { join } = require("path");
var queue = require("./commands/play.js");
const fs = require("fs");
bot.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
bot.commands.set(command.name, command);
}```
send it again, it helps trust me

send it more why dontcha
@bot.command()
async def dep(ctx, arg: int):
await open_account(ctx.author)
users = await get_bank_data()
user = ctx.message.author
ba = users[str(user.id)]["bank"]
wa = users[str(user.id)]["wallet"]
if users[str(user.id)]["wallet"] >= arg:
wa = wa - arg
ba = ba + arg
await ctx.send("succesfully transfered the cash")
elif users[str(user.id)]["wallet"] < arg:
await ctx.send("you dont have enough for that")
```why does this no work?
and can anyone help fix it?
ok
huh
1 sec
@misty sigil you alive
no
have you seen the site
which site
mb
where
dms
Hi everyone

Guys I want to make a edit message thingy but dont know how to do, my code
module.exports.run = async (client, message, args) => {
message.reply(message.author.displayAvatarURL());
}
I have createdTimestamp on my ping command but I want it to have it on this command too
Anyone help? bc I want it to look so smooth asp when its gonna show ur pfp
I get this error for some reason
TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received undefined
Can someone help me?
stan can you also help me
am good
I get this error for some reason
TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received undefined
Can you help me?
seems like a code problem but im no expert
:(
Are you sure the error is from there?
^ thinking that
show us the stack trace pls
@knotty sigil screenshot or copy of stacktrace pls
so we can help you identify the actual issue
events.js:111
throw new ERR_INVALID_ARG_TYPE('listener', 'Function', listener);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received undefined
at checkListener (events.js:111:11)
at _addListener (events.js:348:3)
at Client.addListener (events.js:406:10)
at Object.<anonymous> (C:\Users\j\Documents\GitHub\FakeBot-discord\index.js:283:8)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'ERR_INVALID_ARG_TYPE'
}
nvm i fixed it
i forgot to close a part of the code
const args = message.content.slice(PREFIX.length).trim().split(/ +/g);
const command = args.shift().toLocaleLowerCase();
if(command === 'warn') {
console.log('1');
if(message.member.hasPermission('KICK_MEMBERS')) {
console.log('2');
const Embed = new Discord.MessageEmbed()
.setColor(0xFF009E)
.setTitle('User war warned')
.setDescription(args[1])
.setAuthor(message.author.username)
.setFooter('Discord Bot Created by Phil#0005')
message.channel.send(Embed);
const warned = message.mentions.users.first();
warned.roles.add('758787460468572171');
console.log('3');
}
}
})```
its not outputting an error its just not doing the actions set and won't log the numbers to console
any help would be appreciated
Your source code looks correct. What is PREFIX and how are you writing the command out? Is the event being added at the top scope (aka are you sure the event has been added to the client)
prefix is just '-' so the code takes the first input after '-'
looks wrong
and yes to the second aswell
Do you want to edit the message, add a timestamp, or have it run faster
@thin turret 1st u said
if (receivedMessage.author == client.user || receivedMessage.author.bot || !receivedMessage.content.startsWith(Config.COMMAND_PREFIX)) return;
looks wrong
@unique patio can you point out what looks wrong?
Yeah your prefix don't do it like that
on received message; run this to cancel if it doesn't match your prefix and talks to another bot.
Then!!!
You run command check if it continues
var splitCommand = receivedMessage.content.substr(1).split(/\s+/);
Then you can!
The way they're getting the command and args is not incorrect though.
That's just another way of doing it.
if (typeof PublicCommands[splitCommand[0]] == "function") {
PublicCommands[splitCommand[0]](splitCommand.slice(1), receivedMessage);
}
its the same code as the other commands i use
const args = message.content.slice(PREFIX.length).trim().split(/ +/g);
const command = args.shift().toLocaleLowerCase();
if(command === 'embed') {
if(message.member.hasPermission('ADMINISTRATOR')) {
var inputsstr = args.join(' ');
var inputsarray = inputsstr.split('*');
const Embed = new Discord.MessageEmbed()
.setColor(0xFF009E)
.setTitle(inputsarray[0])
.setDescription(inputsarray[1])
.setAuthor(message.author.username)
.setThumbnail('https://cdn.discordapp.com/attachments/739943623348453386/753265807726739676/57.gif')
.setFooter('Discord Bot Created by Phil#0005')
message.channel.send(Embed);
}
else {
message.channel.send('You do not have permission to use this command')
}
}
if(message.content.startsWith('-embed')) {
message.delete();
}
if(message.content.startsWith('You do not have permission to use this command')) {
setTimeout(() => { message.delete() }, 3000);
}
})```
this is another command in the bot using the same code to seperate it
hmmm
messy
On message run this as a check.
if (receivedMessage.author == client.user || receivedMessage.author.bot || !receivedMessage.content.startsWith(Config.COMMAND_PREFIX)) return;
https://hasteb.in/umexiqel.js nothing happens when run, and testkey1 being said
change config.command_prefix to "!" or w/e you use, then legit just substr(1) and split the co ntent
into array
@tired gate That's not completed code.
Missing lots.
i know, the bottom part is irrelevant
thats why i left that out
no problems in vs code
and it stops working from there on
oh at testkey1?
Does it log the first message at the top (react with <> emoji)?
ooo
nice find
dang thanks man
Was just getting to that
Can i make a command , in which it pulls file from a private github repo?
Not necessarily private unless you have links
@unique patio wdum?
You can XHR/Fetch Github repo's easily
as long as you have a link to them, they are not private to the webs.
🙂
but when it is a private one?
So if you made a repo hid it to yourself only
and used it, sure.
It depends on how private, as in no link can access it must be owner perms, nah. API won't fetch it.
If you can see the private git by link, you can fetch it for your requests.
no its full private
no issues!
You'd need some permissions to fetch it so yeah if it's locked down unlikely without the permissions.
with ssh?
Nah not that sophisticated lol
CTS.Events.XHR.open("GET", "https://api.github.com/gists/c9bad840fb19bf2e6638126c8e430d40");
simple calls like that, wait on response
That's to some dummy-event JSON file.
So yeah just try using the API to fetch the repo's.
const axios = require('axios');
async function GetReq() {
const text = await axios.get(process.env.url);
return text.data;
};
console.log(GetReq())
Why doesn't it work? process.env.url is correct.
log process.env and see if it exists in the object
It does
try it and see
for example you could have a .env file but it's not being loaded, which often a package called dotenv is used to load it.
It works.
My process.env.url exists
Because I'm on my host
even if I replace it with a plain string, it doesnt work.
Just logs nothing, and emits process.exit(1)
plain string as in a string with the URL.
message.channel.send('Please enter you activation key!')
const filterkey = m => m.author.id === message.author.id;
message.channel.awaitMessages(filterkey, { max: 1, time: 180000, errors: ['time'] })
if (collected === 'testkey1') {
if (db.get(`testkey1_redeemed` == undefined || true)) {
message.channel.send('🪄 Success! This server is now **premium**!')
db.set(`testkey1_redeemed`, true)
db.set(`${message.guild}_premium`, true)
} else message.channel.send('That key has already been used. Keys can only be used once.')
}``` what about that isn't working?
So when you logged process.env and looked inside the object you found the key url. Then what is not working about it right now. What is failing with the .get() now
@sudden geyser there's some problem with the return thingy, because if I call the function and do my shits inside the function, it works properly
const axios = require('axios');
async function GetReq() {
const text = await axios.get(process.env.url);
console.log(text.data);
};
GetReq();
This works
But this isn't the way I want to do it
as my "url" is a webhook link which needs fetching.
message.channel.send('Please enter you activation key!')
const filterkey = m => m.author.id === message.author.id;
message.channel.awaitMessages(filterkey, { max: 1, time: 180000, errors: ['time'] })
if (collected === 'testkey1') {
if (db.get(`testkey1_redeemed` == undefined || true)) {
message.channel.send('🪄 Success! This server is now **premium**!')
db.set(`testkey1_redeemed`, true)
db.set(`${message.guild}_premium`, true)
} else message.channel.send('That key has already been used. Keys can only be used once.')
}``` no error, no response
djs, I suppose?
yessir
you might want to use a collector
instead of awaitmessages
Collectors are more efficient
and More easier to handle
ill try that, thanks
wait
@tired gate you arent reffering to the promise in any way.
do the rest of the code in your promise
or a .then statement tbh
TextChannel#awaitMessages uses a promise to check the collected thingies.
@pallid igloo so the work inside the function is working, but outside the function it doesn't work properly? Is it because GetReq returns a promise so you need to either use .then / await?
Lemme check if It is returning a promise.
I'm going to feel very dumb if I find it out
An async function will always return a promise
Ah okay.
how do i get my bot not to reply to other bots
if author is bot stop
the actual syntax depends on your language
but Users have a bot property that defines whether they're a bot, so in JS, you can do if(message.author.bot) return; and boom, the bot ignores other bots
so discord.js. See my message above, that code is what oyu need.
!h
-h
Is there a reason this isn't working? It's not reading any of the events in that folder.
fs.readdir('./events/', (err, files) => { files = files.filter(f => f.endsWith('.js')); files.forEach(f => { const event = require(`./events/${f}`); client.on(f.split('.')[0], event.bind(null, client)); delete require.cache[require.resolve(`./events/${f}`)]; }); });```
@fleet hornet thats a weird command handler
ngl
lol
@fleet hornet are you sure the .forEach is not being executed (executing at least one file)?
Okay, but can you try adding a console log inside your forEach to see if any of the files from the directory are being read
how can i make my bot not to reply to other bots
!<message>.author.bot
my bad
@slender thistle i tried it with message and it still doesnt work
my bot still replies to other bots
my code is if(message.author.bot) return;
and it don't work,.
can you share more of your source code
Okay
preferably from the start of the event listener
but you aren't doing anything after
Uhhhh
did you make an entirely separate listener
do you have more than one event listener
In embed.image.url: Not a well formed URL.)```
well, you need to put that in the same place where you have your command
not in a new message event lol
I have more than 11 message listeners..
no
then dont
you shouldn't
delete that code now
You only need one
btw im talking about the bf code in the image
wdym brainfuck is legendary
@ancient nova care to elaborate what that's supposed to do?
and there's moo as well
Put that code wherever you do your commands
you do this thing
well, you need to put that in the same place where you have your command
You created a separate event that doesn't affect any of the other by any chance
since you have 11 listeners you need to do that 11 times
okay
Or, don't have 11 message handlers
ill put the command in 11 message listenenrs lol
how do I increase limit of listeners? for a snipe command
@sly dawn message.bot.author
message.author.bot*
@gentle oxide ?
You don't need 11.
Like, 100%, you should only have one single message event, that's it.
why 11 listeners tho... just use 1 listener
idk i have been coding since 2 months i was so dumb when i started coding
how do I make it use only one then?
not too late to change
and here i am lol
here @sly dawn start with this https://anidiots.guide/first-bot/your-first-bot#adding-a-second-command
and shouldnt be hard to do
go from there
how do I make an onDeleteMessage event use only one listener?? or increase the listeners
"next level"?
lmao
yes
if you're still using 11 handlers you're not next level.
how do I make an onDeleteMessage event use only one listener?

thats no excuse, code refactoring exists
That reminds me, I need to rewrite my clusterfuck of moderation module
none of my code is older than 6 months, even though my bot is like 4 years old
because im always upgrading, changing and improving it
@fleet hornet the file should be called guildMemberAdd.js.
Where are you defining member? I see you defined message, but not member
@ancient nova ```js
client.on("messageDelete", message => {
// do something
// do something else
})
@sly dawn
if(message.bot.author) return;```
also flip bot and author
yes
message.author.bot
dylan where are you defining member though
I added it to the module exports
In embed.image.url: Not a well formed URL.)``` please
This is why discord.py has the blessed on_command handler
That shit autoignores bots IIRC
@gentle oxide clearly the URL you're sending isn't valid.
on_command is an event when a command is executed
You have async (client, message) => { up there, but I don't see the definition of member.
oh now I see
message would be the GuildMember instance.
but it won't let me put a .json file as url> @gentle oxide clearly the URL you're sending isn't valid.
@umbral zealot
but it can be put as a link to another file which is .json don store a list of urls
I do not know if you understand me
i certainly dont
so your json file has a set of urls to choose from?
yes and that images come out randomly
if you have a json file with URLs, then you need to write code to read this file, chose one url and add the url to the embed
you cannot add the json to the embed directly
@quartz kindle when did u get certified
like a year ago?
Why am i just noticing
I have a question, how can i get my bot reply on @mention him?
Use .includes on message.content
or check if it starts with the mention pattern
message.content.includes(??
@fleet hornet whats get
Like if(message.content.startsWith(@bot name)
startsWith("<@BOTID>")
can't create a file with multiple urls and inside the embed.set_image (filename.json)
Can you not
can't create a file with multiple urls and inside the embed.set_image (filename.json)
?
no
as i said, you need to write code that reads the file and choses one url, then give the url to set_image
you cannot give a json to set_image
it doesnt know what to do with it
it cant guess what you want it to do
why when i reset my nickname it's shows that my new nickname is null?
why when i reset my nickname it's shows that my new nickname is null?
@knotty sigil hhahahah u copied it
copied it?
I am creating a command called memes I need to put out of the bot.py file a file called listmemes.json and here I will put all the urls of the memes that I want it to reproduce embed style
a) why
b) pick a random entry from the json file
but why
you need to manually update all urls
lol
you have to read the contents of the file and parse the json
it doesn't work like that
it isn't magic
That doesn't look like valid JSON
in what fails?
can you speak comprehensive english
Json doesnt have comments with #
@knotty sigil if a nickname doesnt exist, its null
null means an empty value, a value that doesnt have anything
tell me to express myself haha
How can i define null = newMember.username @quartz kindle?
but only for this function
what
lol
👀
Tim take you can say what is my mistake please
if newMember.nickname is null, it means the user doesnt have a nickname
so you either need an if to check if its null or not, or you can use .displayName that basically does it for you
also null is defined
null is an empty value
just means its empty
undefined * another JS thing
Tim look
lmao
null is a declared var, just means its value is empty
@gentle oxide your json is wrong, you're using object syntax, but what you want is an array not an object
also, thats not how you open a json file
looks like a set
or array
a python set
its def py
i don't think those two images correlates
wdym?
Sets aren't supported in json
well yeah but
objects are sets
those don't look like memes
@gentle oxide where is the list of the links declared?
i though sets are just array but with unique entries
What page do you recommend me to know how to use json is that I have no idea what I want to achieve is to make a memes command but instead of the urls lidta being followed by the command that they are in a separate folder and being able to add more urls together
Yes
In this tutorial, you will learn to parse, read and write JSON in Python with the help of examples. Also, you will learn to convert JSON to dict and pretty print it.
returning to my original question, why are you storing the urls in a json file in the first place
you have to manually update that
arent sets in py like tuples?
set is a mutable unordered list with unique immutable values
or am i gravely mistaking things here?
Well tuples are immutable
hmmm i see
else if (collected.find(r => r.emoji.name === '🦖')) {
const embed = new Discord.MessageEmbed
.setColor(0x00ff00)
.setTitle('Premium features')
.setField('Warning types', 'premium lets you change the bot\'s warnings from meme-y, to professional warnings.')
.setField('Warning methods', 'On top of changing the warning type, you can make the warnings be deleted after 3 seconds to sstop chat clutter, or DM the user upon infractions!')
.setField('Logging', 'Whenever someone infracts by sending an inappropriate emoji, this will be logged in any channel with the name `#elogs`.')
.setFooter('buying premium will keep me thriving! run the command again to get the link.')
try {
message.channel.send(embed)
} catch {
console.log(err)
}
}```
that isnt sedning the embed
Send more code in hastebin
returning to my original question, why are you storing the urls in a json file in the first place
@earnest phoenix
to have it well ordered
what
Json is just the representation of an object lol
Erwin its been 48 hours, and I can't still figure out why ts-node is not working for me. I also tried create a whole new project, but no luck @opal plank
https://hasteb.in/osusowad.js @faint prism
the redacted part are premium codes
that workes fine
just not the embed
MessageEmbed()
OOOOO
@rocky hearth show me the new project
wait @pale vessel that still isnt working
Can I share the screenshots privately?
sure
@tired gate addField()
ty flazepe
I did messageDeleted event but I get event limter exeeded 11 listeners error very often, how do I fix it?

Dont stack events
wdym
Each event should be in a seperate block, no events inside others
gateway intents?
¯_(ツ)_/¯
i mean if 500 and 6000 is the min and max i would assume so
i mean if 500 and 6000 is the min and max i would assume so
@earnest phoenix also I got 0 of 1 of 4
I can show u my code
what language is it?
what language is it?
@earnest phoenix what?
like coded in
const Discord = require("discord.js");
module.exports.config = {
name: "random",
aliases: ["ra"]
}
module.exports.run = async (client, message, args) => {
if(!args[0]) return message.reply("You didn't specify args 1!")
if(!args[2]) return message.reply("You didn't specify args 2!")
message.channel.send("Your random number is: " + Math.floor(Math.random() * args[2] + args[0]));
}
my code
oh ok js
wdym I tryed but it said NaN
Math.random() * (max - min + 1) + min```
i use that
for my rand function
and the args should be min = 0
of = 1
max = 2
does anyone know how to javascript -> typescript
I wouldn't do it automatically, so you just... start doing it manually.
https://www.typescriptlang.org/download im readin
Add TypeScript to your project, or install TypeScript globally
@umbral zealot i meant like start a web with a typescript editor and make the typescript work
mmkay well there are many, many tutorials about that
yes yes that's much easier than just following typescript tutorials. 
Anyone here who knows ts-node better than me.
how would we know ¯_(ツ)_/¯
Well, I'm stuck in a situation. So...
const Discord = require("discord.js");
module.exports.config = {
name: "kick",
aliases: []
}
module.exports.run = async (client, message, args) => {
if(!message.member.hasPermission("KICK_MEMBERS")) return message.channel.send('You can\'t use that!')
if(!message.guild.me.hasPermission("KICK_MEMBERS")) return message.channel.send('I don\'t have the right permissions.')
const member = message.mentions.members.first() || message.guild.members.cache.get(args[0]);
if(!args[0]) return message.channel.send('Please specify a user.');
if(!member) return message.channel.send('Can\'t seem to find this user. Sorry about that.');
if(!member.kickable) return message.channel.send('This user can\'t be kicked. It is either because they are a mod/admin, or their highest role is higher than mine.');
if(member.id === message.author.id) return message.channel.send('You can\'t kick yourself!');
let reason = args.slice(1).join(" ");
if(reason === undefined) reason = 'Unspecified';
member.kick(reason)
.catch(err => {
if(err) return message.channel.send('Something went wrong!')
})
const kickembed = new Discord.MessageEmbed()
.setTitle('Member Kicked')
.setThumbnail(member.user.displayAvatarURL())
.addField('User Kicked', member)
.addField('Kicked by', message.author)
.addField('Reason', reason)
.setFooter('Time kicked', client.user.displayAvatarURL())
.setTimestamp()
message.channel.send(kickembed);
}
I got an error when I dont specify a reason?
what error
wait
@shy turret the easiest way to convert js to ts is to throw :any everywhere
(node:8552) UnhandledPromiseRejectionWarning: RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.
at Function.normalizeField (C:\Users\admin\apemodicus\node_modules\discord.js\src\structures\MessageEmbed.js:432:23)
at C:\Users\admin\apemodicus\node_modules\discord.js\src\structures\MessageEmbed.js:452:14
at Array.map (<anonymous>)
at Function.normalizeFields (C:\Users\admin\apemodicus\node_modules\discord.js\src\structures\MessageEmbed.js:451:8)
at MessageEmbed.addFields (C:\Users\admin\apemodicus\node_modules\discord.js\src\structures\MessageEmbed.js:266:42)
at MessageEmbed.addField (C:\Users\admin\apemodicus\node_modules\discord.js\src\structures\MessageEmbed.js:257:17)
at Object.module.exports.run (C:\Users\admin\apemodicus\commands\kick.js:35:10)
at Client.<anonymous> (C:\Users\admin\apemodicus\index.js:40:34)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
(node:8552) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection,
use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:8552) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@umbral zealot
of course you need to fix it later
like you cant .addField("", "")
but just as a basic port
yes but when I dont specify a reason to kick a member I got an err
make sure you use the right types, setting :any's everywhere completely defeats the prupose of TS
args.slice(1).join(" "); would return "" if there are no more args, and "" is not the same as undefined. @autumn aspen you need to learn to use console.log() in order to know what your values are instead of guessing what they are
ok
args.slice(1).join(" ");would return""if there are no more args, and""is not the same asundefined. @autumn aspen you need to learn to use console.log() in order to know what your values are instead of guessing what they are
@umbral zealot but how do I stop that from happening
?
Bc if I kick with a reason its works normal
and when Im not adding a reason it kicks but gives me a error
ttps
h
ttpsh
Let's try again, ELI5 level:
Your
reasonvariable is notundefined, it's""
Oh yes
httpsspspspsps
After what
I think I understand now
let reason = args.slice(1).join(" ");
if(reason === undefined) reason = 'Unspecified';
So do I write in some of them @umbral zealot
?
Wich of them
if(reason == "")
God, please go learn javascript
Is there a way for a bot to calculate a message authors ping to discord?
nope
no
Okay. I was wondering, thanks.
if(reason == "")
@misty sigil LMAO Im blind
As these gentlemen have said, please go learn the basics.
As these gentlemen have said, please go learn the basics.
@stable nimbus no Im just silly
we've been saying this for days. is he ever gonna listen? Of course not, he's a tyler.
Hahahaha
or const reason = args.slice(1).join(" ") || 'Unspecified';
"" is an empty string, which is falsy
well, no, "" is not undefined, it's an empty string. But it is falsey.
0, null, undefined, empty string, NaN
i think im missing something
false
there we go
all those are falsey
How can I download emojis, to use them in canvas ?
Because node-canvas-emoji... doesn't work inside a module.exports function
Buffer from URL
hmm
can't you just loadImage(<emoji url>)
it does, yes.
cuz im shamelessly downloading every single emote
flashback to writing every permissions
you mean me?
a little
Hmm
not much
1 second ?
cuz i may have done this, so when you say writing every perm flashbackl i remember this endeavor that i pulled when i forgot d.js has its own permission resolver

lMAO
300IQ
that shit so old i used any on it
and still havent fixed
i should make an interface for that
a
a
i have some error when my bots are playing music i have 6 (all the same code) but for example 1 bot doesnt play music ant another exactly the same bot does play songs
Is anyone still on even though it's been a night?
what could be causing the error?
have you tried debugging
In Indonesian its 11:40 pm
yes i tried but idk what it means
and its wierd 1 bot works and another wont
what's the error you get and what are the email contents
you'd usually get an email that your token got reset
there must be an error
that doesn't mean jackshit
lol
your console output doesn't matter if you aren't logging the error
anyways
it's quite possible that you exceeded the 1000 IDENTIFY per day limit
ergo you logged in too many times
my logging is
2020-09-26T16:46:07.951909+00:00 app[worker.1]: Error: input stream: Status code: 429
2020-09-26T16:46:07.951924+00:00 app[worker.1]: at ClientRequest.<anonymous> (/app/node_modules/miniget/dist/index.js:150:31)
2020-09-26T16:46:07.951924+00:00 app[worker.1]: at Object.onceWrapper (events.js:422:26)
2020-09-26T16:46:07.951925+00:00 app[worker.1]: at ClientRequest.emit (events.js:315:20)
2020-09-26T16:46:07.951925+00:00 app[worker.1]: at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:596:27)
2020-09-26T16:46:07.951926+00:00 app[worker.1]: at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
2020-09-26T16:46:07.951926+00:00 app[worker.1]: at TLSSocket.socketOnData (_http_client.js:469:22)
2020-09-26T16:46:07.951927+00:00 app[worker.1]: at TLSSocket.emit (events.js:315:20)
2020-09-26T16:46:07.951927+00:00 app[worker.1]: at addChunk (_stream_readable.js:295:12)
2020-09-26T16:46:07.951928+00:00 app[worker.1]: at readableAddChunk (_stream_readable.js:271:9)
2020-09-26T16:46:07.951928+00:00 app[worker.1]: at TLSSocket.Readable.push (_stream_readable.js:212:10)
bin that
what it means?
holy shit
you got rate limited
@low orbit you might've leaked your token too
try regenerating and using the new one regardless
doesn't hurt to try tbh
well never mind
you did that two hours ago
i need to read ffs
everything works in the bot exept music
plugin issue?
by youtube?
wierd each bot got its own api
which still does access to youtube
lol
youtube does ip bans for scraping and has daily quota on their official api
im hosting from heroku with every bot another account how in hell ip is the same?
how to connect to mongodb
const Discord = require("discord.js");
module.exports.config = {
name: "ban",
aliases: []
}
module.exports.run = async (client, message, args) => {
if(!message.member.hasPermission("BAN_MEMBERS")) return message.channel.send(':x: **You don\'t have permission to run this command!** :x:')
if(!message.guild.me.hasPermission("BAN_MEMBERS")) return message.channel.send('I don\'t have the right permissions.')
const member = message.mentions.members.first() || message.guild.members.cache.get(args[0]);
if(!args[0]) return message.channel.send('Please specify a user to ban.');
if(!member) return message.channel.send('Can\'t seem to find this user. Sorry about that!');
if(!member.bannable) return message.channel.send('This user can\'t be banned. It is either because they are a mod/admin, or their highest role is higher than mine.\n\`Or:\`\nthe bot you try to ban with, owner, etc!');
if(member.id === message.author.id) return message.channel.send('You can\'t ban yourself!');
let reason = args.slice(1).join(" ");
if(reason === "") reason = 'Unspecified';
member.ban(reason)
.catch(err => {
if(err) return message.channel.send(':no_entry_sign: **Something went wrong!** :no_entry_sign:')
})
const banembed = new Discord.MessageEmbed()
.setColor(0x75ff58)
.setTitle('Member Banned')
.setThumbnail(member.user.displayAvatarURL())
.addField('User Banned', member)
.addField('Kicked by', message.author)
.addField('Reason', reason)
.setFooter('Time kicked', client.user.displayAvatarURL())
.setTimestamp()
message.channel.send(banembed);
}
Anyone help?
log err and see
~~it's okay ill just use a json file
~~
~~it's okay ill just use a json file :Smileweird: ~~
@stark abyss lol
File "/usr/lib/python3.7/importlib/util.py", line 96, in find_spec
parent_path = parent.__path__
AttributeError: module 'cogs.room-sealer-ship-stuff' has no attribute '__path__'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/pi/Documents/Room_Sealer/room-sealer-core.py", line 105, in <module>
bot.load_extension(extension)
File "/home/pi/.local/lib/python3.7/site-packages/discord/ext/commands/bot.py", line 649, in load_extension
spec = importlib.util.find_spec(name)
File "/usr/lib/python3.7/importlib/util.py", line 100, in find_spec
f"while trying to find {fullname!r}", name=fullname) from e
ModuleNotFoundError: __path__ attribute not found on 'cogs.room-sealer-ship-stuff' while trying to find 'cogs.room-sealer-ship-stuff.py'```
import discord
from discord.ext import commands
class SimpleCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(name='test')
@commands.is_owner()
async def only_me(selx, ctx):
await ctx.send(f'{ctx.author.mention} the cog is working as expected')
def setup(bot):
bot.add_cog(SimpleCog(bot))```
Anyone know how I can get the path attribute done?
For Python
@autumn aspen we have no idea why the ban didn't work, and we cannot tell. console.log(err) and you can find out
Can somebody tell me what this regex is doing??
/^([^\.].*)\.js(on)?$/
Probably searches for .js/.json files
gosh why do you need regex for that
that's-
Regex is useful, but you don't need it a lot.
regex != advanced but i guess you're being sarcastic
@hasty mulch how are you loading the extension?
For example, a .startsWith method is probably better.
and more performant
One sec @slender thistle
yeah
regex is fast, I guess?? Isn't it?
not really
In most cases the difference is insignificant enough to be unnoticed
@slender thistle Disregard. Found the issue
cogs.room-sealer-ship-stuff**.py**
Needed to delete the bold part
alright so i need me some react experts, i've got this as of right now. the state of these components defaults to their config value and has a metadata container to contain their data while they're being changed (that gets cleared on parent component unmount)
@autumn aspen we have no idea why the ban didn't work, and we cannot tell. console.log(err) and you can find out
@umbral zealot it didnt pop any errors
It has to
err cannot be undefined
if it was, it wouldn't trigger your error in the embed
I'm trying to create a restart command so my bot will restart upon command but I am having issues getting my bot to do this with a .then function.
await message.channel.send(`Hey <@${message.author.id}>!`, embed01, console.log(`${message.author.tag} has reset me!`)).then(message => {
client.destroy().then(
client.login(config.token)
)
message.channel.send(embed02);
});```
And this is my error:
```js
(node:5340) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'then' of undefined
at C:\Users\dargc\Desktop\Coding\betarpbot\commands\Administration\restart.js:34:33
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Object.execute (C:\Users\dargc\Desktop\Coding\betarpbot\commands\Administration\restart.js:33:13)
(Use `node --trace-warnings ...` to show where the warning was created)```
the issue is that the state for the last one doesn't seem to fall back to the original config value and react thinks it's still modified
i do have a backing value that stores the path however that gets reset too
@stable nimbus process.exit() and have a process manager like pm2 to restart it. that's best way to do it.
Okay.
Do what Evie said as well
Coding challenge, attach process.exit() on every .catch() block you got in your code. Lets play Hardcode Coding 
@earnest phoenix you'll probably have a much better chance with react questions on the /reactiflux discord.
it's unavailable for me







