#development
1 messages · Page 647 of 1
if you do it that way, you cant use t.id because t is already the id
you have an array, and .some goes through each item in the array and tests it
t in this case is the item being tested
.roles should be a array
if roles is an array, yes, but roles is a d.js collection, not an array
you can use .has there
.has would not work
I tought so originaly too
it would
so i've been tryig to make cooldowns
.has is a method for .map
since yesterday
collections are built upon .map
if (!message.member.roles.has(["594588784671064065", "594588905190326297", "594588967144390656"])) return message.reply("You need to have a premium subscription to use this command!");
i got an answer, it worked a bit
Waaaait
if (!message.member.roles.some(t => ["594588784671064065", "594588905190326297", "594588967144390656"].includes(t))) return message.reply("You need to have a premium subscription to use this command!");
Would that work?
Ah ok
Ima test that then
if (!message.member.roles.some(t => ["594588784671064065", "594588905190326297", "594588967144390656"].includes(t.id))) return message.reply("You need to have a premium subscription to use this command!");
That should work then
yup
And this ```js
if (message.member.roles.has("594588905190326297")) cats = 3
yes, that should work as well
I tought .has worked with arrays before
It does
but when i compare the times im using discord js commando
throtlting doesnt seem to be working... at all
i made a daily credits command for context on my question... im also using mysql
cooldowns in commando are really simple
https://discordjs.guide/commando/throttling.html
A guide made by the community of discord.js for its users.
it
s
not working
i've tried that
module.exports = class Daily extends Command {
constructor(client) {
super(client, {
name: "daily",
aliases: ['dailies'],
group: 'hero',
memberName: 'daily',
description: 'Gets your daily credits!',
throttling: {
usages: 1,
duration: 50
}
});
}
i can spam it
Lmao whoever tried to advertise here... that was cute
if the commando library is not working why are you here
go to the devs who made it (aka d.js support)
...
https://discord.gg/bRCvFy9 incase you cant find it
that's a good thing
@split hazel any reason the go library for the api is not found on github anymore?
also non-dev conversations in #general @earnest phoenix
https://github.com/DiscordBotList/go-dbl @cerulean seal
so they just changed the name?
idk
the official link on their api page doesnt work anymore
ik
well thanks anyway
np
how can I do a bot?
how 2 bot
xd
How do I start a bot on discord.js
@tight zealot
Okay
@mental stirrup learn a language
Honestly I don't mess around with commando at all... that thing sucks
I'd check out some of the better alternatives like:
Klasa https://klasa.js.org
Akairo https://discord-akairo.github.io/#/
if(rows[0].lastDaily + (24 * 60 * 60 * 1000) > Date.now()) return msg.channel.send("Your dailies are not ready yet!");
where last daily is a Date.now() taken when they last had credits added from daily
will that work?
what lib
wdym
pretty sure lib doesnt matter here
@earnest phoenix what?
@broken elm try with a lower time
read le docs
Oh okay
Does anybody want to to do a new project together? I'd love to work with somebody else.
no
Me
nasty
Could we do it
Depends on your experience. You would have to bring something to the table as well.
asking if anyone wants to work with you willingly, then saying there are requirements
"Looking for a full stack developer that can understand algorithms that consist of source based decoded symbols, pm for more info"
There is a difference between working and giving somebody else a project.
"Work" has a meaning to it, you know 😉
const discord = require('discord.js')
module.exports = async (bot, message, args) => {
let logs = message.guild.channels.find(channel => channel.name === "logs");
if (message.guild.me.hasPermission('MANAGE_CHANNELS') && !logs) {
await message.guild.createChannel('logs', 'text');
}
if (!logs) {
return console.log('The logs channel does not exist and cannot be created');
}
let messagedelete = args.join(" ")
let user = message.author
let embed = new discord.RichEmbed()
.setTitle('Message supprimer')
.addField(`Message écrit dans : ${message.channel.name}, écrit par ${user.username}`, `Message supprimer ${messagedelete}`)
logs.send(embed)
}``` how to retrieve the delete message?
I don't really think this is a good idea 
you use the messageDelete event
yes
KrybskyttenToday at 4:10 PM
Does anybody want to to do a new project together? I'd love to work with somebody else.
thats asking for very vague requirements
ahh
idrc anymore
do what you want

https://cakegaming.net/screenshots/0zKHYOvot.png Excuse me >.>
wut do u mean no such option.
Bruh tell the docs that https://discordbots.org/api/docs#pylib
XD
Thanks tho ❤
@slender thistle you made the pylib right?
Yell at Tonkku
I only have access to the GitHub repo
@bitter sundial i was told to yell at you by a moderator i must do it.
y u yellin at me
The docs 😢 it doesn't have a lowercase R
https://discordbots.org/api/docs#pylib in this one >.<
pip install -R requirements.txt should be pip install -r requirements.txt
/Users/sinistrecyborg/Projects/Bot/routine.js:31
yield sheet.add({
^
SyntaxError: Unexpected strict mode reserved word``````js
export default async function(client) {
"use strict";
yield sheet.add({ timestamp: require("moment")().format("M/D/YYYY HH:mm:ss"), count: client.guilds.size });
}```
dont you need to write "use strict" at the top of your file for it to work properly? or is that just for readability?
I'm pretty sure it can either be at the top of a function or the file... I have it at both spots
If you put it in a function, strict mode will only apply to the scope. The top of the file is everything
Yeah, then why do I get that error though
@opaque eagle you're using a normal function, not a generator function. Add * after the function keyword
Oh yeah my bad
Ok
ok please wait i will upload the screan shot
Screen shot
forgive me for the bad english
client.on("message",async message => {
if(message.content === 'submit'){
var channel = message.guild.channels.find("name","submit")
let que = '';
let fillter = m => m.author.id === message.author.id
await message.channel.send("**what is your name ?**").then(e => {
message.channel.awaitMessages(fillter, { time: 60000, max: 1
})
.then(co => {
que = co.first().content;
co.first().delete();
let queee = '';
e.edit("**Your Car ?**").then(e => {
message.channel.awaitMessages(fillter, { time: 60000, max: 1 })
.then(co => {
queee = co.first().content;
co.first().delete();
let quee = '';
e.edit("**How old are you ?**").then(e => {
message.channel.awaitMessages(fillter, { time: 60000, max: 1 })
.then(co => {
quee = co.first().content;
co.first().delete();
e.edit("**Sent**").then(e => {
channel.send(`**__New Submit - New__
Name: ${que}
Age: ${quee}
Car: ${queee}
Submited By ${message.author}
||@everyone | @here||**`)
})
})
})
})
})
}
});
And what's the problem?
Could i see the whole error? You seem to only be showing a part of it
Heroku doesn't seem to have suffisticated logs 
read your error please
you don't have to mindlessly directly copypaste it here without reading it
I can't really plop the code into vsc since im not on my oc
I recommend you download something like VSC and put your code there
It will pinpoint where the problem is coming
yea
That's how i usually find my missing things
yea thx i will download it now
Vsc is only like 40mb so it isnt that big
Im usually very bad at finding missings } or )s blindly
Oh god if it's a small block of code it's easy to find the error but a big one not so much
But according to the heroku log it's on line 76
72*
the line number for that kind of error is pretty useless
the missing )'s proper place could be anywhere before
How can I make the bot send an embedded message in js?
If you're using Discord.js, there's an example on MessageEmbeds on the website
!help
yeah i just realized. sorry
@fallow steppe similar to what farmer said but depending on the version, if you’re using stable use the RichEmbed class and if you’re using master use the MessageEmbed class you can find em on the docs
bots cannot text here
How can you put an outline around text in canvas?
node-canvas to be more specific
If a repeat command that repeats a user's input up to 5 times is said to abuse Discord api, would having the bot wait a second or two in between each repeat solve that issue?
(Wasnt sure if that should be posted her eor in #topgg-api but oh well)
normally some form of rate limit on commands is a good idea
cause things like self bot server exist where there sole purpose is to spam the 🦆 out of your bot hence exhausting your rate limits
The command repeats an input 5 times, then has a 30 second cooldown to prevent spam
I thought that might be enough but my bot was just declined because of it
5 times per 30second period is another method to it yeah
odd 0_o
what was the cmd?
oh hang on
Jrepeat <times> <input>
i think they are meaning they sent 1 command and your bot replied 5 times
Yeah
it should always/normally be 1 message per command
some cases youl need more but unless its a but shouldnt have commands solely to spam
I guess the intention wasnt to spam, considering the cooldown on it. At least I dont see 5 consecutive messages as spam considering a lot of users in general send up to 5 if not more when regularly chatting in channels
But if it's considered api abuse I might as well just get rid of it
better question what purpose/gain beyond spam does it serve
A fun command to emphasise a point, I guess?
maybe sending 1 message with a line break then
i mean still dont see a point personally but that way its not api abuse
like
this
example
3 repeats in 1 message
Yeah, I could change it to that
also handle when someone sets a massive text to repeat and you exced char limit 😉
I'll give it a think for now, then after changing resubmit my bot
Ye
Also, question, would this command also fall under api abuse? It's lengthy but it's only one message, also with a 30 second cooldown so it cant be used straight after to spam.
not ideal but technically no not abuse
its the same kind of thing of what purpose/gain does it serve
beyond api abuse need to think of users
It doesnt really have a purpose besides being amusing
cause rn i see that as a great way to spam/flood a server with text
Also a bit of a tribute to a friend ig
I see how the command can be seen as spam, but that's why I implemented a cooldown on it that applies to the whole server, not just the user
Uh
Well, that wouldnt really be amazing for users in other, smaller, servers tho would it?
Well, so far my bot is only in a few small servers and I haven't received any negative feedback from it, so I dont really have much to go off in that respect
hello I'm writing with google translate because I don't have any english knowledge
to delete a letter from a user name
sample
A Marcopolonius to Marcopolonius
message.guild.members.get(message.author.id).displayName
please help
Use substring or slice
can you give an example
message.guild.members.get(message.author.id).displayName returns a string, so if you wanna slice the first letter of the string off, message.guild.members.get(message.author.id).displayName.slice(1)
If anyone can help me make a stock bot pls dm me
I think ik how they work
thanks i'm trying it now ❤
I mean i might be able to give something if someone can make one
How do you Turn on a bot?
you start your script depending on lib/lang
Uh
whats your lang @earnest phoenix
Hello! How can i optimize this code for bot on discord.js? (It is more than 2000 characters, so the file)
uhm
so
basically
my bot is currently running perfectly fine... except for mysql
im just started usin heroku (don bulli)
and i knew things would go wrong here
i need to know how i find the correct ip of my database
I believe Heroku doesn't support any data storage
Yeah they don't allow write on disk
Your best bet is to use something like a mongodb provider
Bit stupid of a host not to have such a basic feature
It's free...
@twilit rapids @split hazel you get postgres
Hm?
@proper inlet automatic set command
heorku has a postgres integration
What library should I use for creating a bot?
You decide
i need help
How I do it, but change the name, and put de ID
ugh
i decided to scrap my entire bot project that i spent over 2 weeks making
although, it was strictly because 1. everything was so cluttered and unorganized. and 2. i wanted to research more efficient ways of doing things i did in the past.
@twilit rapids it wasnt for storage, i was trying to connect heroku to mysql on my computer. which wasnt working
@real helm message.guild.roles.get('id')
thanks
Maybe you didn't name it Discord
How can I do so that when the channel rights change, the action that I need to take place? discord.js
And if your bot can't find discord.js
- Run
npm i discord.jsin the terminal
@proper inlet what?
check discord.js documentation
there's probably a channelUpdated event
Someone changes the rights of a certain channel and after that an action takes place, for example, a message is sent.
@earnest phoenix im hosting on glitch... and my fcking termial is not working :/
Don't like glitch >~< heroku is better
K
@proper inlet
@tulip wave Im to stupid to use Heroku. its Not working for me somehow
Thank you very much
I can send u a exemple code if you want @proper inlet
Come on
@stray garnet yeah it is a bit confusing to set up but once setup it's better than glitch
But you need 2 accounts to keep it running 24/7
@tulip wave Why 2 accs?
console.log(`Old name : ${oldChannel.name}\nNew name : ${newChannel.name}`);
});```
@proper inlet
Thank you so much again!
np
@stray garnet you only have enough free hours for just under a month
how much?
You loose about 3-4 days a month to free hosting
@earnest phoenix What if i turn it off?
Or get a Raspberry Pi or whatever :/
There are cheap vps providers just check pins
Earn money with your bot, and then buy a vps
Is it allowed to do a Command that sends you the Server Invites where the Bot is in?
TheYigit don’t ping people like that and especially not the role. and 2 you ask your question don’t say help please
Can you create an image in canvas
Like just create a solid colour
And then upload it?
In node-canvas
I think you can
How then?
Not too sure check the docs
Can you link the node canvas docs?
Go to their npm package and there should be some useful links
Ok
Can anyone recommend me free vps server? ( or cheap vps) for d.js bot
There isn’t gonna be anything free obviously
How much RAM are you looking for?
Ty
👌
In discord.py how do I break lines for embeds?
\n probably
@tulip wave Can u do an Example?
Hi, im having an issue with the stream dispatcher
code : https://pastebin.com/vSDa1G26
ouput : https://imgur.com/a/AJqzNL9
This is a fresh Debian 9 VPS and this code worked on my windows pc
the player stop right after starting
Yo can someone explain why my fcking Bot logo dont changes?
Yes @twilit rapids Where either
That just changes the avatar of the app, you would need to Eval it
same goes for username
Wait how eval
What language are you using?
discord.js
Did you follow the guide?
Follow the whole guide, it explains it all
Wait what, how did the "my logo doesn't change"-topic change to "implement an eval command"
or am I missing something
@bold dock You cannot change the Bot's avatar via the DiscordApp developers portal , you would need to do it via the bot, so using an eval command you can change it to whatever you like.
ah fck i said nothing
Python 3.7
Is there any way this code can be more efficient/faster or better?
message = 'GOPBOT WELCOME CHECK'
#Check for the prefix
print(message.startswith(('GOP','ZWEK','GOPBOT','ZWEKKERBOY')))
#Check one of the args is after the prefix
print(''.join(message.upper().split(' ',1)[1:]) in ['WELCOME CHECK','WELCOME CHANNEL CHECK'])
#Shows you the arg that is in this code
print(''.join(message.upper().split(' ',1)[1:]))
#The next is where it's all about:
print(message.startswith(('GOP','ZWEK','GOPBOT','ZWEKKERBOY')) and ''.join(message.upper().split(' ',1)[1:]) in ['WELCOME CHECK','WELCOME CHANNEL CHECK'])
======== RESTART: /Users/ZL109819/Documents/PythonBot/botjes/testa.py ========
True
True
WELCOME CHECK
True
>>>
The goal of this code is to check if the string starts with one of the prefixes followed by one of the commands.
@twilit rapids no you can
Now you can't via the bot
403 Forbidden when you try to change your avatar with .setAvatar('')
@bold dock yes change in the developper portal
Section bot
cloudflare is having issues so every website that uses cloudflare is having issues
including discord
i can't even get on cloudflares website rn or my own or discords but i can use all google and youtube features just fine.
cloudflare's website right now goes to a 502 error.
massive rip >.>
Welcome to Cloudflare's home for real-time and historical data on system performance.
;-;
#memes-and-media pls
It relates to development since it affected everything. it's on topic so i thought i'd save people the time of thinking they are doing something wrong when it's a service that's at fault.
Hey can anyone tell me how to get discordbotlisttoken of my bot
https://discordbots.org/api/docs#mybots @heady lichen
??
Nvm
how to do a log
😂 lmao
logs for what @stray garnet
@earnest phoenix When a User deletes a Message or Edit it
do an Example im to lazy to turn on my PC. Its 20 Meters Away from me :|
console.log(`Old message : ${oldMessage.content}\nNew message : ${newMessage.content}`);
});```
Really idk if its that
try
Then I have to go in my wheelchair and im to lazy for that
ok
ok fair point
stop using your disability as an excuse
Well its usefull
says the person who criticizes literally everyone for not coding their way
wat
@west spoke oof
uwu ok
everyone is lazy to do something, i just don't see why using a disability is an excuse, anyways continuation in #memes-and-media
Is it normal that my try to post server count as an error
It failed internal server error
Cloudfare died. Give it a moment.
guild.owner.tag doesn't work
try that
Okay
ah
await it
Can't I due msg.guild.owner.id though?
no
no
because guild.owner is null
Because that returns a guild member
which is the same reason owner.tag fails
and if its not cached, it cant get the id
Ah
client.fetchUser(guild.ownerID).tag doesn't work
fetchUser returns a promise
ah
which means you'd have to use something like await or then
How do I make this work then?
var serversMsg = [];
client.guilds.forEach(function (guild) {
var owner = guild.owner ? client.fetchUser(guild.ownerID).tag : "[could not find]";
console.log(client.fetchUser(guild.ownerID).tag);
serversMsg.push(guild.name + ": " + guild.members.size + " members, owner is " + owner);
});
msg.channel.send(serversMsg.join("\n")).catch(() => {});
I can't make forEach an async function
Therefore no await
you can
Really?
it wouldn't
Using:
var serversMsg = [];
client.guilds.forEach(async (guild) => {
var owner = guild.owner ? (await client.fetchUser(guild.ownerID)).tag : "[could not find]";
serversMsg.push(guild.name + ": " + guild.members.size + " members, owner is " + owner);
});
msg.channel.send(serversMsg.join("\n")).catch(() => {});
You should read a bit about async
Now it only shows the first server
that won't work
I can tell
it'll finish the forEach before the promises resolve
Exactly
you can't use a forEach there
huh
you could use a map and then await Promise.all
await Promise.all(client.guilds.map(async guild => {
code inside foreach
}))```
that would be different
One message removed from a suspended account.
One message removed from a suspended account.
I'm trying to set my bot's status
Code:
@client.event
async def on_ready():
print('INITIALIZING...')
await client.change_presence(game=discord.Game(game='beta 03 | &help'))
print('Bot presence set.')
print('The bot is now ready.')```
everything else works fine
does anyone know how to detect the addition or removal of a role on a user?
@slender thistle doesn't work
For now in my event guildMemberUpdate I have this js roles = newMember.roles.map(role => role.name) if(oldMember.roles != newMember) { console.log(`${roles}`) } and I would like her to tell me that the roles that were add or delete on the user
Getting an errror wi¡hile using PQSQL,
https://gyazo.com/d65bbbe35f2c1f1ec247ea90b22a5996
This means that the server you're trying to connect to doesn't support ssl
I'm not sure really about PQSQL but if there's an option to disable ssl connections then that's your best bet
not sure what I have dont wrong, but the bot doesn't reply when I run the command
if (message.content == prefix + "embedhelp") {
message.channel.send({embed: {
color: 3447003,
title: "This is an embed",
description: "Description test.",
fields: [{
name: "Field1",
value: "Field test 1."
},
{
name: "Field2",
value: "[Field test 2.](http://google.com)"
},
{
name: "Field3",
value: "**Field** `test` __3__."
}
],
timestamp: new Date(),
footer: {
icon_url: client.user.avatarURL,
text: "© Example"
}
}});
}
})```
Do you get any errors in console?
nevermind I figured it out. Was using client instead of bot
i see
i've spent so much time working on a cache for my sqlite database, and it does no difference at all because sqlite is fast af
yeah cache is best for slower databases
Anyone who has a decently popular music bot, how much is your hosting on a monthly basis? Or perhaps a better question is how resource intensive is it?
It all depends on the language, library, method, etc.
Your best bet is to try it on a local machine, see how much it takes up at first, do that, and as it grows, upgrade
Niks Groovy uses a cluster of 4 dedis costing $200 each (think it was groovys)
Could dm him with any questions
You can ask me
@dusky marsh henlo
I am the Groovy community man
We have 4 dedicated servers running k8s for audio processing and stuff
128GB/2x16c iirc
And we use about 80%
Wowzas
For a million discord servers.
$800 the dedis alone
We also have an extra server for db, k8s master, etc.
Total roughly $1000/mon
Hmm, interesting, thank you for the information! I really appreciate it :)
@spice nymph you arent allowed to do that as per discord tos
if you do that
you will be banned
rollbar: new (require('rollbar'))(process.env.ROLLBAR_ACCESS_TOKEN),```
3|PentaHub | TypeError: Cannot read property 'minimumLevel' of undefined
3|PentaHub | at new Rollbar (/home/administrator_nico/PentaHub/node_modules/rollbar/src/server/rollbar.js:24:15)
3|PentaHub | at Object.<anonymous> (/home/administrator_nico/PentaHub/structures/client.js:76:12)
3|PentaHub | at Module._compile (module.js:653:30)
3|PentaHub | at Object.Module._extensions..js (module.js:664:10)
3|PentaHub | at Module.load (module.js:566:32)
3|PentaHub | at tryModuleLoad (module.js:506:12)
3|PentaHub | at Function.Module._load (module.js:498:3)
3|PentaHub | at Module.require (module.js:597:17)
3|PentaHub | at require (internal/module.js:11:18)
3|PentaHub | at Object.<anonymous> (/home/administrator_nico/PentaHub/index.js:4:16)
the thing your calling minimumLevel on doesn't exist
Im not calling anything minimunLevel
are you doing .minimumLevel
Know someone a command who can pick a number and a name and the result a link
Example : if(msg.content.startsWith(prefix + "astats")) { const name = msg.content.send(); if(nameapex) { const platform = ("1","2","5"); if(platform) { const embedprofile = new Discord.RichEmbed() .setColor("#FF0000") .setTitle("Your status link was created") .setAuthor("Click me", url("https://www.../platform/name")); msg.channel.send(embedprofile); } } }
wtf is message.content.send()
idk
i tried something =))
i'm a biginner with discord.js
i want it with 2 strings
i want it to be a status bot
for a game
afaik you cant mask hyperlinks in the author field
you can use .setURL() to set a masked hyperlink for the title
but i want the name to be like =astatus name
if you know how
Umm , hello?
Then do it?
...
@earnest phoenix I'm not sure why you want to do, could you explain again?
Ah I get it now
They're using a .addField property
So for example if you do like
=astats nameofyourlnk link here
Right
So just do something like
=astats username platform and then show into an embed
Wdym username platform
Okay so what do you want it to be like
What is the usage
Send me example usage pls
ok
Like is it
=astats abcd https://www.google.com
Or what
=astats TEdy Ps4
ok
let me explain
what i want to do
if you type =astats username ps4
to show like
https://www..../username/ps4
Okay what's the.... Supposed to be
Can you gimme a complete link
const args = message.content.split(/ +/g) //you split the message content into an array based off of spaces.
const platform = args[1] //second item of the array, args, is the platform
const username = args[0]
const emb = new Discord.RichEmbed()
.addField("Your status link has been created", `[Click Here](https://public-api.tracker.gg/apex/v1/standard/profile/${platform}/${username})`)
message.channel.send(emb)
}```
@earnest phoenix Do you understand this?
Sorry for delay, I'm on phone so coding on phone is not fun 
Okay, good luck and have a good day 
but i wrote in node
This is node. 
You were most obviously using discord.js so I wrote in discord.js node.js
oh , i was scared for a minute =)))))))))))) cuz i thought i maked you write for nothing
What? 
nvm
You'll have to space it out properly because I can't do that on phone. 

^
SyntaxError: Unexpected token (
at Module._compile (internal/modules/cjs/loader.js:721:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
YEEEEEEEEEEEEEEEEEEEEEEEEEEEEEY
i like to code so much
You need to put it under the right section
The place where you're gonna run the command
rollbar: new (require('rollbar'))(process.env.ROLLBAR_ACCESS_TOKEN),```
3|PentaHub | TypeError: Cannot read property 'minimumLevel' of undefined
3|PentaHub | at new Rollbar (/home/administrator_nico/PentaHub/node_modules/rollbar/src/server/rollbar.js:24:15)
3|PentaHub | at Object.<anonymous> (/home/administrator_nico/PentaHub/structures/client.js:76:12)
3|PentaHub | at Module._compile (module.js:653:30)
3|PentaHub | at Object.Module._extensions..js (module.js:664:10)
3|PentaHub | at Module.load (module.js:566:32)
3|PentaHub | at tryModuleLoad (module.js:506:12)
3|PentaHub | at Function.Module._load (module.js:498:3)
3|PentaHub | at Module.require (module.js:597:17)
3|PentaHub | at require (internal/module.js:11:18)
3|PentaHub | at Object.<anonymous> (/home/administrator_nico/PentaHub/index.js:4:16)
Help?
Depends
is there a code for the bot to send a message when I tag someone
can you specify more on that?
I'll try with translate
I want to react when I write the first image I want
Did I tell you?
client.on('message', async message => {
let prefix = await db.fetch(`prefix_${message.guild.id}`) || ayarlar.prefix
let afkmarcopolonius =message.guild.members.get(message.author.id).displayName.slice(5)
let kullanıcı = message.mentions.users.first() || message.author
let afkdkullanıcı = await db.fetch(`afk_${message.author.id}`)
let afkkullanıcı = await db.fetch(`afk_${kullanıcı.id}`)
let sebep = afkkullanıcı
if (message.author.bot) return;
if (message.content.includes(`${prefix}afk`)) return;
if (message.content.includes(`<@${kullanıcı.id}>`)) {
if (afkdkullanıcı) {
message.channel.send(`\`${message.author.tag}\` adlı kullanıcı artık AFK değil.`)
db.delete(`afk_${message.author.id}`)
}
if (afkkullanıcı) return message.channel.send(`${message.author}\`${kullanıcı.tag}\` şu anda AFK. Sebep : \`${sebep}\``)
}
if (!message.content.includes(`<@${kullanıcı.id}>`)) {
if (afkdkullanıcı) {
message.channel.send(`\`${message.author.tag}\` adlı kullanıcı artık AFK değil.`)
db.delete(`afk_${message.author.id}`)
message.member.setNickname(afkmarcopolonius).delete
}
}
});
Just check if message.mentions.members collection .has anyone in the map of people in afk
And if yes make it reply
did not work 😦
What do you mean 
It would work if you write it properly
How are you storing the AFK users?
The users who are in afk
quick.db
thank you so much ❤
If you use a map you can do it easily
i don't know how to use map
map() is an object
A function in js
map is litereally a key pair value
Ye
like what you do in quick db

i'm more a novice i don't even know english
😄
//example of map
const cache = new Map();
cache.set('foo', 'bar')
cache.set('owo', { hi: 'hello' })
console.log(cache.get('foo')) // returns bar
console.log(cache.get('owo').hi) // returns hello
wow
Just set the user ID as key and guild ID as valur
Then check for both
And if they're in the map where it matches, then you send that message
forgot your quotes around hello

Thanks qt @inner jewel

Are there any good guides on caching and how to implement
at Promise (E:\somestuff\node_modules\apex-api\src\Client.js:32:42)
at new Promise (<anonymous>)
at Client.user (E:\somestuff\node_modules\apex-api\src\Client.js:23:12)
at Client.bot.on.msg (E:\somestuff\index.js:34:19)
at Client.emit (events.js:198:13)
at MessageCreateHandler.handle (E:\somestuff\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (E:\somestuff\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (E:\somestuff\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (E:\somestuff\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (E:\somestuff\node_modules\ws\lib\event-target.js:120:16)
i'm gonna freakout
{
const args = msg.content.split(/ +/g);
let username = args[0];
let platform = args[1];
let data = apex.user(username, platform).then (data => {
console.log(data);
}).catch(e => {
console.log(e);
msg.channel.send("No database was found");
})
}```
i need help
i get everytime this [APEX-API] Platforms must be PC, XBOX or PSN
AND i don't know why i put he args
...maybe you should check whether the platform is pc, xbox or psn
inspect your variables
if (platform.toUpperCase() === 'XBOX') nbr = 1;
if (platform.toUpperCase() === 'PSN') nbr = 2; ```
@sudden geyser tbh cache in map is the easiest form of cache
if you are working with something like sql settings, then on boot, get the stuff you need then cache it
enmap works the same way irrc
you can probably adapt that but instead use your db
or make it a bit diff. choice is yours
umm i solved 50% of the code
Is there any way you can display the amount of commands your bot has?
Apart from going through the files and counting them
Hello! Is there a way, for me to run a command, then a user's userID gets stored to a .json file and then when they run a command, it checks for them on that list and if they are, say something instead of running the command? My bot is discord.js. Please ping me if you respond. Thank you!
if(!json[message.author.id]) return;
``` @wooden lance
Aha! Thank you! 😄
idk if its what do you wang exactly
A blacklist system is what i'm looking for.
And databases just don't seem to work for me
Do you know how to add a userID to that record and how to lay out the file @earnest phoenix?
hmm add a level to the blacklist
K thanks
@rugged kelp what error do you get?
@rugged kelp message.member.username
@nocturne hazel len(client.commands) is what my bot uses I believe
For the commands size?
Like, in my botinfo command it outputs the number of total commands
forEach your commands file and fetch the size
Oh cool
Python != JS
Its in py?
oh k
Yeah
Though idk what the author uses so
If it's python, that should be it. If not then idk

How can i modify the pitch with Lavalink? 🤔
if(!message.author.id === "165811958828761089") return message.reply("you do not have permission to reload commands")
if (!args[0]) return message.channel.send("Please give me a command to reload")
let cmd = args[0].toLowerCase()
try{
delete require.cache[require.resolve(`./${cmd}.js`)]
bot.commands.delete(cmd)
const pull = require(`./${cmd}.js`)
bot.commands.set(commandName, pull)
} catch(e) {
return message.channel.send(`failed to reload ${cmd}.js due to \n${e}\npls fix`)
}
message.channel.send(`reloaded ${cmd} you're welcome`)
anyone know why this wont work? it gets to bot.commands.set(commandName, pull) then commandName is undefined and idk why
@tulip wave how are you declaring commandName
it should be from the command collection
one sec, i think i might know what the issue is but i kinda wanna make sure before saying anything dumb
ok
message.member would return a huge object, so have fun sending that lol
Nope.
What? @warm marsh
message.member it's ID
${message.member} would return @warm marsh
Yes with embed
@tulip wave my best guess is that commandName isnt declared in the scope; you arent passing it in the command function or however you have it set up
but it already gets deleted at that point
wait no
that could work
but maybe its not what they need
ill try it
they would just use cmd then, aliases exist as well 
They're clearing cmd from the list and re-setting it so cmd is current.
eh probably
If they've got aliases.
What is the best db for a rpg games?
I'm using sql rn but idk if its the best to store game data
sql is good but i personally dont use it because its way too easy to fuck up
if you have experience with it and no significant problems, just use it
message.author.id != "165811958828761089"
now gives me id as undefined >.>
worst of all it works in other commands
could be a system message
TypeError: Cannot read property 'id' of undefined
i cant find the string
'MongoParseError'
@exotic tapir pm2 logs 0 --err --lines 200 pls
nvm
hey, i noticed that my bot is often quickly removed from a server after it has been added, but there are no errors shown, or atleast not in that amount. What is good way to fix this?
or what could the reason for that be?
module.exports.run = async (bot, message, args) => {
let variable_salon_users = message.guild.channels.find(`👥 Utilisateurs : ${message.guild.memberCount}`, 'voice')
if(!variable_salon_users) return message.channel.send("**⚠ Le compteur d'utilisateurs n'existe pas.**")
if(variable_salon_users) {
variable_salon_users.delete()
message.channel.send("**✅ Le compteur d'utilisateurs à été retiré avec succès.**")
}
}
module.exports.help = {
name:"remove users"
} ```
Why doesn't her take the channel out?
@cerulean seal sometimes people add your bot to a server for testing
yea i thought of that but its like per 10 servers added only 1 remains
So i just added more information about the commands it provides to the page on the site. So people can better judge if the bot is a good fit
@earnest phoenix what?
I put the code at the top, but when I make the command, its not removing the vocal lounge
have you tested each single component of it and made sure that they all worked on their own?
@earnest phoenix btw it's still not working but it is in other commands im actually confused
Can u help me ?
results is undefined
What returns undefined ?
you're running query() before the connection is established
i think the connection.connect function is async, so you either need to await for it to finish or you need to put your query insdie the callback of it
so like ```connection.connect(function(err) {
// Some error handling
connection.query('your query', function(error, results, fields) {
// processing the data
});
});```
@plucky sun
hmmm
well but this says thats how you are supposed to do it https://www.w3schools.com/nodejs/nodejs_mysql.asp
Does “monthly upvote” mean the total of this month
Yes
@plucky sun put the connection.end() at the end of the query callback
already done
in the callback?
yea
you do select a database when connecting right?
in the createConnection function
yes
and you do have something in the database
do you output the raw result of the query
I already test with the creation of a table works, and yes it works.
i mean the selection query
So, fields give the exact number of tables but with [Object, Object]
hmm idk anymore
😃
[Object,Object] means its working, you just need to extract data from the object
if you want to output the entire object, you need to convert it to a string
What is the name of the event when a role has been added or removed?
which library
ok
@earnest phoenix in d.js guildMemberUpdate
How do I make a welcome official command?
discord.js
Hmm welcome message on joining guild of dm on joining guild
Or just simple ans to command
just simple ans to command
@earnest phoenix
Create a variable and put in front of command then use this format
it's a github?
Yup
hm okay :d
Ya i just clicked it from my desktop
Do you have the link to throw it out or I'll stay for a hour or so afk
Thanks ❤
Yes
Oh sry
Private Project
Very Very Very Thank Youuu ❤
Np

spoonfeed bad
okay, the bot is not responding to this
// Ignore messages that aren't from a guild
if (!message.guild) return;
// If the message content starts with "!kick"
if (message.content.startsWith('!kick')) {
// Assuming we mention someone in the message, this will return the user
// Read more about mentions over at https://discord.js.org/#/docs/main/stable/class/MessageMentions
const user = message.mentions.users.first();
// If we have a user mentioned
if (user) {
// Now we get the member from the user
const member = message.guild.member(user);
// If the member is in the guild
if (member) {
/**
* Kick the member
* Make sure you run this on a member, not a user!
* There are big differences between a user and a member
*/
member.kick('Optional reason that will display in the audit logs').then(() => {
// We let the message author know we were able to kick the person
message.reply(`Successfully kicked ${user.tag}`);
}).catch(err => {
// An error happened
// This is generally due to the bot not being able to kick the member,
// either due to missing permissions or role hierarchy
message.reply('I cannot kick the user. Either I do not have the `Kick` permission, or my role is lower than the user. ');
// Log the error
console.error(err);
});
} else {
// The mentioned user isn't in this guild
message.reply('That user isn\'t in this guild!');
}
// Otherwise, if no user was mentioned
} else {
message.reply('You didn\'t mention the user to kick!');
}
}```
One message removed from a suspended account.
One message removed from a suspended account.
whats the problem with that?
One message removed from a suspended account.
I actually need help on what's wrong in the code.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
If you actually look above, alot have been doing the same without running into a response like yours so stop.
One message removed from a suspended account.
One message removed from a suspended account.
you mind stop talking about that?
Let's not fight
Where did message.guild.member(user) come from
from the kick command
And I hope you realize that that's wrong
hm?
One message removed from a suspended account.
DV please
One message removed from a suspended account.
Help or stop
One message removed from a suspended account.
One message removed from a suspended account.
guild.member isn't a thing, first of all
One message removed from a suspended account.
One message removed from a suspended account.
This is simple. Now, off topic goes to #memes-and-media
What is the code for member count please ?
what lib?
guild.memberCount on d.js
why when i do
const { resolve } = require("path");
const d = __dirname;
const r = resolve.bind(d);
r()
it gives me something different than if i do path.resolve(__dirname)?
what's the code that allows the bot to create a role with perms and color? ( js )
Spoonfeeding is bad 
@fallow steppe
anything you'll ever need to find is (probably) in the documentation
no it uses node electron
Ah
I think I asked this before but how do I remove the bot roles after I delete a bot
Do bots like Dank Memer use Canvas?
no
O
How do I remove them?
https://www.reddit.com/r/discordapp/comments/6bapcv/how_do_i_delete_bot_roles_integration/ won't work because they're already removed
8 votes and 3 comments so far on Reddit
the bot is deleted though 
f
oh
hi
Hi do you need help with anything related to development?
He's a certified and library developer, I don't think he does lmao
hey, i got a question, when using the go-dbl lib i always get an error when updating the Bot stats but it just says Remote request failed with non 200 status code but i dont know what the problem is
the code im using for it is the exact same as the one in the example just with my credentials
200 means oo
Ok
So if non 200 it means something either client end or server end did something wrong
yea but i dont know what, since i just used the example code (with my own credentials obviously)
i already checked and i entered them correctly
try altering the code a bit. Never take examples raw and assume they will work.
well the guides should work
especially when its basically only 2 lines + error checking
Well, the error checking should give yoi the status code
Which will tell you what the problem is
the error it returns is just the Remote request failed with non 200 status code
How can I make the bot create a channel and then send a message to it?



