#development
1 messages · Page 396 of 1
i use ~600-800MB for 5.6k guilds
@solid cliff yeah 1gb would probably be best
oki
what language
Now i just reached a milestone! 5 hours on a single fucking tutorial. I am now going back steps : D 👏 👏
ok so the least you'll need for your build.gradle would be ```gradle
group 'succ'
version '1.0-SNAPSHOT'
apply plugin: 'java'
sourceCompatibility = 1.8
repositories {
mavenCentral()
jcenter()
}
dependencies {
compile 'net.dv8tion:JDA:3.5.0_329'
}
@proven schooner
update that jda 
mmLol
plugins {
id'java'
id'application'
id'com.github.johnrengelman.shadow' version '2.0.2'
}
mainClassName = 'com.example.jda.Bot'
version '1.0'
sourceCompatibility = 1.8
repositories {
jcenter()
}
dependencies {
compile 'net.dv8tion:JDA:3.6.0_355'
}
compileJava.options.encoding = 'UTF-8'```

@inner jewel I haven't updated because I'm too lazy™
ur almost 30 builds behind
I don't use JDA that much anyways so I barely keep up with updates

i get a ping for each update

How do i update the jda?
changing the version in build.gradle
test
because the one i typed since i having a mental 'melting'
tbh you should learn java before trying to write a bot
if you don't have any knowledge you'll get nowhere
and JDA isn't beginner friendly at all
you have to stalk the JDA docs to get anywhere with JDA tbh
just stare them down :^)
not really
@trim plinth Your's doesn't work
most methods are pretty clear on what they do
yeah cause I suck
@inner jewel What do i change out of yours?
its* FINALLY WORKING
ok cool
Im adding a listener to my bot. Keeps flooding me with a fuckload of errors
did you import it 
you need to import shit to get things running
This is the first time(of course) im doing this type of scripting.
Well where do I import the pile of shit to get the shit running?
maybe you should learn Java
@topaz fjord This is how I am going to learn it. At least part of it.
no just no
I do not do good at learning programming languages, I don't even know why the fuck im doing this.
learn langs outside of bot making instead of using bots as a way to learn
Can anyone teach me node?
node?
node.js
like the js runtime
mhm
ok
I want to develop a bot
Learn from online 
hint: run files with node urFile.js
Should i do the java script acadmeny?
parts of the bot, so you wont lose it all togethe
Haven't done that in years
no thats not what shards are
idk then
shards are multiple processes of a bot designed to keep Discord from reeing at it once it gets too many guilds
I'm guessing you want to know JS, Node.js isn't a lang, its a JS runtime
.
yeah seriously
i have visualcode
it'll help a lot to learn JS first before going into JS bots
even if you have VS it won't accomplish anything for you if you don't know a programming language
What would be the easiest way?
@proven schooner for what?
just gonna get a friend tohelp me
Ew
- you don't
- multiple tokens
wew
Is there a way I could make this line use queue()
User o = DATA.JDA.retrieveUserById(args[0]).complete();
?
for js, how would i do a thing to detect if a message isn't a number
basically, heres what kind of code i want to run if the message isn't a number, then send an error message
@errant bone You can pass queue a consumer (callback), and so once it's competes it will pass that consumer the user object.
code example?
I'm not sure how to do it in Java exactly, but in Kotlin it's:
data.jda.retrieveUserById(ages[0]).queue { user ->
// my beautiful code using the user object
}
If you'd like, I can try to look up how to write it in pure Java.
Actually, if I recall correctly, I think in Java you can do:
data.jda.retrieveUserById(ages[0]).queue((user) -> {
// my beautiful code using the user object
});
I'll double check.
alright, thanks dude
No problem. Hopefully it works.
I feel like i'm doing something wrong here
I'm not that good with lambda expressions
Instead of setting u to user, you can just rename user. I just wrote user to make clear what the value is.
you can't assign a local variable from inside a lambda
oh
move the code that needs user inside the lambda
@dusty sandal You can use isNaN(messageContent) to check if it is Not a Number.
ok thanks

What?
idk why did i expect JS to make sense
i'd expect isNaN to strictly compare to FP NaN
isNaN(123) // false
isNaN('123') // false
isNaN('1e10000') // false (This translates to Infinity, which is a number)
isNaN('foo') // true
isNaN('10px') // true
infinity is a number 
[controversy intensifies]
the more controversal shit is how NaN is a number

1e10000 !== infinity
infinity is infinity
and isNaN is going to attempt to parse the first parameter as a number
undefined is a javascript object and therefore is not a number
0 / 0 is also not a number
as it is not defined
hello is not a number
2005/12/12 is also not a number, the / make it unable to be parsed
this shit is easy
ok python is being weird on windows i need to use game=discord.Game but on this laptop running ubuntu i need to use activity=discord.Game I find that weird
Different versions of the lib?
@loud bear nope its different vers definitely
the one installed on windows is prolly an older version
Rewrite has updated from game to activity
i need an help/idea:
my bot need to delete a message from a user and rewite it sobstituting particular format....
but i want that before do that it waits to see if other bots deletes that message
any ideas?
i use JDA
... 😔
How would I get a messages content from a message ID in discord.py async?
message.content is what you want, but you first need to define message as the message you are tarrgetting, you can find that in the discord.py docs
Alright, thanks.
hi, my bot has the permission to nickname people, but cant nickname people who are higher rank than it is, is there any way at all that I can get it to nickname higher ranking people or do I just have to live with it?
Unless the bot has a role higher than the person it's trying to nickname
You should probably check the role position of the member your trying to nickname and if the bots role position is lower than it, return a message telling them the user your trying to nickname has a higher role than me or smth
Np
someone have an idea for my question?
If you rephrase your question I might be able to help you
i've a bot that pratically echoes what a user says modifying some things
i want him to wait to reponse (like some ms) to see if the message gets deleted by other bots (like censor bots or slowmode)
Ah, I see
This might be outdated or not relevant to your version
But you get the point, I guess, that you need a Timer. If this SO doesn't work for you, I'd suggest researching other Timers.
I think u should look at setTimeout
Java != JavaScript
Brian u can google the SetTimeout function in java it is a bit the same but if im not wrong its called "Timer"
I'm unable to find that method in any Java related Timer class
and researching only spits out JS
oof
err... the question is how to test if the message is still there
i've not found any methind like isDeleted() or isNotDeleted()
Dude
Check the docs
You wait for the message delete event > cache the deleted message id > check if it is in cache
if yes it got deleted
(discord.py) so ive got the ffmpeg folder, I'm not sure what it means by 'You must have the ffmpeg or avconv executable in your path environment variable in order for this to work.', can anyone point me in the right direction? thanks
when you installed ffmpeg did you have to go into the control panel and add the ffmpeg directory path into a text box?
because that might be what it is referring to
when i installed it with homebrew it just added the ffmpeg folder
osx
how would you do it in windows
but you want to find out how to add ffmpeg to your path
does osx even have the "pathing" thing?
yes
so does linux
but i think in osx and linux you do it with a command
in windows you would go to system info in control panel then click "advanced system settings", click environment variables, then add the path variable with the directory path inside it
i added the path to bash_profile
this is what I found online.. that looks like it should work:
open -e ~/.bash_profile
Add this to the file at the end:
export PATH="/usr/local/bin:$PATH"
Save it, and close the editor. Now restart your Terminal and which ffmpeg should return /usr/local/bin/ffmpeg.```
:D
well thats sorted thanks haha, but now a new error has thrown up 🙄 i'll get there smh
lol
@vital plover ok so you're retrieving the command executor at line 47 right
looking it up in a hash table
so the solution is to mutate the key so case becomes irrelevant, right
ye
so call .toLowerCase on it?
assuming your definitions register commands in lower case
in which file to i put .toLowerCase
i'm trying very hard to not spoonfeed
so consider this
your command hash table maps lowercase command names to command executors, right?
ye
now suppose a user tries to retrieve the entry help => [Help command] by doing !HELP
you receive the string "HELP" but you want the entry keyed "help"
what do you do?
not sure
is it not sufficient to simply transform the string you receive to lower case before using it?
idk
i get the distinct feeling that you just copied your command dispatcher from elsewhere
as i said im kinda new to js
@shell oxide https://www.ffmpeg.org/download.html look at this
@earnest phoenix it could equal since your example contains variables, not strings.
I'm joking
His example was python so .lower()
ah
Ah, you beat me to it.
Good luck! :D
: D
can u use .broadcastEval in d.js too eval multiple things
yes
broadcastEval("[something, something2, anotherthing]").then(d => {
const firstShard = d[0];
firstShard[0] // something
firstShard[1] // something2
firstShard[2] // anotherthing
});
@earnest phoenix That's disgusting
broadcastEval("[something, something2, anotherthing]").then([[first, second, third]] => {
// Do something with them
});```
Because that's more readable 
broadcastEval("[something, something2, anotherthing]").then(d => {
for (const r of d) {
r[0]; // something
r[1]; // something2
r[2]; // anotherthing
};
});

why wouldn't you destructure it in that example
Because you're destructing the first shard
disgusting
same tbh
so it means if you broadcast eval the shards on client.guild.size it would return answers then just add it then thats it?
well do posting stats on dbl would need it to be added, or dbl will automatically add it?
You can send per shard
like on what is on docu?
If you send shard id and count from each client
client.shard.id and client.shard.total stuff?
I see thanks for that I thought I would need to add it first
before sending it to dbl
I mean at least jacz way wont break if you change shard amount...
How long does it take to get a reply for bot certification?
@Dark#6246 You will get a DM from Luca
No bot dev role 
I understand that, but how long does it usually take?
Well the max wouldn't be infinity, right?
Like they never accept or deny?
40 years later
Bruhhhh
i was going to say something but its depressing so i will shut me yop
@slender kestrel
lolz
i was wondering if it wa shere
whats your level with tatsu?
Certification is something different than wait for approval btw
guys, this doesn't look like development talk 
it looks like girl group numero 1
You can actuall stop shitposting now and put all non developing talk in #general or #memes-and-media
oops sry

https://some-random-api.glitch.me/chatbot/api/?message=test
i cant figure out how to grab the text
its easy as hell ive done it before
but i cant remember it
its so freaking easy but i can't figure it out
youtube easy
easy
urban easy
but this nope stop wait
NVM im an idiot
const Discord = require("discord.js");
const response = require("random-responder")
exports.run = async (bot, message, args) => {
let link = args.join(" ");
response.get(`${link}`, function(err, daresponse) {
message.channel.send(daresponse)
})
}
```
worked
so peeps i got a bot that can talk Xd
wait.....
@《RyzenFire》▪Sim's▪#3970 did u know
@earnest phoenix did u know. . . that i made that 
nope
nice tho
when its no responding i dunno what you mean XD
But noice
im updating it
its nice
you need to do a boob function
it will be a bit slower but has more words and stuff
boob?
PREFIX do you have boobs?
answer yes big ones
like that
gay
XD
really good job tho a +
its gonna be dank!
it's dank already and it's gonna be the dankest. well as it gets better my bots chat ability gets better so wooo woop
the update has better functions
it uses callbacks
so its not good
shhhhh
@earnest phoenix do u prefer snefetch or request?
snekfetch
same
same
^
^
^
^
https 😩
@earnest phoenix like ah smartbot? Or however it was called.
Or more like open source what I use?
cleverbot
Ah yes, I can actually try that later
well some of em are paid
u wanna see mine?
Sure
its pretty slow thou but it works fine for discord bots
ya
Shoot whatever you have trouble with
@sinful lotus u gonna ask?
I cant make the bot
check itself
if it has permissions for sending message
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): DiscordAPIError: Missing Permissions
I tried doing that
where in all my commands are inside that
Can’t u just....
ok removed those
if (msg.isMentioned(config.kashimauserid)){
try {
let yourownprefix = settings.getProp(msg.guild.id, "prefix")
return msg.channel.send(`**Teitoku**, this **Server Prefix** is set to => **${yourownprefix}**`)} catch(error) {}};
with that
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): DiscordAPIError: Missing Permissions
still here
- Ur trying to do ur commands
- Do message.channel.send().catch(e => {}) sorry I am on mobiel
No code blocks
at last it woked
👍
now my problem will be
do I need to rewrite all my code
if (!msg.content.startsWith(guildConf.prefix)) return;
after that line?
No
because if you used a command
it will error again
so do I need to rewrite the whole code
or just put a try catch
yep it worked with the try catch
xD
ty for the help fellow devs
I want to note here that exceptions are not to be ignored
it's considered bad practice to expect an exception when in the first place you could avoid them
So you are saying making sure the process doesnt crash is bad?
I think unusually high use of try catch except blocks shall be avoided..But still where we have no control over causes of error like net problem bad user input etc etc
"it's considered bad practice to expect an exception when in the first place you could avoid them"
except for stuff where there are no API endpoints such as the ability to check if you can dm someone
you can't as a human expect your code to be perfect and never error
Have fun living on the edge then 🤔
I wanna ask something
how do I check the bot if it has permissions for sending message
for some of my codes that needs it
msg.guild.members.get(client.user.id).hasPermissions('SEND_MESSAGES')
I already tried this but I cant make it work
That works for guilds, but it's possible that you have no permissions in a specific channel
yeah thats the case of what Im trying to fix
since some of my codes doesnt really like the .catch stuff
Well, similar approach then. Get the channel and then the Channel Permission Overrides
at least that'd work in D.NET, no idea about JS
try:
await client.send_message(message.channel, chat)
except discord.Forbidden():
print('wtf')
@sinful lotus this worked for me
omg sorry
lemme see
have u checked https://discord.js.org/#/docs/main/stable/general/welcome ?
i dont think u can do that
Saya u should try to work around
https://discord.js.org/#/docs/main/stable/class/TextChannel?scrollTo=permissionsFor
@uncut slate make em read the docs :/
not really
either message.guild.me.permissions.has or what you already linked
I'm just adding on
tru
Hint: he wants the channel permissions, not the guild ones 👀
Convert?
DeprecationWarning: EvaluatedPermissions#hasPermission is deprecated, use Permissions#has instead
let permcheck = msg.channel.permissionsFor(msg.guild.me).hasPermission("SEND_MESSAGES")
using Permissions.has
makes send message undefined
Well, Permissions#has refers to an instance of Permissions on which you call .has
do you have an instance of Permissions?
something like new Discord.Permissions(memberpermissions); ?
d.js
Ok, so what you want is to acquire a Permissions object
from some other method, probably in the Channel one
https://discord.js.org/#/docs/main/stable/class/GuildChannel?scrollTo=permissionsFor does that for example
All you need to do is replace .hasPermissions with .has
why do people dont read my messages :/
regex
dbl.getVotes(true)
does that check if someone voted at any time
or only within the past 24h
~help
@south finch @charred pumice should now be fixed
oh okay
though I am not 100% sure, so could you also check if it is? I don't have any bots to check it with
test before applying
OKTO is my first bot too so I am new too all this
How about create one for testing? 😂
lol
idk why yall felt like commentating 
It's ok to be new but just wait until it's polished before you publish it
yeah, well I never thought about the possibility of another bot causing it to reply before launching it here 😓
lol, happens, if I would tell my first faults in programming, you would laugh 😂
no matter what i do im getting
Error: Cannot find module 'dblapi.js'
i have the package
I feel like I should know this by now, but...
in discord.py-rewrite, how would I get a list of member objects that meet specific criteria?
for example all have ban members permission
Rolewise? @ruby dust
Or just permission
Afaik you must go over all of the members sadly
it doesn't really matter, I just need to get a list of members that have something specific in common in a specific server
For loop, i don't think there is another way
That still should be O(n)
I think my bot is having an attitude right now
all the console been doing for the last 10 or so min is spit out errors and restart and spam my server with start up announcements XD
@earnest phoenix and @topaz fjord https://discordapp.com/branding
ik about that but it was fine after that it just been spamming console with errors for the last 15 min or so
im hoping that restart just helped XD
yep that seemed to have helped XD
if (command == "eval") {
msg.delete()
try {
const code = args.join(" ");
let evaled = eval(code);
if (typeof evaled !== "string")
evaled = require("util").inspect(evaled);
let embed = new Discord.RichEmbed()
.setDescription("**__Success!__**")
.addField("Input:", "`` `xl\n"+args.join(' ')+"\n`` `")
.addField("Output:", "`` `xl\n"+clean(evaled)+"\n`` `")
.setTimestamp()
.setColor(0x00AE86)
msg.channel.send(embed)
} catch (err) {
let embed = new Discord.RichEmbed()
.setDescription("**__Error!__**")
.addField("Input:", "`` `xl\n"+args.join(' ')+"\n`` `")
.addField("Output:", "`` `xl\n"+clean(err)+"\n`` `")
.setTimestamp()
.setColor("#ff0404")
msg.channel.send(embed)
}
}```
This code worked fine until...
/home/cabox/workspace/node_modules/enmap/src/index.js:94
throw 'Method can only be used when the value is an object';
^
Method can only be used when the value is an object```
~note: Eval works fine, but it crashes afterward
enmap 👀
change it to this
if (command == "eval") {
msg.delete()
try {
const code = args.join(" ");
let evaled = eval(code);
if (typeof evaled !== "string")
evaled = require("util").inspect(evaled);
let embed = new Discord.RichEmbed()
.setDescription("**__Success!__**")
.addField("Input:", "`` `xl\n"+args.join(' ')+"\n`` `")
.addField("Output:", "`` `xl\n"+clean(evaled)+"\n`` `")
.setTimestamp()
.setColor(0x00AE86)
msg.channel.send({embed})
} catch (err) {
let embed = new Discord.RichEmbed()
.setDescription("**__Error!__**")
.addField("Input:", "`` `xl\n"+args.join(' ')+"\n`` `")
.addField("Output:", "`` `xl\n"+clean(err)+"\n`` `")
.setTimestamp()
.setColor("#ff0404")
msg.channel.send({embed})
}
}```
wait dur
Enmap, yeah...
Alright, I should pay more attention to that though
What difference does it make to put it in {}?
Makes it an object
Since RichEmbed outputs JSON
You need to wrap it to make it an object
that should fix it though
(and that's useful how? lol)
mm alright brb
no...
Luke you dont know what you're talking about...
/home/cabox/workspace/node_modules/enmap/src/index.js:94
throw 'Method can only be used when the value is an object';
^
Method can only be used when the value is an object
I just need to find out where that enmap error is. Yaaayy
how do i find out if two things are the same in js? heres my code
var argresult = args.join(' ')
if(!coins[pUser.id]){
coins[pUser.id] = {
coins: 0
};
}
let pCoins = coins[pUser.id].coins;
if(argresult = message.author) return message.channel.send("```fix\nDon't try to cheat the system! You can't pay yourself to get more money!\n```")```
let args = message.content.split(/ +/g).slice(1,2);
var argresult = args.join(' ')
if(!coins[pUser.id]){
coins[pUser.id] = {
coins: 0
};
}
let pCoins = coins[pUser.id].coins;
if(argresult == message.author/*is this the author's ID? If so, use .id at the end. Is it their .username? .tag */) return message.channel.send("Don't try to cheat the system! You can't pay yourself to get more money!\n")```
Also, if you have a pay system that subtracts money from you and then adds it to the receiving user, it won't cause money duplication @dusty sandal
ok thanks
mhm
actaully @visual surge i had a system like the one you listed above and it actaully did do duping
that's why i have the thing to check to see if the person being paid isn't the message author
user1coins = user1coins - amountpaying
user2coins = user2coins + amountpaying
Still a good idea though, paying self is weird
yeah i have a system like that
Odd, but either way, that works
yes in the end the same result is achieved
(Pst, why not just -= and +=?)
oof duh haha
@earnest phoenix
hi guys, how do i get the invite someone used to join and who created it when a user joins a server?
discord.js, guildMemberAdd event. wanna do it like this:
'{username of who joined, already done} was invited by {invite code creators username#tag} with invite code {invite code, the - - - - - - one}'
dont think u can but. . . u can fetchInvitelinks
You could keep track of invite codes and see whoch one goes up on guildmemberadd
^
just a guess
well it could work but needs some thinking
not really
he explained ir perfectly
use a db => save all invite + usage count to it => on guildmemberadd check which count increased with the db entry => use that invite
sounds pretty advanced, i'll maybe try it
what is it thou *@*ThatTonybo#1234
how to make a discord randomly put the things i want
like meme
dm me if u know
does anyone have premiere or any gif editing software
just use gimp 
no
yes
does anyone know if theres a way to send an entire JS Map over to my API using snekfetch or would i just have to use JSON
Yes @languid dragon, I do.
dw about it i found solution ty
The practically the entire Creative Cloud 2017
Alrighty 
@austere meadow [...myMap]
That resolves to an array of tuples
Then in your API: new Map(myMap);
And that'll turn it back to a Map
ah thank you!
I think JSON.stringify (which you'll call anyways) will convert the Map into an array of tuples
ill try that to see if it does but i might as well use [...]
Oh, it doesn't
[...x] converts an iterator into an array
Technically, for each value the iterator yields, add a value to the array
Map has a built-in iterator (Symbol.iterator), which yields [k, v]
ah yeah
So if you have```js
Map { 1 => 'Test', 2 => 'Test2' }
It'll yield each value
First yields [1, 'Test'], second yields [2, 'Test2'], next iteration is done, "cuts" the iterator
Then all the values yielded get wrapped in an array, aka [yielded1, yielded2, ...]
oh nice
Resulting on [[1, 'Test'], [2, 'Test2']]
thats pretty convenient hahaha
Yeah, I have used iterators and array spread a lot myself 😄
const array = [1, 1, 2, 2, 3, 3, 5, 6];
const uniqueArray = [...new Set(array)];
console.log(uniqueArray); // -> [1, 2, 3, 5, 6]```
Set has an iterator, so filtering duplicated entries is as easy as that
Now you do 😄

You can use for-of and [...x]
Both rely on iterators, so it's pretty convenient because it ensures consistency in your code
yeah
Since both can convert/iterate maps, sets (collections that aren't index based), strings, arrays, and anything else that has an iterator
Want to split a string by characters? Easy: [...myString];, done
yw 
@clever yew a map is like a dictionary in C# right? 😅
Yes
It's keyed collection with a relation key-value, where you get the value by its key.
As opposed to a WeakMap where you get the key by the value.
This one, sir @low owl https://msdn.microsoft.com/en-us/library/xfhwa508(v=vs.110).aspx
Oh, TIL about WeakMaps
The difference is that C#'s Dictionary throws if the key doesn't exist, whereas JS just returns undefined
Well, depends which method you use
Design-wise they're quite similar
Yeah, Dictionary.TryGetValue reproduces JS' behaviour
Kind of weird, the API im currently serializing into c# objects says that a certain object is of type map. But I don't think it actually is. The whole documentation is blurry though. Very inconsistent.
if (myDictionary.TryGetValue("foo", out string val))
{
Console.WriteLine($"Value is {val}");
}
else
{
Console.WriteLine("The key foo does not exist in the dictionary.");
}```Equals to```js
let val;
if ((val = myMap.get("foo")) != null) {
console.log(`Value is ${val}`);
} else {
console.log("The key foo does not exist in the map.");
}```
They both do exactly the same thing
Yeah
Just that val is null in C# if there's no value, whereas in JS it gets re-assigned to undefined
(But can't do much about it because converting undefined to null is a bit tricky, ugly, and slow, unless I add a new line to the else)
We're waiting TC39 (the organization that decides JS' design) has the ?? operator held on
It does... exactly the same as in C# iirc: if it's null (and undefined in JS), run the next statement
There's another collection in JS called Set. It's identical to C#'s HashSet if you wanna check it out
Nah I don't like Js at all. I just need to work with Json right now.
Thanks for your effort though
yw ^^
im tring to make a vote command i want it to send the message and delete mine this is the code i have but it wont work it deletes my message and it wont send the message the bot is supposed to send
if (msg.startsWith( prefix + "vote")) {
message.delete();
const text = args.slice(1).join(" ");
message.channel.sendMessage(text)
message.react("✅");
message.react("❌");
}
Yeah did you define it?
Ok alright
this works fine but it will add the reactions to my message and it wont delete it
if (msg.startsWith( prefix + "vote")) {
const text = args.slice(1).join(" ");
message.channel.sendMessage(text)
message.react("✅");
message.react("❌");
}
const text = args.slice(1).join(" ");
This is the line thats causing issues
.slice() returns the sliced element
Sure
wait...
No errors given in console?
nope
it works in my server
ima try
if (msg.startsWith( prefix + "vote")) {
message.delete();
const text = args.slice(1).join(" ");
message.channel.sendMessage(text)
message.react("✅");
message.react("❌");
}
Hmm what library are you using btw
.js
if (msg.startsWith( prefix + "vote")) {
message.delete();
const text = args.slice(1).join(" ");
message.channel.sendMessage(text)
message.react("✅");
message.react("❌");
}
/\ Does not work
Hmm
Btw .sendMessage is deprecated, you should be using .send instead
Just some remarks
ikr
React to the bots msg
no it doesn't
then ima just stick to
if (msg.startsWith( prefix + "vote")) {
const text = args.slice(1).join(" ");
message.channel.send(text)
message.react("✅");
message.react("❌");
}
if you want it to react to the bot message
Alright but you are reacting on the vote command message
if (msg.startsWith( prefix + "vote")) {
message.react("✅");
message.react("❌");
} **
Did you add any channel/guild checks? Maybe thats the reason why its not working here
i cant use await cuz it is not a async function
Then you need to run the code in a async function on by using the async declarator
Suggest you to read up on Javascript async/await if you are new to this
i never used async
for the past month or so i just used bot.on('message', (message) => {
Well you cant use it for that
Wait did you make a new message event for each command
Hmm ES6 is bae
^
ok gud
for me it is
bot.on('message', (message) => {
if(command stuff)
}
if(command stuff)
(Insert more cmds here)
});
I would suggest a command handler but that's a later thing
like commando?
No
Thats a command framework, not a command handler
Yeah maybe that might be a later thing for you
rip i tried
bot.on("message", async (message) => {
if (msg.startsWith( prefix + "vote")) {
const text = args.slice(1).join(" ");
message.channel.sendMessage(text)
await message.channel.sendMessage(text)
message.react("✅");
message.react("❌");
}
});
but it still wont work
♋
woah I thought it was python at the beginning
You're trying to slice args
^
@edgy needle
Well I'm assuming he defined args
You should be seeing errors just for using sendMessage lmao
Wouldnt it give you a depreciation warning
I think thats what it did when i used d.js
I wanna make a bot with my friend that can make it so that 2 or more people on a server can play blackjack, I'm completely new to bot making and have only devised a game of blackjack based in python which goes from computer vs player.
How should I do this :/
And please how I Can create à bot? And How language can I use?
Ur suppose to pick the language
Also coding Lang not language : English , Turkish, and others
Yeah I now but Java-python-c++ ... How?
How I create à DB please 😧
U can also google it
But I suggest picking a coding language and learning how to use it before coding a discord bot.
Ok tks :'D
Put it in code blocks s
Non i am on mobile. I can't see + :'(
iPhone code blocks exist lol
is catrandom unstable for anyone here?
Can someone help me setup a database
My team won't help me ;c
so can someone help
How do I bulk delete messages older than 2 weeks without using bulk delete?
You can't, as far as I know
rip
ok
mhm
1/1s
So can someone help me with my db
1 message
sa
I love listening for 'debug' events on d.js streamdispatcher https://img.69420.me/PAKvHXPz.png
@languid dragon how do i actuall get all class names i need to do css stuff 
all class names?
* {
}
you either use inspect element or you build a new div and overlay it
like i did with my page
.element{
position:fixed;
left:0;
top:0;
width:100vw;
height:100vh;
background:white;
z-index:1000;
}
puts a layer on the very top
why 👀
which you can use as body to put whatever you want in it
o
like i did
well in that case yes
ty 
does anyone know why
bot.on("message", async (message) => {
if (message.startsWith( prefix + "vote")) {
const text = args.slice(1).join(" ");
message.channel.send(text)
const msg = await message.channel.send(text)
msg.react("✅");
msg.react("❌");
}
});
wont work?
maybe await react?
you are sending a message and reacting to it
yes
what is the error?
if(!args[0]){
let embed = new Discord.RichEmbed()
.addField('❌ ERROR ❌', '...')
.setColor('97009e')
message.channel.send(embed)
return;
}
const sayMessage = args.join(" ");
message.delete().catch(O_o=>{});
let embed = new Discord.RichEmbed()
.addField("speaking_head", sayMessage)
.setColor('97009e')
message.channel.send(embed)
}```
Free working say command! Discord.js

is that... Spoon feed?
Has anyone done vue.js here?
@earnest phoenix What's ya problem?
trying to loop thru all commands from bot api (localhost) that returns an array of commands ```html
<div>
<section class="section">
<div class="container" v-for="command of commands" :key="command.category">
{{ command.category }}
</div>
</section>
</div>
commands being the array
but
i dont want dups of the category
where this should just be Admin, General, Animal not Admin Admin Admin, General General
@weary shoal
All i can think of is sql rn haha sorry bro
all g
I mean, you could make an array of command categories or something
Was thinking about it
const unique = [...new Set(commands.map(item => item.category))];```
Something like that then for category in unique
you'd want to use array.filter with indexOf, way faster
actually
Mercy's way is the easiest and most likely fastest way to get dups out
other then the map 
dw i got this https://jaczaus.me/i/jfyg2roobaefc86.png
array.filter is going to be faster than building a set out of it and then iterating it into a new array
array of 15 items for ref
not in v8 v6.5
im not certain tho
you could be very well correct
and tbh, ur way is like known as the fastest so shrug
canary?
chromium
Chrome canary?
I'm running bleeding edge from AUR, I'll have to check
chromium-dev probably
microoptimization
inb4 im being dumb and forgot what version the new optimizations are in
ping kyra 
hes asleep
sad
I'll just go install v10
brb
just got to remember what one doesnt break inspect

Come on, we should just all write bots in asm and use the least instructions as possible
we need nanoseconds
:^)
I'd probably go with new Set, just because the latter is ugly
heck, that's even what we use in Memer
but it's not the fastest
its not like its gonna matter to the end users
yeah, it's not
which is new Set
maintainable code is good code
do that and you'll have times of minutes 
not rlly
im just being lazy and going to go look at the v10 branch
unless you're writing code where a single microsecond is a big thing
which isn't the case here
there's literally zero reason for microoptimizing
ever since jacz joined back I've seen alot of micro-optimization
lmfao
lmfao
One question since old peeps are here, Do you think i've changed
Reading nodejs src code be like 
@earnest phoenix Yes, you have mellowed out so much lmao
lmao
from the few files i've read
its v6.6 with the optimizations iirc
node source isn't that bad
anyone who knows html? whats wrong with this? <button class="button button2" href="https://www.google.com">Learn More</button> when I click it, it doesnt do anything?
<form action="http://google.com">
<input type="submit" value="Go to Google" />
</form>
@earnest phoenix <a href="https://www.google.com/" class="button button2">Invite Now</a> still doesnt work, have I done it wrong?
put the a around the button
oh
<a href="https://www.google.com/">
<button class="button button2">Learn More</button>
</a>```
ah ok
<a href="https://www.google.com/">
<button class="button button2">Invite Now</button>
</a>
``` Still nothing
@weary shoal
Try the way i posted
yeah I tried that first, didnt work either
<input type="button" onclick="location.href='http://google.com';" value="Go to Google" />
oh if you right click and selct open in new tab, it works
whys that?
ok, it works. Dreamweavers preview must not let you click the buttons, thanks for your help
How would I check if a set has multiple instances of something?
ik this is probably pretty basic however I can't find anything on mdn and have never learned about sets
a set can't have duplicates
Maybe the stylesheet has the functionality, that you can style a link as button too... Just adding class="button butron2" to the a tag
@frank wyvern
inb4 it's a string
is there any up and down emojis that looks like this or I mean match the style!? I would like to use it on my bot but I need up and down emojis.
⏫ ⏬
It's up, down, and ok. I'm using the check for Ok. It's more about the look, really. I know the default ones.
I mean, I know there is already a default emojis. I know the default ones., as previously stated. I want to know if there are up and down emojis similiar to matching the style of the
.
not that we know of.
Is it a server only? Like the emoji from this server only?
That emote is made by DBL (afaik)
You could just recreate it. Not a complex shape :D
I've seen that emote everywhere, afaik
🤷 idk
@earnest phoenix Same, before this server was popular.
IIRC that emote was one of many made for the server
I don't know if it was copied or not though
How do you store the message that was edited and the new message it was changed to?
message like this
Someone edited message from to
message like this was supose to be
I'm pretty sure you can get edits from a message object anyways
Depends on the lib/lang on how
javascript, yea I can get the last message bot not if it was prior to that
Oh bots can't see here anymore
seen a few with before pic after pic and message edits, would be awesome for a bot log
There's an event for it
It's messageUpdate
that triggers when a message is edited or deleted IIRC
ohh nice!
Yeah it has the old and new messages
Only edits, not deletes
omg didnt even think to look here ty ^^
np
How good of an idea is it to set my bot's help message to a url linking to a help page on my site?
owo
@earnest phoenix Ok if you are using express you can get the ip by this:
const ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
Basically the first part is used if you are behind a proxy(like nginx for example) and the second one is the direct connecting ip if it is not behind a proxy.
^ yeah and this if you are using CloudFlare
Np
?serverowner
i made kind of some weird bot i guess xd







