#development
1 messages · Page 480 of 1
one min Tony lemme check how I did it
ok
@sick cloud i do mine like this
app.use(express.static(`${__dirname}/public`));
then to access it i do ./public/whatever the fuck
A quick-start to documenting JavaScript with JSDoc.
Anyone generous enough to help me add a triggered image over a users avatar using Image Manipulation in JavaScript? Im not too sure how to do it.
Okay
can i do this? msg.mentions.members.first().delete(); 👀
oh
i need to try delete the first mention if ifs the bots mention
since userinfo conflicts
k!userinfo @user returns info for @user
@koya userinfo @user returns info for @koya not @user
and i need to ignore the mention prefix
u can use .delete() on msg.mentions.members
but you will have to specify what you want to delete
oh
is there a better way to do what i need to do?
and i cant filter the mentions by the bots user id since then they cant do @koya userinfo @koya or k!userinfo @koya
@sick cloud best thing would be to parse the mentions yourself
A guide made by the community of discord.js for its users.
ok
theres already a bot named koya 👀
and they mention nsfw on their bot page smh ban them
So, how could I change a setting every day at midnight automatically using python. Like, having a loop played in the background
@sick cloud yeah
oof
I don't need a snippet or anything, just not 100% sure what to google.
can you do a f string and do b'' at the same time in python
or format
something
http://prntscr.com/krwhyv msg is defined
it was working before
i didnt change anything
Are you sure you are looking at the right msg?
i wasnt, sorry, i know the issue now
whats this?
@sick cloud ```js
<Client>.on("error", (err) => {
console.log(err)
})
add that and wait for it to come back
@marble elm that doesnt help
if you dont have anything that actually helps dont say anything
he asked what it was as in what the error means
pls dont troll
I guess you are right but i don't want to run another file tbh
wdym
nvm, is it like a background loop with asyncio?
yes
Could you link me to it
Like some sort of doc
That's what i thought but i'm not 100% sure what i should google
idk about that but i can link you to an example of a background task
that be fine
dm or here?
up to you
Not what i was looking for but i could use it, thx
const db = require("quick.db")
module.exports.run = async (client, message, args, ops) => {
db.startsWith(`guildMessages_${message.guild.id}`, { sort: '.data'}).then(resp=>{
resp.length = 15;
var finalOutput = "**Leaderboard:**\n\n";
for(var i in resp) {
finalOutput += `${client.users.get(resp[i].ID.split('_')[2]).username} -- ${resp[i].data} messages`;
}
message.channel.send(finalOutput)
})
}
module.exports.help = {
names: ["leaderboard", "lb", "l-b"]
}
this just returns
Leaderboard:
and nothing more
Maybe because you're not using a for loop correctly?
https://www.w3schools.com/js/js_loop_for.asp
JavaScript for Loop - W3Schools
Have fun
for...in by the way, is for iteration through objects
I think you are looking for a different type of for loop
Hmm
What are you trying to do anyway?
just map it
I am trying to display
messages sent in the guild
but as a leaderboard
So it does 15 members
and it displays there user names and the amount of messages they sent
resp is what all the messages are stored in
db.startsWith(`guildMessages_${message.guild.id}`, { sort: '.data'}).then(resp=>{
resp.length = 15;
var finalOutput = "**Leaderboard:**\n\n";
for (var i in resp) {
finalOutput += `${client.users.get(resp[i].ID.split('_')[2]).username} -- ${resp[i].data} messages\n`;
}
Read the code figure it out
That's not helpful at all, still have no idea what resp is
.
nothing as I know of
Can you log it and tell me please?
ok
[]
it is an empty array
I need to fix that
Wait
Yea
I don't know why that logs an empty array
You will have to figure that part out
Perhaps because quick.db doesn’t have a startsWith function
Then you would know you don’t want set
how can i get the owners username from scraping?
i need help asap....
this is the error: http://prntscr.com/kry1sl
and this is where the error "comes from":
let serverQ = serversQ[msg.guild.id];
function play(connection, msg){
serverQ.dispatcher = connection.playStream(YTDL(serverQ.queue[0],{filter: 'audioonly'}));
serverQ.queue.shift();
serverQ.dispatcher.on("end", function() {
if (serverQ.queue[0]) play(connection, msg);
else connection.disconnect();
}); };
very clear
serverQ.queue[0]
thats an object
does your queue object have a url or video id or something?
supposed to be url
how can i get the owners username from scraping?
aye how would mine be fixed, I'm a bit new to object things, pretty different from lua ;-;
@sick cloud from dbl, for dbl command
does your object have a key like .url?
uh
@earnest phoenix why are you scraping
theres an api
yes api from
yes
you shouldnt scrape a bots page
google javascript tutorials and read #rules-and-info 7b
i'm not going to help further, you can figure it out on your own
mk
How would I define newChannel?
I am making a
set channel
so it logs when members join and shit
I will show code
let newChannel =
db.set(`pmessageChannel_${message.guild.id}`, newChannel).then(i => {
message.channel.send(channelEmbed)
I need a package of packages for bot development with node.js could anyone tell me?
@vernal rivet Also ich ahbe einen Command und ich möchte das wenn man dne Ausführt das der bot eine EInladung erstellt und dann in einen Channel sendet Nur ich weis nciht wie das geht.
Is there a way I can do like a secret code and if you get that code correct it will send out a message?
like
!6534
outputs: <secretmessage>
Create an array of the codes, then when a message starts with the prefix, check if the command starts with any of the codes in the array
there are probably better ways to do that
yea
I was going to do one code
so like
var secret = "code"
that part is not a problem
if that doesn't work
then I will do an array
the thing I need is how to tell if they used one of the codes
Idk how to do that
wait so like how are you triggering commands
I want to figure out how to tell
if they use the code
I can do the rest
all i need is the code
thingy
yeah I'm not familiar with JavaScript but you can do something like this:
var secretCode = "spoopy";
if (msg.content.startsWith("!" + secretCode)) //if the message starts with "!spoopy"
{
//do some code here
}```
you mean like that?
wait do you already have a system in place for handling that?
?
like do you know how to make a mention the prefix?
I already have that set up...
It works
The bot is far into development
it is a remake
and I been working on it for a week
well just replace the "!" in my example with whatever you're using, then :P
So how do you input what the syntax is for each command?
er like
if you wanna add "!test", how do you attach the method to "test"?
not sure if that makes any sense it's 2am
I am not understanding
if(secret) return message.channel.send(embed)
if(!secret) return ("Code incorrect")
would something like that work?
Well
I still need a way to detect if they said the secret code
currently reading up on how command handlers work in d.js 
How I would do it is add a command that's like, "!secret", and then have the second word be the secret code
like "!secret 1234"
and that should be fairly straightforward I think
If you did that, and just checked if the command was right or not, then every message starting with ! would trigger "code incorrect" if I'm reading this right
@idle mountain that should be simple.
get the args and compare it
lol
right tag now
@remote heart ok
does anyone know how to make a bot to send an invitation when joining a discord server? kartoffel is wanting to know how to do that
is there an easy way to get the total amount of channels the bot is connected to in eris
Voice or all channels?
@bright spear all channels, my deepest apologies for the late reply good sir
Need help coding following:
Custom prefix per server
Stats about my bot, eg how many guilds its in and users etc inv links etc
A way for a command to set the value for a command per guild,
pm me pls
Oh hey it’s Blake
?
@wise raptor lib?
node.js i believe
Node is not a library
what u mean

Derpy no bulli
im confused, pm me please
im not bulli
No need
im thonking
What discord library do you use
discord.js
Ok thank you
that what u mean?
Do you use a command handling framework?
dont think so
Or do you listen to message event
No, json for now, but will need to setup sql soon
You absolutely need
First of all set up a database
You can use noSQL if you want just not json files
Then make some kind of connector to the database
would u mind helping me?
Just ask any questions here
idk how to code it
Then learn
thats why im here
Wth, what are you trying to learn? o.O
how to make the commands
In what language?
node
^
node is not a language 
node is a shit language
Node is not a language
therefore, its a shit language
You can't put adjectives on nothing
Your point is contradictory
That's stupid, though
If you're going to describe node, at least refer to it as a runtime
if you havent noticed, mr. smart guy, im memeing
very obvious. (not)
Kinda hard to tell who's being serious and who's not through text
understandable, have a nice day

hello
if(message.content.includes('discord.gg')){
if(message.member.hasPermission("MANAGE_GUILD")) return;
if(!message.channel.guild) return;
message.delete()
var command = message.content.split(" ")[0];
let muterole = message.guild.roles.find(`name`, "Muted");
if(!muterole){
try{
muterole = await message.guild.createRole({
name: "Muted",
color: "#000000",
permissions:[]
})
message.guild.channels.forEach(async (channel, id) => {
await channel.overwritePermissions(muterole, {
SEND_MESSAGES: false,
ADD_REACTIONS: false
});
});
}catch(e){
console.log(e.stack);
}
}
if(!message.channel.guild) return message.reply('** This command only for servers**');
message.member.addRole(muterole);
const embed500 = new Discord.RichEmbed()
.setTitle("Muted Ads")
.addField(`** You Have Been Muted **` , `**Reason : Sharing Another Discord Link**`)
.setColor("c91616")
.setThumbnail(`${message.author.avatarURL}`)
.setAuthor(message.author.username, message.author.avatarURL)
.setFooter(`${message.guild.name} `)
message.channel.send(embed500)
message.author.send('` انت معاقب ميوت شاتي بسبب نشر سرفرات ان كان عن طريق الخطا **ف** تكلم مع الادارة `');
}
})```
this code sand DMS
this code if one sand link invite tall him you are muted to unmute plz call satff
Ok
how ican make him not work on this server
i mean how i can delete dms
sorry for bad english
if (message.guild.id === 'this server's id') return;
At the beginning
Black List
Good idea
@spring ember
if(message.content.includes('discord.gg')){
if (message.guild.id === '264445053596991498') return;
if(message.member.hasPermission("MANAGE_GUILD")) return;
if(!message.channel.guild) return;
message.delete()
var command = message.content.split(" ")[0];
let muterole = message.guild.roles.find(`name`, "Muted");
if(!muterole){
try{
muterole = await message.guild.createRole({
name: "Muted",
color: "#000000",
permissions:[]
})
message.guild.channels.forEach(async (channel, id) => {
await channel.overwritePermissions(muterole, {
SEND_MESSAGES: false,
ADD_REACTIONS: false
});
});
}catch(e){
console.log(e.stack);
}
}
if(!message.channel.guild) return message.reply('** This command only for servers**');
message.member.addRole(muterole);
const embed500 = new Discord.RichEmbed()
.setTitle("Muted Ads")
.addField(`** You Have Been Muted **` , `**Reason : Sharing Another Discord Link**`)
.setColor("c91616")
.setThumbnail(`${message.author.avatarURL}`)
.setAuthor(message.author.username, message.author.avatarURL)
.setFooter(`${message.guild.name} `)
message.channel.send(embed500)
}
})```
why the extra spaces in the guild id?
also, is this the only command the bot has? or you have more commands?
yes, it should work
❤
I made a help list reaction works
This is good or there is better
Looks good to me
One of mine bot's looks like this
if you need my code tall me
What for? I am good with mine
Your looks more compact, mine looks more beautiful
In JavaScript, is there a .endsWith() function or whatever it's called?
yes
Cheers
if(args[0] !== '2004') {
var embed = new Discord.RichEmbed()
.setTitle("")
.setDescription(``)
.setImage("")
message.channel.send(embed)
does anyone know why this is not working?
Because there is sorta nothing to sent?
...
@marsh lark have a problem?
you lol
jk was just surprised
Well
do you receive any error?
someone in
discord.js offical server
said that
args[0] !== "password"
would work
so like you do
@quartz dune secret <passwordhere>
Should I take a guess what args is even
Ok
Does anyone know how to make it so they have to have a password to use the command?
cause this way is not working
oof
could I do
message.content.includes(${secret})
hi
Good morning I would like a little help with a code I have for {server info}
I try to put the photo I took to dig you the code and it does not leave me!
wut
this is my code
but when I write the command {* server info} the bot does not respond
`if(command === "serverinfo") {
module.exports.run = async (client, message, args) => {
const verificationLevel = message.guild.verificationLevel;
const verificationLevels = ['None', 'Easy', 'Medium', 'High', 'Extreme']
const embed = new Discord.MessageEmbed()
.setDescriprion(${message.guild.name}'s info)
.setThumbnail(message.guild.iconURL("https://cdn0.iconfinder.com/data/icons/law-crime-and-justice-1/32/detective-crime-criminal-investigate-investigation-suspect-gangster-512.png"))
.setFooter(message.guild.owner.user.tag, message.guild.owner.user.avatarURL("https://cdn0.iconfinder.com/data/icons/law-crime-and-justice-1/32/detective-crime-criminal-investigate-investigation-suspect-gangster-512.png"))
.setTimestamp()
.addField('Server Name', ${message.guild.name}, true)
.addField('Server ID', ${message.guild.id}, true)
.addField('Server Name', ${message.guild.owner.user}, true)
.addField('Owner ID', ${message.guild.owner.id}, true)
.addField('Members', ${message.guild.members.filter(member => member.user.bot).size} bot of ${message.guild.memberCount} members, true)
.addField('Channels', ${message.guild.channels.filter(channel => channel.type === 'voice').size} voice / ${message.guild.channels.filter(channel => channel.type === 'text').size} text, true)
.addField('verification Level', ${message.guild.verificationLevels[message.guild.verificationLevel]}, true)
.addField('Server Region', ${message.guild.region}, true)
.addField('AFK Channel', ${message.guild.afkChannel}, true)
.addField('Created', ${message.guild.createsAt}, true)
.setColor('RANDOM')
message.channel.send(embed)
}
}`
3x `
^
I do not know how to put my code in a block
module.exports.run = async (client, message, args) => {
const verificationLevel = message.guild.verificationLevel;
const verificationLevels = ['None', 'Easy', 'Medium', 'High', 'Extreme']
const embed = new Discord.MessageEmbed()
.setDescriprion(${message.guild.name}'s info)
.setThumbnail(message.guild.iconURL("https://cdn0.iconfinder.com/data/icons/law-crime-and-justice-1/32/detective-crime-criminal-investigate-investigation-suspect-gangster-512.png%22))
.setFooter(message.guild.owner.user.tag, message.guild.owner.user.avatarURL("https://cdn0.iconfinder.com/data/icons/law-crime-and-justice-1/32/detective-crime-criminal-investigate-investigation-suspect-gangster-512.png%22))
.setTimestamp()
.addField('Server Name', ${message.guild.name}, true)
.addField('Server ID', ${message.guild.id}, true)
.addField('Server Name', ${message.guild.owner.user}, true)
.addField('Owner ID', ${message.guild.owner.id}, true)
.addField('Members', ${message.guild.members.filter(member => member.user.bot).size} bot of ${message.guild.memberCount} members, true)
.addField('Channels', ${message.guild.channels.filter(channel => channel.type === 'voice').size} voice / ${message.guild.channels.filter(channel => channel.type === 'text').size} text, true)
.addField('verification Level', ${message.guild.verificationLevels[message.guild.verificationLevel]}, true)
.addField('Server Region', ${message.guild.region}, true)
.addField('AFK Channel', ${message.guild.afkChannel}, true)
.addField('Created', ${message.guild.createsAt}, true)
.setColor('RANDOM')
message.channel.send(embed)
}
}```
iconURL isnt a function neither is avatarURL, only time it would be is if you are using master
do you want me to send you and my sub bot code?
to get the url from iconurl & avatarurl
I removed it but still does not do something
show the new code so i can see what you changed
your name was changed because it starts with © which makes your name appear first in the list ->>>>
module.exports.run = async (client, message, args) => {
const verificationLevel = message.guild.verificationLevel;
const verificationLevels = ['None', 'Easy', 'Medium', 'High', 'Extreme']
const embed = new Discord.MessageEmbed()
.setDescriprion(`${message.guild.name}'s info`)
.setThumbnail(message.guild.iconURL())
.setFooter(message.guild.owner.user.tag, message.guild.owner.user.avatarURL())
.setTimestamp()
.addField('**Server Name**', `${message.guild.name}`, true)
.addField('**Server ID**', `${message.guild.id}`, true)
.addField('**Server Name**', `${message.guild.owner.user}`, true)
.addField('**Owner ID**', `${message.guild.owner.id}`, true)
.addField('**Members**', `${message.guild.members.filter(member => member.user.bot).size} bot of ${message.guild.memberCount} members`, true)
.addField('**Channels**', `${message.guild.channels.filter(channel => channel.type === 'voice').size} voice / ${message.guild.channels.filter(channel => channel.type === 'text').size} text`, true)
.addField('**verification Level**', `${message.guild.verificationLevels[message.guild.verificationLevel]}`, true)
.addField('**Server Region**', `${message.guild.region}`, true)
.addField('**AFK Channel**', `${message.guild.afkChannel}`, true)
.addField('**Created**', `${message.guild.createsAt}`, true)
.setColor('RANDOM')
message.channel.send(embed)
}
}```
avatarURL and iconURL are not functions
Question
How would I make a image from
imgur
be sent out in an embed
with the link for that image
to remove these two?
I know how to do
.setImage
but
the image just comes up
like it failed to load
so it has something to do with the imgur link
does the image exist
whats the link
@west raptor what exactly do I have to do with () ??
^
only in master its a function
just like .id and .username
It is
I just removed the part that will take you to it
cause
the image is something I don't want anyone but one person to see
/a/ is usually an album link, not an image
it has to be the direct url
ending with .jpg or .png
yes
yes
ok
cause
I dont really want to share the image on internet either
so can I like do
use node's fs.readFile
yes
I will try
servers the bot is in?
what did you write?
this

https://samuraistacks-leader-of-the.succ.world/i/77apjbdq.png how do i remove the white line
i do it
also @viral iris , delete your server invite, because posting invites is against the rules
done
yes
can someone help me
this is my entire code https://prnt.sc/ks3jd1
now try js msg.channel.send({"files":[new discord.Attachment(file, "filename.png")]})
wdym remove the white line @knotty steeple ?
in photoshop or what
you want to edit an image with css?
its not the image
@earnest phoenix you didnt change anything
@knotty steeple where is that image? can i access it?
i mean, in the page/website
@quartz kindle 1 min
so i can see it with css, to understand what you want
@quartz kindle
view your messages
@lusty dew embed.attachFile(file) embed.setImage("attachment://name.jpg")
embed.setImage("link")
@earnest phoenix again, you didnt change anything. we told you to remove () and you didnt
lmao
C:\Users\User\Desktop\LoverBot v3\commands\secret.js:13
embed.setImage(attachment: ha.png)
^^^^^^^^^^
SyntaxError: missing ) after argument list
at new Script (vm.js:74:7)
at createScript (vm.js:246:10)
at Object.runInThisContext (vm.js:298:10)
at Module._compile (internal/modules/cjs/loader.js:670:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
'bot.guild.size' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .
i already said what to do @lusty dew
embed.setImage("attachment://name.jpg")
Idk
image link
Nothing happened
any errors?
there is no error
at Object.module.exports.run (C:\Users\User\Desktop\LoverBot v3\commands\sec
ret.js:12:25)
at Client.client.on (C:\Users\User\Desktop\LoverBot v3\index.js:71:31)
at Client.emit (events.js:187:15)
at MessageCreateHandler.handle (C:\Users\User\Desktop\LoverBot v3\node_modul
es\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\User\Desktop\LoverBot v3\node_mod
ules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (C:\Users\User\Desktop\LoverBot v3\node_modu
les\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\User\Desktop\LoverBot v3\node_mod
ules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\User\Desktop\LoverBot v3\node_modules\ws\li
b\event-target.js:120:16)
at WebSocket.emit (events.js:182:13)
at Receiver._receiver.onmessage (C:\Users\User\Desktop\LoverBot v3\node_modu
les\ws\lib\websocket.js:137:47)
I don't understand
show code
I have discord defined
need more context
under what name?
rip
then Discord.attachment
wit guys he speak arabic
you don't speak arabic ?
ok
Wth
xD
File is undefined
@quartz kindle
which file
fs.readFile("ha.png", (err, file) => {
if(err) console.log(err)
})
file on that
is greyed out
show full code
readFile is async
full code of reading it
meaning either use async await function
or you have to put the entire embed code
inside the readfile(=>{//code})
show full code
or use readFileSync
but readFileSync is blocking, meaning while the file is being loaded, the bot will freeze until it finishes
although it usually takes like 1 ms
Ok
so you wont feel it pretty much
what do you mean grayed out
that doesnt mean anything. its just your editor trying to guess what is it
its grayed out since u didnt use it?
editors have themes, thats why they are different colours
again, show full code
ReferenceError: file is not defined
at Object.module.exports.run (C:\Users\User\Desktop\LoverBot v3\commands\sec
ret.js:12:44)
at Client.client.on (C:\Users\User\Desktop\LoverBot v3\index.js:71:31)
at Client.emit (events.js:187:15)
at MessageCreateHandler.handle (C:\Users\User\Desktop\LoverBot v3\node_modul
es\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\User\Desktop\LoverBot v3\node_mod
ules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (C:\Users\User\Desktop\LoverBot v3\node_modu
les\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\User\Desktop\LoverBot v3\node_mod
ules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\User\Desktop\LoverBot v3\node_modules\ws\li
b\event-target.js:120:16)
at WebSocket.emit (events.js:182:13)
at Receiver._receiver.onmessage (C:\Users\User\Desktop\LoverBot v3\node_modu
les\ws\lib\websocket.js:137:47)
i havent used fs to read a png so cant help
const Discord = require("discord.js")
module.exports.run = async (client, message, args, ops) => {
var secret= "284956042851516416"
if(message.content.includes("2004")){
if(!message.content.includes("2004")) return message.reply("Sorry code incorrect")
var embed = new Discord.RichEmbed()
.setTitle("Secret")
.setDescription(`${Secret}`)
.attachFile(new Discord.Attachment(file, "ha.png"))
.setImage("attachment://ha.jpg")
message.channel.send(embed)
}
}
module.exports.help = {
names: ["secret"]
}
you sending from local storage?
where is the fs.readfile?
in my index.js
i think he has it in index?
it has to be in the command file to use file
are you loading the image globally?
its a good think actually
load the image once, and have it saved in a variable
but then you need to pass it along with your commands
you can probably add it to an unused client property
but then if you're doing it on load, then better use readFileSync
^
client.secretimage = fs.readFileSync("file.png") //index.js
new Discord.attachment(client.secretimage,"name.png")
Oh
Ok
So I have to put
client.secretimage = readFileSync("file.png")
in index.js
yes, preferably right after client and fs are defined
also, its fs.readFileSync()
my mistake
also, according to discord.js docs (stable v11)
you can actually do it without new attachment
TypeError: Discord.attachment is not a constructor
at Object.module.exports.run (C:\Users\User\Desktop\LoverBot v3\commands\sec
ret.js:14:21)
at Client.client.on (C:\Users\User\Desktop\LoverBot v3\index.js:69:31)
at Client.emit (events.js:187:15)
at MessageCreateHandler.handle (C:\Users\User\Desktop\LoverBot v3\node_modul
es\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\User\Desktop\LoverBot v3\node_mod
ules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (C:\Users\User\Desktop\LoverBot v3\node_modu
les\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\User\Desktop\LoverBot v3\node_mod
ules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\User\Desktop\LoverBot v3\node_modules\ws\li
b\event-target.js:120:16)
at WebSocket.emit (events.js:182:13)
at Receiver._receiver.onmessage (C:\Users\User\Desktop\LoverBot v3\node_modu
les\ws\lib\websocket.js:137:47)
cause
it is Discord.Attachment
ok
if im reading the docs correctly you can do embed.attachFile({"attachment":client.secretimage,"name":"filename.jpg"}); embed.setImage("attachment://filename.jpg")
the name you want the file to be
Ok
it appears in the image url and in the name if the person downloads the image
Also
if someone doesn't input the correct code
how can I make it so it sends out
a message saying Sorry incorrect code
if(message.includes) {} else {}
that is the opposite
if(!message.content.includes) { message does not include } else { message includes }
the ! makes it the opposite
Ohhh
Ok
if(message.content.includes("")){
return message.reply("Sorry code incorrect")
var embed = new Discord.RichEmbed()
.setTitle("Secret")
.setDescription(`${Secret}`)
.attachFile({"attachment":client.secretimage,"ha":"ha.jpg"})
.setImage("attachment://ha.jpg")
message.channel.send(embed)
}
so like that?
that will make it always say "sorry code incorrect"
also, be aware that .includes means the person can write it anywhere in the message
like !command ouoqwbvoq qowe owe owie wienoviwev secretcode ieygibgowbowiegp
and it will work
Oh
damn
I don't want that
~<
I forgot includes did that
could I do
message.content("secret")
or no
content isnt a function
use the args that you already have
May I just add, try to avoid fs.readFileSync and other synchronous methods
It doesn't matter
as soon as the person uses the command that I made it for
I am deleting it
Just say you don't care
Just trying to give you some advice...
you can use the sync method in this case, as its loading the file only once and then keeping it in memory
using async here wont give you any advantage, other than maybe a millisecond faster startup
i'd say understanding when and why to use which method is more important
I know that not many people includ this in their bots howewver i found a random pig API which took for ever to find lol its https://www.pigrandom.xyz/ lol just thought id share it :p
http://prntscr.com/ks59dd py I am online and ready, logged in as 451347311637823498 Ignoring exception in on_ready Traceback (most recent call last): File "C:\Program Files (x86)\Python36-32\lib\site-packages\discord\client.py", line 221, in _run_event await coro(*args, **kwargs) File "AnimeNameHere.py", line 15, in on_ready bot.load_extension(cog) File "C:\Program Files (x86)\Python36-32\lib\site-packages\discord\ext\commands\bot.py", line 698, in load_extension raise discord.ClientException('extension does not have a setup function') discord.errors.ClientException: extension does not have a setup function
probably
@earnest phoenix there is client.destroy()
.destroy()
Logs out, terminates the connection to Discord, and destroys the client.
well I meant
like
it starts a client.on("message" thing and then if a thing is true it stops listening
obvs ik there's other ways to do it but yeye
are you saying to make an event to make the bot to stop listening if x happens?
kinda
so what is it that your trying to do? i wasn't here when you saying that
ok
h
@remote heart Hast du es Kartoffel herausgefunden?
http://prntscr.com/ks59dd py I am online and ready, logged in as 451347311637823498 Ignoring exception in on_ready Traceback (most recent call last): File "C:\Program Files (x86)\Python36-32\lib\site-packages\discord\client.py", line 221, in _run_event await coro(*args, **kwargs) File "AnimeNameHere.py", line 15, in on_ready bot.load_extension(cog) File "C:\Program Files (x86)\Python36-32\lib\site-packages\discord\ext\commands\bot.py", line 698, in load_extension raise discord.ClientException('extension does not have a setup function') discord.errors.ClientException: extension does not have a setup function
isnt .removeListener a thing in node.js
can anyone help with this
@quartz kindle ?
that looks like py
oh ok, i can't help you, i use discord.js
oof
so afaik u can do client.removeListener or import emitter yourself and use it like that
yeah, it should be client.removeListener('message', callback);
look's like they managed to break my bot 2 time while trying it with this :S
can someoen explain
OOF
wrong channel
Ok
Well umm
I need help
I keep getting pictures of dogs
even though the url is for horses
Oh wait
nvm
I missed part of the code
lol
@west raptor you didnt import asyncio lol
and if it doesnt load that cog again make an __init__.py file
and do not put nothing in that file, it will be deleted after startup
the fuck you do
ok then
neither do i
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})```
do i put this in the discord js ready function
or outside of it
@Neko Ali, Oh no, an error occurred: query is not defined. Try again later!
That is the error I got
.query({ 'filter[text]': query });
const body = JSON.parse(text);
if (!body.data.length) return message.reply('Could not find any results.');
const data = body.data[0].attributes;
const embed = new MessageEmbed()
.setColor(0xF75239)
.setAuthor('Kitsu.io', 'https://i.imgur.com/lVqooyd.png', 'https://kitsu.io/explore/anime')
.setURL(`https://kitsu.io/anime/${data.slug}`)
.setThumbnail(data.posterImage ? data.posterImage.original : null)
.setTitle(data.canonicalTitle)
.setDescription(shorten(data.synopsis))
.addField('❯ Type', `${data.showType} - ${data.status}`, true)
.addField('❯ Episodes', data.episodeCount || '???', true)
.addField('❯ Start Date', data.startDate ? new Date(data.startDate).toDateString() : '???', true)
.addField('❯ End Date', data.endDate ? new Date(data.endDate).toDateString() : '???', true);
this is the code
Did somebody got an snippet for a vote webhook in python?
I just lost like 20 braincells reading these messages from like 12:00 today
What is english
guys can i add a field without title to my embed?
i mean
.addField("", "bla bla bla bla", true)
set the title to an invisible character
how
just put an invisible character there...
ok
idk, i got it off twitter
i copy it from your message
@earnest phoenix some code editors show invisible characters as dots
it doesnt actually look like a dot
yw
.query({ name: card })
How could I define card?
The website isnt down wait what?
k but what is it
Info
from Kitsu anime
Attack on Titan Season 3
I am trying to make a Kitsu command
Is it stupid that I made a bot that just posts updates and rules... 
wdym?
you do pm:compose [msg]
and it @-everyone's
it could be used for updates and rules
its pointless I think
but how should I know

Always good to learn the fundamentals before doing a discord bot
That's very contradictory then? 
Is there a difference?
Discord JS in just a library for Discord
Essentially you're making a bot for Discord
lmao
Always good to elaborate when you talk
why r u taking it so personally
Cause
I am not in the mood right now
a lot of shit is going on in my life
and it gets to me after a while
I mean, I can understand that to an extent
there's no point in taking it out here, if you're not going to be patient and kind then don't chat in a development channel
But, saying something incorrect and using that as an excuse, that's kind of sketchy
how about both of you just go on your own fucking ways alright kiddos?
What was incorrect
I'm not talking about right now per se
Referring to earlier when you were talking about node as a library
I'm not saying it isn't
well guess what both of you are arguing now just leave the situation alone
Do you even know what's going on?
how do you deny permissions to a channel for @everyone in d.js v12?
i got this:
const ticket = await msg.guild.channels.create(`ticket-${msg.author.username}`,
{ type: 'text', topic: `New ticket opened by ${msg.author.tag}.`, overwrites: [
{ id: r1.id, allowed: ['SEND_MESSAGES', 'READ_MESSAGES'] },
{ id: r2.id, allowed: ['SEND_MESSAGES', 'READ_MESSAGES'] },
{ id: msg.author.id, allowed: ['SEND_MESSAGES', 'READ_MESSAGES'] },
{ id: msg.guild.id, denied: ['SEND_MESSAGES', 'READ_MESSAGES'] }
]});
but msg.guild.id doesn't work
cant really test the effect of this by maybe try something alogn the lines of msg.guild.roles.get('name', 'everyone').id;
as the id
the name is @everyone
are you sure
whenever you tag someone
discord automatically adds a @ in the beginnign
for example
@steel drum
same w roles
but thatll just give me the guild id @steel drum
aka pointless code
@earnest phoenix ytdl and stuff is all broke now
is it possible to embed links in richembed descriptions
.-.
its an unfixable bug tho
but its not a bug
its yt
ik
👌





