#development
1 messages · Page 624 of 1
I have it
I need webhook thats the final component that i need to make a fully immersive bot
oh so you got dialogflow to work you just want it to chat through a webhook?
that doesnt mean anything
for discord webhooks: https://anidiots.guide/discord-webhooks
though im pretty sure this isnt what you need
ah
Yee
well does your server have a url it can be reached at? youd have to set that up
alternatively, you can (probably) get dialogflow to send a request to whichever api you want and just take their data straight away
Glitch.com has one for sure
oh boy hosting with glitch
i hate that idea
blackList.push(message.mentions[0].id);
TypeError: Cannot read property 'id' of undefined```
again, can be solved by 10 seconds of reading the docs https://discord.js.org/#/docs/main/stable/class/MessageMentions
ok
its gives me the same error
i put :
message.user.id
and its handed me the same thing
again, can be solved by 10 seconds of reading the docs. message doesnt have a user property
Stopped to take me out the doc, I am French, I have no translation and I get lost nothing is explained
you know the word "property", thats enough to figure out what properties an object has. depending on your code editor, code completion is available as well
so I put user.id ?
i dont even know what you want to do
const Discord = require ("discord.js");
const fs = require ("fs");
module.exports.run = async (bot, message, args) => {
fs.readFile("./blacklist.json", (err, data) => {
var blackList = JSON.parse(data);
let useradd = args.join(' ');
if(!useradd) return message.channel.send("**❌ Veuillez insérer un utilisateur**");
var newBlackList = JSON.stringify(blackList);
blackList.push(message.user.id);
fs.writeFile("./blacklist.json", newBlackList, (writeErr) => {
if (!writeErr) {
message.channel.send("**✅ L'utilisateur à bien été ajouté à la blacklist.**")
} else if (blackList.indexOf(message.mentions[0].id) > -1) {
message.channel.send("**❌ L'utilisateur est déjà blacklisté.**")
}
})
})
}
module.exports.help = {
name:"addbl"
}
using json as database and reading it every time a command is called, nice so do you want to blacklist the person who wrote the message, or ther user it mentions?
message.mentions.members.first()
the person who is added to the blacklist
sry,
the person who is added to the bl
so do you want to blacklist the person who wrote the message, or the user it mentions?
I want to be the person mentioned
message.mentions.members.first() or message.mentions.users.first()
Help me! My oauth code worked well all day, but suddenly I'm getting this.
What can i do?
I think it can't get the access_token
One message removed from a suspended account.
I'm using oauth. I logged in using that discord stuff. It worked all day.
well, whats on those lines in your welcome.php?
you cant user headers if you already echoed anything
headers have to be before any type of content
But it worked when we made the guilds "listbox" 😄
well, errors happen, and you need to think of all possibilities
headers always go before content
ok, I'll give a try
the other errors mean you're trying to get a property of a non object, same as "cant get x of undefined" in js
I know that. It'll define these here (pics). And thats why I think that it can't get the access_token
I want to make a discord bot, and i cant come up with a good theme.. some suggestions?
It makes you confident with what you write
Yeahh
Both Dart and TypeScript are amazing as JS replacements
So TS is better ?
error_log($token)
should appear in a text file called error_log.txt in the same directory
TypeScript is JavaScript in the end. It is just a superlanguage with typings.
ikr
the cons is that you have to run it through a compiler before using it
Personally, TypeScript is good for your own sanity and more stable code. If you do not care about stability, should not worry that much about moving.
Not really everything, it took me about two days to move a bot from pure JS to TS.

Just really depends on how long is your code.
Specially, how much 🍝 there is.
Mine is at the point of no return, too much 🍝.
i got 16 cmds
Though, if you really want to try it out. Do it when you plan to refactor. Else it will most likely be a loss of time.
ill code from beginning if i do so
It doesn't create any error_log file 😦
I see... Well, take a look at it in the official website. TypeScript is very vast and well supported, so you should not have any issues dealing with it.
typescript only matters in the development process. what the end user sees doesnt depend on what language you used
It is also nice to shorten code, some things can be longer in TS but others can massively shorten because of it.
the only reason to use it is to keep your code maintainable, especially if you deal with many data types, in which case strong typing will be very useful
But it doesn't jump into this if 😦
Well, we are talking about that here. As said previously, TypeScript is just JavaScript in the end.
it does compile to javascript anyways
@lime fiber then remove the redirect and var_dump($token)
idk php at all, but then maybe session('access_token') returns false?
also, why do you need 3 foreach? cant you just do
foreach($guilds as $guild) {
$teszt2 = $guild->name;
$teszt3 = $guild->id;
$teszt4 = $guild->owner;
}```
^
$token isnt an object then?
did it dump anything tho?
just disable everything else in the page
coment out everything
and leave only the token reuqest
and dump it
Do anyone know some bot who can give auto role to bots
Like when i add bot he will get automatic role
Same like for new user and them get role automatic. I need for bots
set up permissions for the bots role
Help me pls
I need bot who can give role to new bots
Like to users
Do anyone kbow one
if its the automatic role th-
youre a bot dev, it takes like 10 lines of code max
oh what a normie
How can I do (discord.py) a bot write in a specific channel?
I use await message.channel.send('message here')
Plz help me
Idk
await message.channel.send(discord.Object(id='channel id here'), 'message here')
Tnks!
I edited!
why the ID being string
Also
What.
message.channel.send(destination, content)???????
@indigo geyser Your initial way was right https://discordapp.com/channels/264445053596991498/272764566411149314/583373669762596877
Ok
@mossy vine 0.16.12 d.py:
await client.say(channel, text, ...)
1.0.0+:
await Messageable.send(text, ...)
oh
I find bot
@lime fiber
@lime fiber then something is wrong with the request, what are you using for it? have you checked the discord docs as well? somewhere must be written the cases when it returns null
Anybody know a website where I can learn node.js for free? Excluding stackoverflow.com
Nope @coarse patrol
I know codecademy
do you need something specific that requires node.js? else just learn javascript
But it required PRO to learn node.js
node.js runs javascript
Me too, but idk if there is node
@indigo geyser
- content.startswith
- Your indendation is not proper
I'm trying to make a bot. Does this require node.js only or can I also use js?
it requires node.js
@slender thistle pherphase it's because I'm using Pydroid
if you know javascript, you already know 90% of node
... what does that have to do with the solutions I provided for your error?
You are adding more spaces where you don't need one or the opposite of that
Should I start with an essay on how you ignored my first advice
Or do I complain about you not showing any more parts of your code
@indigo geyser that is not how message.channel.send works. Please refer to the discord.py documentation.
They initially did it right but someone decided to give a shitty code
so now we're stuck here
Ok, now I understand
then they shouldn't just paste code without knowing how it works
This code is wrong
indeed
I smell 2 errors
That first one you fixed, the second one I have no clue if you fixed it
But your .send is wrong on that screenshot anyway
I have been losing my mind over this for so long I cannot think of what to do anymore. I do not know why the function play is not being run while the console.log console.log("Checkpoint more in queue"); is running. I must be missing something very obvious here right? ```js
let fetched = ops.active.get(dispatcher.guildID);
console.log("Defined fetch");
//if (!fetched) return console.log("Error at fetch");
fetched.queue.songs.shift();
//delete fetched.queue.songs[0];
console.log("Shifted queue");
ops.active.set(dispatcher.guildID, fetched);
console.log("Set queue");
if (!fetched.queue.songs[0]) {
console.log("Checkpoint nothing left");
let vc = fetched.queue.voiceChannel;
if (vc) vc.leave();
fetched.queue.textChannel.send(`🎶 || Finished playback`);
ops.active.delete(dispatcher.guildID);
} else {
console.log("Checkpoint more in queue");
play(client, setting, ops, fetched);
}
Yes but I didn't understand it⭐
Messageable is a class that you can use .send on
Text, group channel and users are subclasses of Messageable, hence, you can do member.send if member is instance of Member class
In your case you don't literally do Messageable.send
👌
I know this now
yeet
ooooofffff
Self-explanatory errors!
They're on latest
I thought the only thing on_error took was the error
And by latest, I mean 1.0.0+
I didn't understand this
Something is a string but it should be something else
a string isn't a channel
A string does not have an attribute 'channel'
Ooofff
difference between;
"272764566411149314"
and
client.get_channel("272764566411149314")
So what I have to do?
though rewrite uses int for channel IDs
uhh
you're using discord.py v1.0.0, right?
They are
My error event is completely different
Yes
// put all the stuff here
@client.event
async def on_command_error(ctx, error):
// code here```
replace `channel.message.send()` with `ctx.send()` (channel.message.send() is async)
It should work if it's rewrite
though using isinstance and importing the errors could be better
(ex. importing CommandNotFound and checking if isinstance(error, CommandNotFound))
If they're trying to send a message to a channel, I'm sure they're attempting to find an error on a command that was executed in that channel
Oh
wait
I just reread what you said
It's just an if in an on_message
Until you start using the commands extension, I would just suggest using try-except
Now it tell me the right error, but on Discord it don't tell anything
Isn't the commands extension just apart import discord for discord.py?
nvm
I can't read my own code
Why?
I literally said that, turned to my imports and saw from discord.ext import commands and I felt dumb
Basic Python time
Wrap your "commands" in try-except and you should be good for now
(I'm not disregarding the fact that your code will look ugly)
I think he is using the async branch
Since when does async have Messageable.send stuff
rewrite uses ctx to send messages
What is try-except?
oops
and if you want to send a message to a specific channel, you use a client.get_channel() variable
chan = client.get_channel(id) then await chan.send()
this man be asking how to do try-except
Because in Italian it doesn't have sense
In Python it makes sense
And if you spent some time actually learning the language first, you would've recognized that centuries ago
At this point I'm teaching Python instead of helping with a Discord bot
fun
Tried python?
i installed p3 pip and choco
i want to work on my bot
but my development process is a bit too exciting for me
yep
I honestly cba to answer these questions at 2 am anymore at this point
That was back in the days
pip was still used
You would just download directly from the GitHub repo
I just kind of downloaded discord.py and discord.py[voice] which i never got working and was kind of done with it
pyt succ- im done trying to use python
what
Your call
i would play around with javascript but honestly it feels like learning how to do the same thing but with a different way of saying it
almost like learning a different language-- ohhhh wait
ikr
that's exactly what it is
all I really care about learning is Python & Java tbh
I'll probably need to learn more down the line but procrastination is fun
So I want to be able to have the bot delete every message in a channel and then send a embedded message with what the message the bot deleted as the description anyone able to help.
on message, delete the message, get another channel, post message content in that channel
wait what
so you want to purge a channel
and have the bot send a message with what
The bot would delete it
what language is this
Discord.js
Apparently I got ignored
i just didn't understand what he was asking
So how would I do that
what he said
I've no clue how to do this on discord.js but I'm sure they have a function that fires every time a message is sent
I’m not good with discord.js
message event?
function findmove(movenum, move) {
if (movenum = "0") {
if (move = 1) {
var move1name = "None"
} if (move = 2) {
var move2name = "None"
} if (move = 3) {
var move3name = "None"
} if (move = 4) {
var move4name = "None"
}
} else {
if (fs.existsSync('data\\moveid\\' + movenum + '.txt')) {
if (move = 1) {
var move1name = fs.readFileSync('data\\moveid\\' + movenum + '-name.txt').toString().split('\n');
} if (move = 2) {
var move2name = fs.readFileSync('data\\moveid\\' + movenum + '-name.txt').toString().split('\n');
} if (move = 3) {
var move3name = fs.readFileSync('data\\moveid\\' + movenum + '-name.txt').toString().split('\n');
} if (move = 4) {
var move4name = fs.readFileSync('data\\moveid\\' + movenum + '-name.txt').toString().split('\n');
}
} else {
if (move = 1) {
var move1name = "None"
} if (move = 2) {
var move2name = "None"
} if (move = 3) {
var move3name = "None"
} if (move = 4) {
var move4name = "None"
}
}
}
});
Error
C:\Users\[]\Desktop\[]\bot.js:164
});
^
} only?
?
It should be pretty obvious
I'm pretty blind
I don't see it
const fs = require('fs')
const Discord = require('discord.js')
const client = new Discord.Client()
I have these const on
You neither open the ( nor need you a ; after a function definition
...
...???????
You never open the ) bracket in the last line. So there is no need to close it
Just use a proper ide with a linter
well uh, dont
what's the way to ask for a discord channel in discord.py rewrite arguments (like how you can do user: discord.Member)
p
o
discord.TextChannel
I just use local files
Yea I just have a json file for each user/guild but I feel like that’s kinda dumb tbh
I think MongoDB has a free hosted tier as well
i mean it works and its free
i got a .txt file for all users of my bot, it just stores them all in the same file
leveldb for small bots is fine and it has key value type storage
although for sharding level db dont support that,
sqlite does support sharding and if your bot doesnt write that much then sqlite is a fine option
leveldb is the easiest and fastest but no sharding support
learn sql and you can use sqlite and it can support sharding
both are local based database so they are not hard to setup
I see
Would my current usage of JSONs be a valid approach or is it way better just to use a database?
Jsons was never been a valid approach
I dont know even why a lot of new comers use json
Easy to use tbh
level db is easier to use
anyone here uses python?
JSONs are more complicated to use in my opinion
@harsh fossil is Dynamo nosql?
leveldb implements the same idea of a map, so you can probably use JSON.stringify() on it
then JSON.parse and use the guildID as a key
its as easy as that
Nosql or key value pair
that is the same
DynamoDB specifically says both in it's docs so idk
I just follow the crowd
just use what you think is good
if you can use sql statements then you can try sql databases
if you hate sql then try nosql
in the end its your choice
Anyone who uses python3, what is the raw data that changes the bot's prefix? ( ping when replying )
command_prefix
@fallow steppe
If you want it so its custom for every server you need a database
however idk how to use it
I was looking for a data that changes the prefix by running a command
Such as c!prefix !c
so only for you to use?
How would I make a bot do a action when they send a message in a channel.
what
I think they want a command to send a message in a separate channel
Like using command here to send a message to #commands
no
I think it's when someone does x, bot does y
@earnest phoenix elaborate
also what language
@jolly sentinelI know that I dont knwo what that is tho
A exsample would ne jelpfil.
"english"
stop right there, criminal scum
Although a very low proportion of people creating bots seem to know much about anything in regards to programming, it's good to see so many people trying their hand at it.
Agreed
it would also be good to see some proper demo's that cover a more full understanding of what they are doing
rather than copy paste based yt tutorials
yeah
as it seems a large amount lose that initial spark after completing the tutorial then slamming into a wall at the end as they dont really know what they just did beyond copy
Perhaps the very same content creators who provide those resources should do more to promote additional learning.
true guess its the balance between in depth and keeping the attention span of the user to learn the "boring" bits
Although it's technically out of scope for this discord server, perhaps there should be a dedicated section which links to learning resources that aren't just youtube tutorials.
I do want to compile a list like that
how can you make your bot reply with a webhook message
webhook message
like
what you mean by that
sun is rising i need to get to bed in a moment 
@vapid pier
like if you wanna make a help command
instead of a normal message
its a webhook with all the cmds
ye
webhook is basically making a subscribable feed of information
oh
yeah
are you using .py lib or .js
js
py is pretty fun
The embed visualiser i dont have the link to rn
Has the ability to export the embed to your choose lib
A guide made by the community of discord.js for its users.
i linked it correctly
so u should get straight to right place @vapid pier
even got an example
What about the visaliser one @topaz sphinx do you have that on you
nah i dont use the visualiser
havent seen that one actually
but its like in html
css, sorry
Let's you export code
And view embed in browser
i am getting this
<rejected> TypeError: Cannot read property 'send' of undefined
at Object.exports.run (C:\Users\chillkey123123123213\Desktop\Chill Beta\discord-bot\commands\remind.js:76:20)
at Client.<anonymous> (C:\Users\chillkey123123123213\Desktop\Chill Beta\discord-bot\bot.js:83:7)
at Client.emit (events.js:189:13)
at MessageCreateHandler.handle (C:\Users\chillkey123123123213\Desktop\Chill Beta\discord-bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\chillkey123123123213\Desktop\Chill Beta\discord-bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (C:\Users\chillkey123123123213\Desktop\Chill Beta\discord-bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\chillkey123123123213\Desktop\Chill Beta\discord-bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\chillkey123123123213\Desktop\Chill Beta\discord-bot\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:189:13)
```
we need to know the function
but to me that looks like you are defining a variable from a request and it didnt get a result
How can i collect all guilds from a user (auth2) ?
@topaz sphinx so you found it?
ive been getting an issue where mine wont tell me how many servers my bot is in when using bot.guilds.size it just says cant read size of undefined
do I need to do anything before I try to get that value?
Not good with js
But doesn't bot.guilds return a list?
I'm gonna assume .size does the same as length then
Also it should be able to run so 
isnt it just bot.guilds.size or client.guilds.size?
depends on how client (or bot) is defined.
token: auth.token,
autorun: true
});``` this is how it is defined, but it still doesnt work
to sho how many servers it is on with bot.guilds.size
@vital nest https://www.youtube.com/watch?v=53zkBvL4ZB4
I try to answer every question I get. Unfortunately a lot of them are extremely low effort and waste my time. I love to help, but please put some work into y...
please watch this video and readjust the given information you provided us
I gave the information I have, when i do var bot = new Discord.Client({ token: auth.token, autorun: true }); bot.guilds.size it returns cannot read value of undefined (some of the info is from my post above
you need to run the last part in an event. due to the async nature of it, that line (bot.guilds.size) will run before the bot is ready, and before all the servers are loaded
I had that in the on bot.load event so once it all loaded
can you paste the new code
token: auth.token,
autorun: true
});
bot.on('ready', function (evt) {
logger.info('Connected');
logger.info('Logged in as: ');
logger.info(bot.username + ' - (' + bot.id + ')');
bot.setPresence({
game: {
name: 'Stat Collection Simulator'
},
status: 'online'
});
console.log(bot.guilds.size)
});
what library are you using
bot.servers
discord.io looks super outdated btw, you might want to consider changing to a newer library (eris, discord.js, etc.)
it was last updated over a year ago (may 2, 2018)
So I'm here now. 😄 But what returns null now? And why it returned a value yesterday till 3PM?
yes
what is the problem?
My bot is not online
it say wrong do
please take a screenshot of the output
Just saying "I am getting an error" does not help
I can add status which tell how many people have that role
Really stupid question but how do you turn on the bot?
you code it
you run the program you just coded
what are you using for the request?
this
var_dump($response)
ok
json_decode is returning NULL, that means its either an invalid json, or it has special characters
Returned nothing?!
why do you have 2 curl_exec? which of them did you dump?
ohh
I didn't see that 😄
I removed the first and still nothing
The token is still returning NULL
so the curl is not returning anything at all?
nope
then something is wrong with your request
try this
if(curl_exec($ch) === false)
{
echo 'Curl error: ' . curl_error($ch);
}
else
{
echo 'Operation completed without any errors';
}```
ok
hmmmm
That is weird
But var_dump($response); returns nothing
And it says error is here:
Because header is sent here
then the only alternative is that the url is wrong and returns a blank page
if i were you i would comment out everything, the entire code, except the curl
and tweak it until it gets the response it should
rip
maybe because you had more than one curl_exec
you were duplicating your requests
might have triggered the ddos protection
I'll try my other application
This is based 😦
Lets use VPN 😉
Rate limited my host server
oof
I think that was the error
thanks
const Discord = require('discord.js')
const client = new Discord.Client()
client.once('ready', () => {
console.log('Ready!');
});
client.on('message', message => {
//console.log(message.content)'
if (message.content.startsWith(` ${prefix}ping`)) {
message.channel.send("Pong.");
}
client.login('no peeking at my token')
I need help.
I can't get it running for that reason.
It says that the client.on('message', message => { is the problem.
I don't know js but i guess you need to put a ; after client.login('token')
Let me test that.
I will update on you, if it works.
Wait.
@knotty steeple Where do i put it?
before you login
const Discord = require('discord.js')
const client = new Discord.Client()
client.once('ready', () => {
console.log('Ready!');
});
client.on("message", async message => {
if(message.author.bot) return;
if (message.content.startsWith(`${prefix}ping`)) {
message.channel.send("Pong.");
}})
client.login('no peeking at my token')
this is what the code looks like now
It is working
But this happened
Anyone know how to make a bot do something when someone sends a message in a spisific channel
For example
just read the error log
Maybe it's my first time coding.
still
I say anything in this channel.
read the error log
hint: prefix var is not fdefined
But the ban doesn’t have to be ban
check if message has been sent in channel
(do name or id check)
then do whatever
Can you show me a exsample
onMessage(Event e){
if(e.getMessage().getChannel().getId() == "ChannelID") {
// do magic
}
}
@earnest phoenix
Thanks
hey does anyone know what is wrong in this
const Discord = require('discord.js');
exports.run = async (client, message, args, tools) => {
if (!message.member.role.find(r => r.name === 'roleName')) return message.channel.send('This requires the role: roleName');
if (!message.member.hasPermission('ADMINISTRATOR')) return message.channel.send('This role requires permission: ADMINISTRATOR');
if (!args[0]) return message.channel.send('Proper Usage: <prefix>poll question');
const embed = new Discord.Message.Embed()
.setColour(red)
.setFooter('React to vote.')
.setDescription(args.join(''))
.setTitle(`Poll Created By ${message.author.username}`);
let msg = await message.channel.send(embed);
await msg.react('✅');
await msg.react('❌');
message.delete({timeout: 1000});
}
@velvet cliff got an error log?
it says this
SyntaxError: Unexpected token const
1:10 PM
at createScript (vm.js:80:10)
1:10 PM
at Object.runInThisContext (vm.js:139:10)
1:10 PM
at Module._compile (module.js:617:28)
1:10 PM
at Object.Module._extensions..js (module.js:664:10)
1:10 PM
at Module.load (module.js:566:32)
1:10 PM
at tryModuleLoad (module.js:506:12)
1:10 PM
at Function.Module._load (module.js:498:3)
1:10 PM
at Function.Module.runMain (module.js:694:10)
1:10 PM
at startup (bootstrap_node.js:204:16)
1:10 PM
at bootstrap_node.js:625:3
code is above but ill send it again
hey does anyone know what is wrong in this
const Discord = require('discord.js');
exports.run = async (client, message, args, tools) => {
if (!message.member.role.find(r => r.name === 'roleName')) return message.channel.send('This requires the role: roleName');
if (!message.member.hasPermission('ADMINISTRATOR')) return message.channel.send('This role requires permission: ADMINISTRATOR');
if (!args[0]) return message.channel.send('Proper Usage: <prefix>poll question');
const embed = new Discord.Message.Embed()
.setColour(red)
.setFooter('React to vote.')
.setDescription(args.join(''))
.setTitle(Poll Created By ${message.author.username});
let msg = await message.channel.send(embed);
await msg.react('');
await msg.react('');
message.delete({timeout: 1000});
}
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Lol
so… do you see the problem?
well im a starter, so.. what does lint your code mean"?
but is there something wrong in the script?
?
use Discord.RichEmbed() instead
May not exactly be your issue but it should be one of your issues at least
also please use code blocks
code blocks?
Like this
Use three backticks at the beginning and end of the message
This will highlight it with the js syntax
ok but there is nothing wrong in my script?
could someone pols help me with a error in my bot?
so basically, i have some stuff set up but its saying to me thast "args is not defined"
send ur code
without token
LOL
oh shoot
i think i might have actually fixed it
wtf
🥚
ok well i guess i had another question
so lemaa, you would be more familiar with this since it is your kick and ban command
is there a way for if someone dms the bot ".ban" or ".kick" it wont crash?
What is your programming language
node js
discord js
js
@earnest phoenix if(message.channel.type === "dm") return;
oh okj
Or !message.guild
should i put that at the very beginning of the kick and ban command?
@earnest phoenix no
Just one time
oh
In the index
not in a command
where should i put it
which part
at the very top?
or bottom
under client.on(message
can you put it in for me
im apperantly braindead
no
but i do not see where it is
like which client on message?
the one before the kick command?
i did it before and it still crashed
Line 26 @earnest phoenix
Put it on line 26
its not
working
@slender thistle i did your way but
now it comes up with this error instead
content with "s"
How did checking if a message is in a guild come to THAT
Spoonfeed
@earnest phoenix try ^
like this right
Remove "s"
And its not on every command
No
In all God blessed fuckery
Also it's message, not msg
I can't open pastebin. Do they have multiple client.on(message) or what
If not, I don't see msg in that screenshot
Oh God
really
@earnest phoenix under client.on(message and replace msg by message
and dont put it on every command
just one times
but this is what it was before
Yeah and remplace msg by message
so no ""?
what?
client.on(msg
no
what the actual
Learn the programming language before getting to Discord bots, thank you very much.
LOL
@earnest phoenix remplace msg by message god
Line 26
I DID
client.on("message", async (message) => {
if(!msg.guild || messsage.channel.type !== 'text') return;
if (message.author === client.user) return;
Buy glasses
client.on("message", async (message) => {
if(!message.guild || messsage.channel.type !== 'text') return;
if (message.author === client.user) return;
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);
is this even close to right
or no
just try that
You have some visuals error
how do i fix it
Really?
i give up
@earnest phoenix you have put "messsages"
With three "s"
@earnest phoenix learn js
yup
exactly
@earnest phoenix js its easy and ask for help for "basics" are not good, just learn js before asking help
Watch Tsc on ytb nice person for learning js quick and easily
Or look js docs
where i should install discord.py?
Go into command prompt and do pip install discord.py
yes
thanks
np
is this the discord.py documentation?: https://discordpy.readthedocs.io
i tink
ok

<:name:emoji_id>
am I doing wrong ?
let member = message.mentions.users.first();
let emote = {
'no': client.emojis.find(e => e.name === 'tickNo'),
'yes': client.emojis.find(e => e.name === 'tickYes'),
};
if(!member) return message.channel.send(fastembed(config.mavi, `${emote = 'no'} Please enter a valid member!`));
i tried ${emote('no')} which didnt work
emote is not a function
emote['no']
also idk if you need to make them strings
you can just do no: client.emojis...
nvm you can make them strings as well
yeah then dont make them strings lol

let emote = {
no: client.emojis.find(e => e.name === 'tickNo'),
yes: client.emojis.find(e => e.name === 'tickYes'),
};```
and then do either emote['no'] or emote.no
i did that
what does your code look like now
let member = message.mentions.users.first();
let emote = {
no: client.emojis.find(e => e.name === 'tickNo'),
yes: client.emojis.find(e => e.name === 'tickYes')
};
if(!member) return message.channel.send(fastembed(config.mavi, `:${emote.no}: Please enter a valid member!`));
oh wait i know why
i placed : to message just in case lol
just do this
finding by name might return a different emoji if another guild has an emoji witht he same name
so you may not have the same result
plus, client.emojis.find will return an Emoji object
so trying to send that whole thing likely wont work because of a message too long error
so... you just dont care about 2 solutions i provided..
ok nvm
trying it rn
lol
i needed to send emote to get id
well uh
:tickNo: aint working
whats your code look like
let member = message.mentions.users.first();
let emote = {
no: client.emojis.find(e => e.name === 'tickNo'),
yes: client.emojis.find(e => e.name === 'tickYes')
};
if(!member) return message.channel.send(fastembed(config.mavi, `:tickNo: Please enter a valid member!`));
damm discord
thats not how you do it smh can you read
oh
discord transforms it
ok i have no idea lmao
thanks for preciuos help
my code is 🍝
const Discord = require ("discord.js");
const fs = require ("fs");
const bc = JSON.parse(fs.readFileSync("./blacklist.json", "utf8"));
module.exports.run = async (bot, message, args) => {
message.delete(message.author);
let staff = ["546968486606536706", "390574128890904579"];
if(!staff.includes(message.author.id)) return message.channel.send("⛔ Tu n'es pas un membre du staff.").then(msg => msg.delete(2000));
let id = args.slice(1)[0];
let raison = args.slice(2).join(" ");
if(!id && raison) return message.channel.send("Usage : `t/addbl (id) (raison)`");
if(bc[id]) return message.channel.send("**❌ L'utilisateur est déjà blacklist.**");
let blacklist1 = new Discord.RichEmbed()
.setTitle("🔒 Une personne en plus dans la blacklist !")
.addField("👤 Utilisateur :", `<@${id}>`)
.addField("🆔 ID :", `${id}`)
.addField("➰ Raison :", raison);
bot.channels.find('id', "583581316423876608").send(blacklist1);
fs.writeFile("./blacklist.json", JSON.stringify(bc), (err) => { if (err) console.error(err);});
message.channel.send(`**✅ L\'identifiant ${id} à bien été ajouté à la blacklist.**`).then(msg => msg.delete(5000));
};
module.exports.help = {
name:"addbl"
};
RichEmbed error at raison.
How can i do ?
knowing the error would help
(node:14936) UnhandledPromiseRejectionWarning: RangeError: RichEmbed field values may not be empty.
thats because raison is undefined or is empty
look, I defined it
then it is empty
huum
Can I count member with a role
Like if the member is having a role member the bot show <user>have role member
I filled it, and its gives the same error
Answering me?
How
just filter member with a role and then do .size
Can you give example?
let roleID = "264410914592129025"; let membersWithRole = message.guild.roles.get(roleID).members; console.log(`Got ${membersWithRole.size}`)
Activity
const Discord = require('discord.js');
exports.run = (bot, message, args, tools) => {
message.delete();
let logs = message.guild.channels.find("name", "logs")
message.delete();
if(!message.member.hasPermission("MANAGE_MESSAGES")){
message.channel.send("Sorry " + message.author + ", You do not have permission to use this command." + \n + "In order to use this command you need: MANAGE_MESSAGES")
return;
}
let botmessage = args.join(" ");
message.channel.send(botmessage);
let logEmbed = new Discord.RichEmbed()
.setTitle("say")
.addField("Moderator:", message.author)
.addField("Channel", message.channel)
.addField("Message", args.join(" "))
.setColor("RED")
logs.send(logEmbed)
}
module.exports.help = {
name:"say"
}
There is no error.
But it doesn't work.
It doesn't delete my command usage or send a message.
Anybody know how to fix this?
Bad return?
gey
.
me pro
Oh yes, I'm sorry you "pro"
@coarse patrol bad return dude
I don't know how to fix it. Just by saying bad return, doesn't fix anything for me.
@earnest phoenix actually, return; is perfectly valid
Idk but no error in the command
how to make database discord.js
@digital sparrow you dont make a database with discord.js, but use literally any existing database that works with javascript
but noone should have to explain that to a "pro"
Google databases for node.js
@coarse patrol show your main file, also use code blocks please
what is mongoose?
A database
there are 2 other things wrong with it as well. deleting the message twice (before even checking if the user can do that) and not passing a function to .find
A library for mongodb
^
how to use it?
Read the docs, read the mongodb website
Tim.
By Code Blocks, you mean the program?
i dont know what that is
lol me use json as a database :v
dont
Json is fine if you know how to use it properly
knowing how stupid 90% of bot developers here are, you will just end up corrupting it
^^^^^^^
If you need light weight, go sqlite
If you need something big and heavy, go mysql or postgre
If you need document style go mongodb
ok
If you need maximum performance go redis
what do you mean by document style?
If you want to be cool, chose any of the other 848295 databases out there
also isnt redis a cache server?
Mongo is documents :^)
Its a ram database with disk persistence
Document style meaning it stores documents instead of tables and rows
a
Documents are similar to js objects
JSON string? 
a string thats json data
Sure it can?
Mongo is useful for being schema-less, meaning yoi dont need to define columns and stick with tjem, yoi can create and edit keys as you need them
yeah that sounds perfect for my use
Are you typing yoi on purpose
yoink
F
F
I hate autocorrect lol
okay
Understandable
hey guys help me make embed page?
what
oh you mean pagination
its ez
yes
do it like
tell me pls
^
askdnadaisdnidoaisd
Uh ok
Think about it... make an array of embed objects, send the first one, and react with number emojis... if the reaction for number n fires, edit that embed message and send the embed of index n-1... pretty basic logic
Theres a tutorial for this
There’s also something called a brain
Now that I think about it I could probably make an npm module for this and it would get decent downloads lol
do it
^
^
^
That'd get many downloads
I just have to modularize some aspects of pre-existing code...
I would use it
Like the class I re-use in my projects is designed to work with Eris... I’d just have to make it d.js-compliant and then publish... prob this weekend
I have a function that turns any array into a paged embed, it could be done with objects aswell
i have a class that should work with every js library iirc
yeah, works with everythin
you handle everything manually tho xd
class paginator {
constructor(client, fields) {
this.client = client
this.fields = fields
this.counter = 0
}
next() {
if(this.counter + 1 < this.fields.length) {
this.counter++
return this.fields[this.counter]
}
}
back() {
if(this.counter - 1 >= 0) {
this.counter--
return this.fields[this.counter]
}
}
}
I just figured out how to make a command I have more efficient but I'm already far as fuck from home
S h i t
@opaque eagle were you actually gonna do that? 
Yeah
How can I use the f parameter in python?
I'm tried this, but I'm getting syntax error 😦
... what is the syntax error?
this





