#development
1 messages Β· Page 625 of 1
This is what I get.
What's your Python version
3.5.4
Never really figured out the difference between f strings and .format()
is it that fstrings are just faster orr
I think I've heard someone say that
pip install -U discord.py
I want to make a welcome message function for my bot. And I need the f parameter. So how can I "f" the msg?
Here is my code:
@jolly sentinel faster, better looking
true
@lime fiber format? "{} is cool".format('DBL')?
But this is a customizable message
I'm not sure what your actual question is
Do you know the welcome message function in the bot like mee6 or dyno.
I want the same.
The user will able to set his own message.
And I want to the bot display that message.
With eg: mentions , server name
etc...
User: !welcomeset {server.name} is cool!
Bot: literally saves the message as "{server.name} is cool!"
Bot when someone joins: msg.format(server=Some_Server_Instance)
π€
But i want to do it with the f parameter because it will allow the users to set eg: server.name server.id member.name, member.mention etc.....
f parameter what?
User: !welcomeset #joins Welcome {member.mention} on {server.name}.
For eg
It saves the msg
But it sends the raw text
With f-string you would most likely define variables and then use them
aka server = message.server, etc.
I know it but my but is used on 75 servers
Just front end
My send this:
Just save yourself a headache and use .format(server=..., member=...)
ok i'll trx it
Saving an entire html page?
Just make sure the site is fine with a web crawler first
No saving data from kt front ended
I'm getting this
WIll you ever post full traceback immediately
Me?
I have no fucking idea what you are doing .mention on
@lime fiber for future reference 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...
π
can we pin that video please
Who will watch it, though?
tru
@slender thistle do u know how can i save data with front end only
<script></script>
Lol i need js
See if BS4 can scrape the js part, idk and I currently have no time
what do you mean save data with front end?
Also, isn't front end HTML + CSS and back end JS?
js is both
π cool
Lol
js was baiscally front end only
Tim
until node happened
you cant really save data in front end
you want to save data on each user's pc?
unless browser cache
like website settings?
there are many storages for that
like localstorage, sessionstorage, indexedDB
you can save user information in them so that your page remembers their information when they come back
@quartz kindle okay so i have a website like google docs i got all editor n stuff working all i need now is save the data they type in editor and i cant figure that put
where do you want to save it?
then you have to use backend not front end
front end is for temporary things, you cant store permanent stuff in front end
send a POST request
Is it possible to have a bot list/read local files?
I tried finding an answer online and got mixed results.
What language
Javascript. I think that's the default one for bots.
Looking for a dev that can code in Java script for a sneaker bot
Will be paid well message me if interested or if you know anyone who is
No one does that, also #general @earnest phoenix
Thereβs no real βdefaultβ language for Discord bots, and youβre looking for fs @viral plover
Okay, so it is possible. Great, thanks!
What all languages can be used then?
Any language that can make a http call
But a bot accessing a users files isnt possible afaik
And probably highly against tos
I intend for it to read my files, not other users.
Wait were you talking about a discord bot?
Yes.
I think it'd have to be running on your local machine to access your files
That's the plan.
Then if you use node you can use filesystem (fs)
Yeah, youβd use fs.readdirSync() for folders and fs.readFileSync() for files
just for reading your local files, fs is enough
or you can be like me and just do exec('cat example.txt') and get the output
Lol
I have another question :D
So here is my code. As you can see I mention a channel and I want it in discord.Channel.
And this is the error i got:
I'm sorry but what is that even supposed to do? 
I want an interactive setup for my welcome system.
And here I need to mention a channel
wait_for_message most likely has a check kwarg that accepts a function
But how can I convert the input into discord.Channel
I'll show it in a better way π
just a minute
So this is it
And this is the error what i get
I don't remember if async d.py had text channel converter
Time to install async...
Make your own or force people to mention the channel
But when I mention a channel I get that error
yep
Where the fuck did you get the idea to make that a parameter for Channel object then
Basic example:
The check keyword argument can be used to pass in more complicated checks and must be a regular function (not a coroutine).
It has author and channel kwargs, why don't you use those
Don't create d.py objects yourself
Why I need to use the channel kwargs?
It is for: channel (Channel or PrivateChannel or Object) β The channel the message must be from.
Bot waiting for X's message, user replies to someone else in another channel, bot sees that message
Ok, but that's not for this problem
I pointed out the problem
- You are creating an instance of Channel, which is:
1.1) bad for you
1.2) wrong for your usage case - https://discordapp.com/channels/264445053596991498/272764566411149314/583710810908524544
- wait_for_message returns Message object, which has
channel_mentionsproperty
Do you know @vale fiber
Saw it do its job before
I want the things like this
It asks you for the name of the channel, so do you want the name or a mention of a channel
I want the same as that bot
Ok, but what can i do if i want to return a channel
You use discord.utils.get where the iterable is [channel for channel in server.channels if channel.type is discord.ChannelType.text]
server in that case would be msg.server if you put your wait_for_message under msg variable
But it won't get the channel which the user wrote into the chat
ok, i'll give a try, thanks
It worked, but only when I wrote the name. When I write a channel mention it returns NoneType
sigh
if not answer2.channel_mentions:
discord.utils.get(...)
else:
get first element of channel_mentions, which is a list
ok, thanks
And can you please send me the example for the get first element of channel_mentions, which is a list
If you knew Python, you wouldn't need me to help you with that
Please
But I found nothing about it. i searched before I asked this.
Python Lists - Learn Python in simple and easy steps starting from basic to advanced concepts with examples including Python Syntax Object Oriented Language, Methods, Tuples, Tools/Utilities, Exceptions Handling, Sockets, GUI, Extentions, XML Programming.
Oh I got it, thanks π
@gleaming geyser do you use Repl?
How do I assign a variable in python
Lel
I?
I feel like that's async and not rewrite
Yes
lame
I PR3F3R 4WAIT!1!1!1!1!1!1!1!1!1!1!1!1
What the fuck is going on here
Because I'm learning discord.py
This channel is so full of autistic shit ngl
Yeah but when was it not
discord.py had a version 0.16.12 which is also called async
Whenever you say "async or rewrite", what do you expect people who have used d.py for a while will think you mean
I think most people know this
Ok
And do I seriously need to go all the way up in this channel to demonstrate the difference between d.py 0.16.12 and 1.0.0+ again

The only reason that it looks like async to me is because I only saw the channel.send(), which is something I thought async did for their message sending
Got it
Messageable.send is rewrite+
Nah
Can someone teach me how to make a application like for say a website or just like something you can download and use?
depends on the language
Iβm trying to code in js
lol
use this to make your app selfcontained https://github.com/zeit/pkg
K
Does someone have a idea on how to speed up this SQL query?
SELECT
currentbotdata.botname,
(currentbotdata.points - (SELECT points
FROM botdata
WHERE currentbotdata.botid = botdata.botid
AND botdata.time >= DATE_SUB(NOW(), INTERVAL 1 DAY)
ORDER BY time ASC
LIMIT 1)) AS pointslast1d
FROM currentbotdata
WHERE deleted = 0
ORDER BY pointslast1d DESC;```
I was hoping that I would be able to solve it without having to save the data somewhere, but rn this query takes 22 seconds which would be unusable for a website 
can you create another db to store the results of the mathematical expressions?
i would be able to
and make sure to use InnoDB with plenty of ram
i was just hoping that i didnt have to
then i'll do that 
How would I make a bot do something when something sends anything in a certain channel. (Discord.js) for example I send this message in the channel and it would do something like delete this message or ban the member.
@earnest phoenix read this: https://discordjs.guidejs client.on('message', (message) => { // code here will run on message // javascript is event based and this is an event handler // the message parameter stores the message object that triggered this event console.log(message); // this will log the object for you });
hi syz
helo
@earnest phoenix thats actually useful for me thanks
res.body.type = ["Type", "On"]
.addField('ββ· β Type', 'β β· β ' + res.body.type.forEach(function(element) {element})) give:
ββ· β Type
β β· β undefined
I do not solve the problem
.forEach() doesnt return anything
also your forEach is doing absolutely nothing
just do res.body.type
how to make event handler discord.js?
do a ritual and pray for the best
const client = new Discord.Client();
client.on(event_name, callback_function);```
snek case π€’
oh..
@barren brook learn java for application
fantastic advice
you can make desktop apps with any language. you dont have to learn a special language for it unless you want to do something very specific that only a few languages provide
even better advice dont touch java because it's mission impossible to write optimized code that doesnt mem leak
and if you wanted to recommend a general language for desktop apps, id argue that c++ is a better language to suffer with than java
it's mission impossible to write optimized code that doesnt mem leak
"i can't write it so it's obviously a bad lang for some random reason"
^ how i feel about literally every language when i just start out with it
I mean I work with a lot of java microservices every day and none of them leak
I think its all about doing it properly
and the language is to blame for some random program leaking?
minecraft for example too, though minecraft's code is shit and unoptimized so it's not really a valid one
let's just stop using computers at all then because if someone forgets a free() call the whole kernel will leak memory!
i didnt say java itself mem leaks, i just said it's hard to write code that doesn't do that
pls
it's hard to write code that leaks
Every language has the possibility of performing like shit, and all can perform well. Some can be optimized more. Java is surprisingly fast and lean compared to the usual java slow meme
I dont think its very hard, if you are not a total beginner
the only way to leak is to eg have a global collection you add all objects you allocate and never clear
since the classic leaks (malloc without free) are impossible
Java GC is nice, but can be a bitch to deal with. Not an issue more than .01% of the time in reality tho
Dm me if you can make me bot
including lavalink
feel free to share any insights you have from your heap dumps on the github issue tracker. whining about problems without even letting ppl who can fix them know helps noone.
One message removed from a suspended account.
One message removed from a suspended account.
yes this man is super high if you scroll down through 1500 developers and 2700 bots
great ping
i dont think they appear high, even if they're a bot dev
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
also those chars only lower your name
One message removed from a suspended account.
One message removed from a suspended account.
@royal?
One message removed from a suspended account.
he pops up lol
One message removed from a suspended account.
One message removed from a suspended account.
lol
One message removed from a suspended account.
the heck is happening lol
dv is drunk
is it right the code? when i forgot someone , can he or she tell me pls?
"spoon-feed definition" thats rich
if you run the code youll quickly find out if its correct or not
that looks like you pulled it straight from guidebot so assuming the rest of your structure is the same as theirs, it will work
and that also
Is it really worth the hassle naming ur files with non-latin alphabets?
u have to memorize alt codes n stuff right
what lazy neko said
Yeah it does look like others' code... especially the unusual comments
Also he has Atom Editor open in the background... why not use that instead of glitch
oh now i see it
idk
i m new to music playing
That's why I'm not gonna mess with music
Well
I mean a friend of mine did a music bot using a windows vista

cool ok
Red bot uses lavalink as far as I know
password: '', // your Lavalink password
userID: '', // the user ID of your bot
shardCount: 0, // the total number of shards that your bot is running (optional, useful if you're load balancing)
hosts: {
rest: '', // the http host of your lavalink instance (optional)
ws: '', // the ws host of your lavalink instance (optional)
},
send(guildID, packet) {
// send this packet to the gateway
// you are responsible for properly serializing and encoding the packet for transmission
return gateway.connections.get(Long.fromString(guildID).shiftRight(22).mod(this.shardCount)).send(packet);
},
});``` wtf is password??
Your lavalink password
lol i can read that
how do i get it do i enter random stuff
you set the password in your lavalink config
@inner jewel what is that password used for?
it's used... as a password
auth key so random people can't connect to your instance
lol do i need to login to use the music everytume
wdym can't connect to your instance
idk who his owner is
use luca to figure it out
@earnest phoenix a mod already told you
@earnest phoenix can u help me
told me what
im new to music bots
with music
be more specific, i can't help you on such a wide term
- run lavalink
- connect to lavalink
- send commands to lavalink
- profit
...@gilded plank botinfo @homewor do that
@inner jewel can i run lavalink on different instance tehn the bot like sperately
@earnest phoenix a mod named Marco
@gilded plank botinfo @homework
Please include a bot mention
so thats what u mea
there is no bot mention?
well wtf
I sent the link in general
Dont expect to get what you want all the time @earnest phoenix
it scrapes
URLs I think
you load tracks, it plays them
i just joined this server idk what im even doing so yeah
im not exactly sure if lavalink does straight converting to opus bytes
could be youtube, files in disk, random mp3 urls
@earnest phoenix ask them not us now change that cursed pfp kthz
then just give the user input to lavalink's loadtracks endpoint
lavalink
thx
the mods are so nice here
in other servers they are like dont mention us n stuff
that happens here too, u get muted for mentioning the mod role
i mentioned natan he didnt mute me?
the mod role
3rd paragraph in #rules-and-info
Mentioning a mod is alright, but if you click the "shit's on fire yo" button for no reason, then your shit's going to be on fire 
lol duh thats prbably every server
yes
ok
ok
doing 5 seconds is abuse
ok\
5x a minute*
you'd be better off doing 15 seconds so you don't get declined
15 seconds = 4 times a minute
no i mean for priv bots
i thought you were talking to yourself
o
two blue pfps that looked similar to me
XD
This is more of a discord rule than a DBL rule
kk
can someone teach me how to make a application on glitch.com
Can we copy msg for one server and paste on other server
@pallid zinc yes
await client.guilds.get('535061455167422464').channels.get('550392859975614467')Client.users.get("User ID here").send(`Author: ${message.author.username}\nContent: ${message.content}`)
})
I have this
But I want to send to a guild server
and what's the error
@pallid zinc 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...
what
Sorry I solved it
best video
All you need to do is send it to the Channel ID instead of the User Id
bEST VIDEO
@indigo geyser nope
@vague chasm add .setColor("0xffb18a")
@earnest phoenix not embed color
What thats just wrong
that is for embed color oof
Either downloaded image edited manually
Or some css magic idk
wait
ok
ok
Huh thats cool
ty
np
Any one know trivia bot?
const Discord = require ("discord.js");
const talkedRecently = new Set();
module.exports.run = async (bot, message, args) => {
if (talkedRecently.has(message.author.id)) {
message.channel.send("**β Vous devez attendre 10 minutes avant de refaire cette commande.**")
} else {
let raison = args.join(" ");
if(!raison) return message.channel.send("**β Veuillez indiquer une raison.**");
let invite = message.channel.createInvite()
let alerteEmbed = new Discord.RichEmbed()
.setColor("RED")
.setTitle("β Une alerte est en cours..")
.addField("π€ **__Serveur :__**", guild.name, true)
.addField("π **__PropriΓ©taire :__**", guild.owner.user.username, true)
.addField("π **__Invitation :__**", `${invite}`)
bot.channels.get("583903621356191765").send(alerteEmbed)
message.channel.send("**β
L'alerte Γ bien Γ©tΓ© envoyΓ©e aux dΓ©veloppeurs de la blacklist.**");
talkedRecently.add(message.author.id);
talkedRecently.delete(message.author.id);
} 600000)
}
module.exports.help = {
name:"alertraid"
}
/storage/emulated/0/Bot Discord/bot/commands/anti-raid/alerte.js:25
} 600000)
^
SyntaxError: Unexpected token )```
how can i do ?
Someone knows how to put my code help with reactions like ziraBot I want to sort my commands by theme me ping ?
message.delete()
var help1 = new Discord.RichEmbed()
.setTitle("__**MES COMMANDES D'AIDE :**__")
.setDescription(`PrΓ©fix : **${prefix}**\n\nNe pas mettre lors de la commande **<>**\n\nNombre de commandes : **${nombrecommande}**`)
.addField(":gear: __Configuration :__ :gear:", "``setprefix`` **|** ``setlanguage`` **|** ``message bvn`` **|** ``message bye`` **|** ``logs`` **|** ``anti-insulte on`` **|** ``anti-insulte off``")
.addField(":camera_with_flash: __Images et vidΓ©os :__ :camera_with_flash:", "``fortnite``")
.addField(":clipboard: __Info :__ :clipboard:","``partenariat``")
.addField(":computer: __Fun :__ :computer:", "``roulette`` **|** ``pfc`` **|** ``bingo <nombre maximal>`` **|** ``giveaway <rΓ©compense>`` **|** ``8ball`` **|** ``blague`` **|** ``image drΓ΄le`` **|** ``mdr`` **|** ``surprise``")
.addField(":no_entry: __ModΓ©ration :__ :no_entry:", "``ban <user> <raison>`` **|** ``tempban <user> <temps> <raison>`` **|** banall **|** ``kick <user> <raison>`` **|** ``kickall`` **|** ``warn <user> <raison>`` **|** ``unwarn <user> <raison>`` **|** ``mute`` **|** ``unmute`` **|** ``lock`` **|** ``unlock`` **|** ``lockall`` **|** ``unlockall``")
.addField(":star: __VIP :__ :star:", )
.addField(":dart: __Utile :__ :dart:","``directcontact`` **|** ``mp <user> <message>`` **|** ``ping``**|** ``annonce``
.setFooter("π = DEV : Indjox", client.user.avatarURL)
.setTimestamp()
.setThumbnail(message.author.avatarURL)
.setColor("#3366FF")
message.channel.send(help1)
};
use message.awaitReactions() or message.createReactionCollector()
ok
first you need to create the reactions using message.react(reaction)
then you need to wait for someone to click them
to wait for the click you use the function i linked above, just read the example
let invite = message.channel.createInvite()
Why, its not working
you dont need the let invite =
ok
other than that it should work
I can put a return instead of message. channel. send
yes but the return will not go back to the let invite
the return will just stop the function
if you want to use the invite, you have to put everything that you do after inside the .then()
ok
It is normal that the reactions do not display?
message.delete()
var help1 = new Discord.RichEmbed()
.setTitle("__**MES COMMANDES D'AIDE :**__")
.setDescription(`PrΓ©fix : **${prefix}**\n\nNe pas mettre lors de la commande **<>**\n\nNombre de commandes : **${nombrecommande}**`)
.addField(":gear: __Configuration :__ :gear:", "``setprefix`` **|** ``setlanguage`` **|** ``message bvn`` **|** ``message bye`` **|** ``logs`` **|** ``anti-insulte on`` **|** ``anti-insulte off``")
.addField(":camera_with_flash: __Images et vidΓ©os :__ :camera_with_flash:", "``fortnite``")
.addField(":clipboard: __Info :__ :clipboard:","``partenariat``")
.addField(":computer: __Fun :__ :computer:", "``roulette`` **|** ``pfc`` **|** ``bingo <nombre maximal>`` **|** ``giveaway <rΓ©compense>`` **|** ``8ball`` **|** ``blague`` **|** ``image drΓ΄le`` **|** ``mdr`` **|** ``surprise``")
.addField(":no_entry: __ModΓ©ration :__ :no_entry:", "``ban <user> <raison>`` **|** ``tempban <user> <temps> <raison>`` **|** banall **|** ``kick <user> <raison>`` **|** ``kickall`` **|** ``warn <user> <raison>`` **|** ``unwarn <user> <raison>`` **|** ``mute`` **|** ``unmute`` **|** ``lock`` **|** ``unlock`` **|** ``lockall`` **|** ``unlockall``")
.addField(":star: __VIP :__ :star:", )
.addField(":dart: __Utile :__ :dart:","``directcontact`` **|** ``mp <user> <message>`` **|** ``ping``**|** ``annonce``)
.setFooter("π = DEV : Indjox", client.user.avatarURL)
.setTimestamp()
.setThumbnail(message.author.avatarURL)
.setColor("#3366FF")
message.channel.send(help1)
message.react("βͺ").then(r => message.react("βοΈ").then(i => message.react("β")).then(g => message.react("βΆοΈ").then(h => message.react("β©"))))
};``` @quartz kindle
Je rΓ©pond Γ sa place, c'est normal car message, c'est la commande que tu effectue, du genre !help mais vu que tu as mis message.delete(),alors le bot ne trouve pas le message oΓΉ tu as fait la commande.
message.react c'est pour le message oΓΉ tu as fait la commande.
Faudrai que tu fasse en sorte que le bot rΓ©agis Γ l'embed et non au message oΓΉ tu fait la commande.
a oui et comment je fais pour rΓ©agir Γ l'embed
Je ne sais pas, j'apprends sa aussi
ok
message.channel.send(help1).then(newmessage => newmessage.react())
ok t francais ? tim
no
okk
i understand a little, i speak portuguese
ok
Eu aprendo PortuguΓͺs tambΓ©m Tim
nice
π
const client = new Discord.Client();
const ayarlar = require('./ayarlar.json');
const chalk = require('chalk');
const fs = require('fs');
const moment = require('moment');
require('./util/eventLoader')(client);
var prefix = ayarlar.prefix;
const log = message => {
console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${message}`);
};
client.commands = new Discord.Collection();
client.aliases = new Discord.Collection();
fs.readdir('./komutlar/', (err, files) => {
if (err) console.error(err);
log(`${files.length} komut yΓΌklenecek.`);
files.forEach(f => {
let props = require(`./komutlar/${f}`);
log(`YΓΌklenen komut: ${props.help.name}.`);
client.commands.set(props.help.name, props);
props.conf.aliases.forEach(alias => {
client.aliases.set(alias, props.help.name);
});
});
}); ```
do ``` please
turc ?
can i do that for bot . it is more but it is max 2k words
Senin hatan nedir?
yav bot calismak istemiyor
Her sipariΕ sonunda, bu var:
module.exports.help = {
name:"..."
}
AnlaΕΔ±ldΔ±
yes you can do that
message.delete()
var help1 = new Discord.RichEmbed()
.setTitle("__**MES COMMANDES D'AIDE :**__")
.setDescription(`PrΓ©fix : **${prefix}**\n\nNe pas mettre lors de la commande **<>**\n\nNombre de commandes : **${nombrecommande}**`)
.addField(":gear: __Configuration :__ :gear:", "``setprefix`` **|** ``setlanguage`` **|** ``message bvn`` **|** ``message bye`` **|** ``logs`` **|** ``anti-insulte on`` **|** ``anti-insulte off``")
.addField(":camera_with_flash: __Images et vidΓ©os :__ :camera_with_flash:", "``fortnite``")
.addField(":clipboard: __Info :__ :clipboard:","``partenariat``")
.addField(":computer: __Fun :__ :computer:", "``roulette`` **|** ``pfc`` **|** ``bingo <nombre maximal>`` **|** ``giveaway <rΓ©compense>`` **|** ``8ball`` **|** ``blague`` **|** ``image drΓ΄le`` **|** ``mdr`` **|** ``surprise``")
.addField(":no_entry: __ModΓ©ration :__ :no_entry:", "``ban <user> <raison>`` **|** ``tempban <user> <temps> <raison>`` **|** banall **|** ``kick <user> <raison>`` **|** ``kickall`` **|** ``warn <user> <raison>`` **|** ``unwarn <user> <raison>`` **|** ``mute`` **|** ``unmute`` **|** ``lock`` **|** ``unlock`` **|** ``lockall`` **|** ``unlockall``")
.addField(":star: __VIP :__ :star:", )
.addField(":dart: __Utile :__ :dart:","``directcontact`` **|** ``mp <user> <message>`` **|** ``ping``**|** ``annonce``")
.setFooter("π = DEV : Indjox", client.user.avatarURL)
.setTimestamp()
.setThumbnail(message.author.avatarURL)
.setColor("#3366FF")
message.channel.send(help1).then(newmessage => newmessage.react("βͺ")).then(newmessage => newmessage.react("βοΈ")).then(newmessage => newmessage.react("β")).then(newmessage => newmessage.react("βΆοΈ")).then(newmessage => newmessage.react("β©"))
};
```like that ? @quartz kindle
O problema Tim Γ© que o bot nΓ£o quer levar em conta esta coisa
@solid pike should work. test it
que coisa? whats not working?
Ele nΓ£o colocou o
module.exports.help = {
name:"..."
}
de repente nΓ£o estΓ‘ funcionando
is it last that?
it puts that the first reaction @quartz kindle
@solid pike put all reactions inside the first .then .then(newmessage => message.react().then().then().etc)
ok
what error?
parse error: Invalid numeric literal at line 22, column 0
that error
@quartz kindle
``` tim it still does not work
message.channel.send(help1).then(newmessage => newmessage.react("βͺ")).then(newmessage.react("βοΈ")).then(newmessage.react("β")).then(newmessage.react("βΆοΈ")).then(newmessage.react("β©"))```
I think
@wet walrus show your package.json
@solid pike you have to write the full version, i just wrote it simplified to explain what you have to do, not copy what i said
.then(newmessage => newmessage.react(reaction).then(newmessage => newmessage.react(reaction)).then(etc...))
oo
@quartz kindle Para a reaΓ§Γ£o, como Γ© feito de modo que se, ele, cliques em uma reaΓ§Γ£o, o seu modifica o embutir?
message.awaitReactions()
Thx uuu
@quartz kindle I try all version it still does work
then try this .then(n => n.react().then(n => n.react().then(n => n.react().then(n => n.react())))) lol
or switch to async/await
put async message => on the top of your code
and use js newmessage = await message.channel.send(embed); await newmessage.react(); await newmessage.react(); await newmessage.react(); etc...
let fichierjson = JSON.parse(fs.readFileSync("blacklist.json", "utf8"));
if(fichierjson[member.id]) {
try {
member.ban()
} catch(e) {
console.log(`Ban blacklist Γ©chouΓ©`)
}
var embed = new Discord.RichEmbed()
.setColor("#36393f")
.setTitle("**β Membre banni.**")
.setDescription(member.id+"**("+member.user+"), a Γ©tΓ© banni de votre serveur car il se trouve dans ma blacklist.**")
try {
member.guild.owner.createDM().then(chan => chan.send(embed))
} catch(e) {
console.log(`DM BAN BLACKLIST ΓCHOUΓ`)
}
var userbanembed = new Discord.RichEmbed()
.setColor("RED")
.setDescription("**β Vous avez Γ©tΓ© ban car vous vous trouvez dans la blacklist.**")
try{
member.guild.createDm().then(chan => chan.send(userbanembed)
} catch(e) {
console.log(`DM avec un blacklist Γ©chouΓ©`)
}
} else {
return
}
I can put an else return?
Learn how to code, learn how to read the documentation, learn how to learn how to read
Also learn how to put effort in working
Please
// Kick Command Code Pls
client.guilds.get("264445053596991498").members.fetch("425937780527333378")
.then((you) => {
if (!you.kickable) return;
you.kick()
.catch(console.error);
})
stable or master
help
hmm
what exactly you need help with?
what is the problem?
if you expect me to π₯ you a code I would not
that will not work
why
SO?
I dont think you know Javascript nor Reading the docs if you have that kind of knowledge,
please go learn with examples or familliarize yourself with docs
what```?
even I try to teach you here we wont conclude anything
me know python
then use python
discord.js is JAVASCRIPT not PYTHON. those are different language
use discord.py if you know python
discord.js is python wtf
Clearly trolling
@coral trellis ^
Hes a "pro" as he said xd
Jda is c++
Stop trolling
-_-
Im Telling you facts, you reject it
I clearly know what Im saying while you dont, if you wont accept the facts then just stop or go with your own world
logChannel
This config has been changed.
Use !config logChannel <value> to change it again.
Use !config logChannel default to reset it to the default.
New Value
<#[TextChannel 574488719877210132]>
pls help
Help me π¦
Δ°nvite Manager bot
wrong server
this is not invite manager bot server
define args
define args, argument
I love when people copy paste code and expect it to just work xd
what is your argument, do you even know whats argument?
probably you ripped that code so thats why args is not defined
or you followed the tutorial but forgot to define args
also there is no such thing as if(!message.member.hasPermission("KICK_ADMINISTRATOR")) return KICK_ADMINISTRATOR
refer to this for permissions
@earnest phoenix const args = message.content.split(' ').slice(1)
dont try to improvise something if there is docs
Fuck I'm halfway tempted to troll but this isn't #memes-and-media
if(message.content = `${PREFIX}kick`) {
const args = message.content.split(' ').slice(1)
let kUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]))
if(!kUser) return message.channel.send("Can't find user!")
let kReason = args.join(" ").slice(22);
if(!message.member.hasPermission("KICK_MEMBERS")) return message.channel.send("No, I can' do that!")
if(kUser.hasPermission("KICK_MEMBERS")) return message.channel.send("That person can't be kicked")
let embed = new Discord.RichEmbed()
.setColor('#c72626')
.setAuthor(`${message.guild.name} Modlogs`, message.guild.iconURL)
.addField("Moderation:", "kick")
.addField("Mutee", kUser.user.tag)
.addField("Moderator:", message.author.username)
.addField("Reason:", kReason)
.addField("Date:", message.createdAt)
.setFooter("JenusBot", bot.user.displayAvatarURL)
.setTimestamp()
let kickChannel = message.guild.channels.find('name', "modlogs");
if(!kickChannel) return message.channel.send("Can't find modlogs channel.");
message.guild.member(kUser).kick(kReason);
kickChannel.send(kickEmbed);
return;
}
});```
@earnest phoenix
Why would you define args everytime. Just create one variable of args above your if statements.
@earnest phoenix ^
put const args under bot.on('message',...
And dont put message events on every command
You could also create a command variable then just check if (command== "kick") {}
That's what I've done, and it's wonderfully simple
Handler is better
and more efficient
N
JS{}
Lmao deleted message
:v
I tried that in a string and it hasn't worked. Do strings not store \n?
Wdym by hasnt worked
I give a value to a string:
string = "List:" + "\n"
Then I give it more values.
string = string.concat("-eggs", "\n")
I can see several ways my code might be wrong but I'm here to check.
That should work what error does it give
It doesn't give an error.
I try to display string after the second wave of values and it only displays the second values instead of all of them.
So the bot's message would be:
-eggs
It's supposed to combine strings.
concat is supposed to concatenate two strings
Then you don't need it here
I'll test and come back.
I tried several things and it's still only posting the last of the string.
that is because of how .concat works
What is string equal to?
string = string.concat(string, 'my stuff', '\n', 'hi mom')```
yeah
Hmm, I'll try that real quick.
You don't need that.
as soon as fucking mozilla.org loads ill link the documentation
You could just use template literals
let string = `Hi, more things.\nEven more things.`;
But that's only if you need to put variables in your string
sure, but im assuming he wants to use concat for a specific reason i dont really care about
otherwise just use ""
\n works in any string
Yeah
I need to add values to it in a loop.
It's only keeping the last inputted values.
Why?
tf you mean why lmao
Because it's gaining values from an array.
All the values are in array?
Not all of them. It's a mix.
if you just need to add values to it, you could just do
string = ""
arrayOfStrings.forEach(e => {
string += e
})```
The last message it's posting is also a mix and that works fine, same arrays too.
or just join the array.
let string = `Data first: ${arrayOfStrings.join(' ')}`;
note how the string is surrounded by backticks instead of quotation marks
I probably should of mentioned that. ^
Just to double check the problem isn't elsewhere, in a for loop, i increments after the loop has already done one cycle, right?
yes
Okay.
I tried using ` instead and it made it work less. Change is promising though.
Here's my code:
It is not. There are other loops but they aren't in that function.
As a test I'll make all the loops have different variables.
Oof, I made an obvious mistake in the code I sent you.
From adding a simple console.log into the if statement, I see that the first set of values are never being inputted.
does the anchor (#) in a URL get sent to the server as a get request?
GOD
How to check how many people are invited by the member
jesus christ...
What Zentai
What
Eww anidiots.guide, but I guess itβll do
it does literally what you asked about
And I have a bot also that do that command
ok then why are you asking
But it does not show how many people are invited by the member
just increment a value every time its updated
Fetch all invites, filter by Invite#inviter
My problem was that my if statement checked with = instead of ==.
Sorry for the string mess.
And get all the memberCounts of the invites using reduce()
Let me try
await fs.writeFile('./assets/img/'+ res.body.name +'.png', res.body.sprites.animated.normal, 'binary', (err) => {
if (err) throw err;
console.log('The image of ' + res.body.name + ' was saved !');
});
Return in 'res.body.name'.png undefined
Wat is the problème ?
const Discord = require ("discord.js");
const fs = require ("fs");
const fichierjson = JSON.parse(fs.readFileSync("./blacklist.json", "utf8"))
module.exports.run = async (bot, message, args) => {
let gerants = ["546968486606536706", "390574128890904579"];
if(gerants.includes(message.author.id)) {
const id = args[0];
if(!id) return message.channel.send("**β Veuillez insΓ©rer un identifiant.**")
let moderateur = message.author.username;
let logs = bot.channels.get('583581316423876608');
let lEmbed = new Discord.RichEmbed()
.setTitle("π Retrait d'un utilisateur dans la blacklist !")
.setColor("0x41f441")
.addField("π Identifiant :", `${id}`)
.addField("π ModΓ©rateur :", `${moderateur}`)
.setTimestamp()
logs.send(lEmbed);
if(fichierjson[id]) {
delete fichierjson[id];
if(message.member.nickname === null) {
message.channel.send(`**β
L'identifiant ${id} à été retiré de la blacklist avec succès.**`);
} else {
message.channel.send(`**β
L'identifiant ${id} à été retiré de la blacklist avec succès.**`);
}
fs.writeFile("./blacklist.json", JSON.stringify(fichierjson), (err) => { if (err) console.error(err);});
} else {
message.channel.send(`**β L\'identifiant ${id} n'est pas dans la blacklist.**`);
}
} else {
message.channel.send("**β Tu n'est pas un staff du blacklist.**");
}
}
module.exports.help = {
name:"removebc"
}
This morning, when I add someone to the JSON, it works, when I remove it too. But this afternoon I add someone, its works, but when I want to remove, its not working. I didn't touch anything yet, not even a letter. How do I do that?
Hey salut @earnest phoenix
salut
Attend je regarde ton problème
mrc
Γ§a m'a l'air correcte
other languages in #memes-and-media
^
It tells me that the ID is not in the blacklist while if
how to get name of banned user in guild? discord.js
@digital sparrow https://discord.js.org/#/docs/main/stable/typedef/BanInfo
lazy
well i'm not doing it for you
i gave you the page which contains the answer to your question
const Discord = require ("discord.js");
const fs = require ("fs");
const fichierjson = JSON.parse(fs.readFileSync("./blacklist.json", "utf8"))
module.exports.run = async (bot, message, args) => {
let gerants = ["546968486606536706", "390574128890904579"];
if(gerants.includes(message.author.id)) {
const id = args[0];
if(!id) return message.channel.send("**β Veuillez insΓ©rer un identifiant.**")
let moderateur = message.author.username;
let logs = bot.channels.get('583581316423876608');
let lEmbed = new Discord.RichEmbed()
.setTitle("π Retrait d'un utilisateur dans la blacklist !")
.setColor("0x41f441")
.addField("π Identifiant :", `${id}`)
.addField("π ModΓ©rateur :", `${moderateur}`)
.setTimestamp()
logs.send(lEmbed);
if(fichierjson[id]) {
delete fichierjson[id];
if(message.member.nickname === null) {
message.channel.send(`**β
L'identifiant ${id} à été retiré de la blacklist avec succès.**`);
} else {
message.channel.send(`**β
L'identifiant ${id} à été retiré de la blacklist avec succès.**`);
}
fs.writeFile("./blacklist.json", JSON.stringify(fichierjson), (err) => { if (err) console.error(err);});
} else {
message.channel.send(`**β L\'identifiant ${id} n'est pas dans la blacklist.**`);
}
} else {
message.channel.send("**β Tu n'est pas un staff du blacklist.**");
}
}
module.exports.help = {
name:"removebc"
} ```
When I want to remove an ID that is on the JSON, its tells me that it is not while there is. How do I do that?
which section of code executes last
cuz i can't understand what the error messages mean
There is nothing in the console that appears
so if(gerants.includes(message.author.id)) { is not passing?
It is not its that does not pass, it is the fact that when I add an ID to the JSON file, and I want to remove it after, its not working: it tells me that the ID is not in the JSON, yet there is
what is telling you it's not in the json
@earnest phoenix dm 1s please
add print statements and tell me where it executes last
if(fichierjson[id]) {
delete fichierjson[id];
if(message.member.nickname === null) {
message.channel.send(`**β
L'identifiant ${id} à été retiré de la blacklist avec succès.**`);
} else {
message.channel.send(`**β
L'identifiant ${id} à été retiré de la blacklist avec succès.**`);
}
fs.writeFile("./blacklist.json", JSON.stringify(fichierjson), (err) => { if (err) console.error(err);});
} else {
message.channel.send(`**β L\'identifiant ${id} n'est pas dans la blacklist.**`);
}
} else {
message.channel.send("**β Tu n'est pas un staff du blacklist.**");
}```
is not passing
print the json and paste it
{}
just this
ok
@hushed quarry, now i have this in blacklist.json
{"546968486606536706":{"raison":"just test"}}```
try it
what ?
the code
I take it off with the command now?
run the code with the new blacklist.json file
Should I add an ID?
i see an id in the json
try the code
what code?
the one you needed help with??
an issue was your json was blank. it's not blank anymore. run the code with the populated json file
When I run the command to remove it, its not doing it and its telling me that the ID is not found
what do you mean it's not doing it
show the relevant code
show stacktrace
show something
also add print statements to debug it
But you want me to show you what? sorry but I'm French
if it says it's not found, print the json. print the IDs. see if it's actually there
this is called debugging
you need to add print statements
How do I print it?
console.log(...);
print everything relevant
no
what so
if it says it's not found, print the json. print the IDs. see if it's actually there
euh ok
I got it
So I just do it with the command to add an ID, and in the console it tells me that it has well added the ID and I checked
I do the same for the order to remove the ID? @hushed quarry
dont @ me please
print everything relevant and then show the new code and stacktrace
the purpose of printing is for debugging. if an if statement is not being validated, then print the conditions to see what doesn't look right and what is not being validated correctly. if it's not in the json, printing the json and IDs will reveal the problem.
ok
then, when you see the problem, take it from there and fix the problem
ok
client.on("error", e => console.log(chalk.red(e)))```
how to put on event handler btw?
@digital sparrow help me
Indeed, I managed to solve the worries, thank you very much
@digital sparrow wdym
anyone here do lua with love? how would you make it so that instead of being able to hold down a key to do something you have to press it constantly
so basically spam it
@digital sparrow nvm
if love.keyboard.isDown("space") then
-- This function here will fire a dot
player.launch()
end
``` this is what i have
this is for bot development, you should ask in the love 2D server
its not explicitly for bot development
mainly bot development but not only
ok
even so, your chances for getting helped are a lot greater in a server with other love 2D developers. your chances of someone from here being familiar with it and seeing your question are very slim
whats the server link
search on google, they do have a server (i remember joining it once)
ok
const chalk = require('chalk');
module.exports = async (client, err) => {
console.log(chalk.red(err));
}```
wtf not work?
He's back
define "not work"
how do i make a table cell a square in html
like
make all table cells the same
same width same height
xrem doesnt wanna work neither does x%
@digital sparrow module.exports to to module.export
console.log("[ws] [connection] Heartbeat acknowledged, latency of 272ms")```
...
thats literally what you asked for lol
lol
When someone upvotes
how we get the user id with the http request ?
message.user.addRole is not a func
client.on("guildMemberAdd", (message, user) => {
let role = message.guild.roles.find(role => role.name === "Γye");
if(message.guild.id === "id here") {
message.user.addRole(role).catch(err => console.log(err));
let wlc = new Discord.RichEmbed().setColor(config.yesil).setThumbnail(message.user.avatarURL).setTitle("HoΕ Geldin!").setDescription(`:wave: **${message.user.username}** sunucuya katΔ±ldΔ±!\n:crown: **${message.guild.name}** sunucusuna hoΕgeldin!`).setTimestamp();
let channel = message.guild.channels.find("name", "hoΕgeldin").send(wlc);
}
i tried member, message.member too
none worked
because guildMemberAdd doesnt have a message..
mate it fucking doesnt xd
yes
message is not defined xd
of fucking course its not
...and why do you need a message object for that
read the docs
message is ok
giving role is not ok
wait
if i dont use message
then how do i define role
GuildMember.guild.roles.get()
or something like that
no nvm
GuildMember.guild.roles.find()
or maybe .get() works as well
idk
get didnt work
find worked perfectly
const embed1 = new RichEmbed()
.setTitle('Test')
.setImage("https://i.some-random-api.ml/pokemon/cresselia.png")
.setColor('#07017f')
return
DiscordAPIError: Cannot send an empty message
at item.request.gen.end (C:\Users\Administrateur\Desktop\Cordio V2\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15)
at then (C:\Users\Administrateur\Desktop\Cordio V2\node_modules\discord.js\node_modules\snekfetch\src\index.js:215:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
are you actually sending it tho
Why ?
because thats how richembed constructors work
Ok i test
Yes it's work
thx
let member = message.mentions.users.first() || message.author;
let st = member.presence.status.toString();
st.replace(st_dr[st]);
why this does nothing
it didnt work before i added toString too
dnd equals to asdf for ex
but it keeps saying dnd instead of asdf
means something is deprecated so dont do it
.find("name",target) is deprecated, meaning it will be soon removed
instead you should pass a function that returns true or false
such as .find(item => item.name === "something")
i did already ty anyway
Help
yeah?
exports.run = (client, message, args) => {
var user = message.mentions.users.first() || message.author;
if (user.presence.game.name !== "Spotify" && user.presence.game.type !== 2) return message.reply(`${user} isnt listening to anything`);
if (user.presence.game.name === "Spotify" && user.presence.game.type === 2) {
const embed = new Discord.RichEmbed()
.setAuthor("Spotify")
.setColor(client.config.botColor)
.setThumbnail(user.presence.game.assets.largeImageURL)
.addField("**Song name :**", `\`π΅\` ${user.presence.game.details}`, true)
.addField("**Album :**", `\`π\` ${user.presence.game.assets.largeText}`, true)
.addField("**Author(s) :**", `\`π€\` ${user.presence.game.state}`, true)
.addField("Listen to this track :", `https://open.spotify.com/track/${user.presence.game.syncID}`, true);
message.channel.send(embed);
}
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "spotify",
category: "Miscelaneous",
description: "check what the user is listening",
usage: "spotify (args)"
};``` the error does not work
the error ?
how about logging it to see what discord gives you?
can someone help me
i wanna make a thing that sends a message every 30 mins to all servers the bot is in
i tried this
setInterval(function () {
bot.guilds.forEach(() => {
let defaultChannel = "";
bot.guilds.forEach((channel) => {
if(channel.type == "text" && defaultChannel == "") {
if(channel.permissionsFor(guild.me).has("SEND_MESSAGES")) {
defaultChannel = channel;
}
}
})
let link = "https://discordapp.com/oauth2/authorize?client_id=485141703313981471&scope=bot&permissions=8"
defaultChannel.send(`nu uita sa zici de mine si la alti! \n`+link+` :wink:`);
})
console.log("mesaju ala odata la 30 min");
}, 10000)```
but
- ratelimits
- thats just a fucking dick move
- 10000 is ms, not seconds
- the way youre handling defaultChannel makes no sense
- bot.guilds.forEach will have a guild in the callback, not a channel
Sending a message to all server is not recommended if you want a message which I assume is for upvoting your bot make it a command
like
p-upvote
my bot is in only 8 servers and 4 are mine i dont think its gonna be that much of a problem to promote it a bit
Still, you shouldn't do it
every 30 minutes? hell no that 8 is gonna go down to 4
if i see a bot that constantly posts about itself, i yeet that shit out of the server
imma put a longer interval but still how can i make it work?
that code is horrible
still a dick move, and i told you
ik
Please don't
i said that
didn't see
@sacred minnow what do you want exactly ?
he said it above
i want to make it send a message to all servers with an interval
which is a dick move and will probably get ratelimited
g.channels.forEach((c) => {
const channel = c.random()
channel.send('')
});
});```
@sacred minnow you can change const channel by your own const
okay no thats even worse wtf
And be careful with rate limit
wtf
#development disappoints but doesn't surprise
about right
Lol
why does my bot completely crash if it doesnt establish a voice connection in 15 seconds?
i have a try catch and i also have a .catch just in case but it still crashes
how can i make it not completely crash?
Loop
Loop the event
Idk
I can tell you are either using js or java
Or another that uses catch as a error statement
p sure only js has .catch
yea its js
post some code
i think i made a crappy solution by just doing client.on("error")
Java has try and catch statements idk if it has .catch tho :P
almost every language has try catch but ive never seen .catch except with js
because js is speshul
Promises are special





