#development
1 messages ยท Page 348 of 1

When you actually read your code how I displayed above, if you genuinely put effort into making ur code clean and readable, you'd find that you'll actually find the mistakes you make.
You come to #development expecting people to just point out your silly mistakes so you can continue on to the next thing?
Please install eslint, and validate that you have no errors before posting here
If you post any more code that is easily noticed and can be easily fixed there will be consequences
he's actually banned from most servers cuz of that
I have a question,Im a bigginer scripter and I watched a video but it confused me can you help?
What lang?
JavaScript
1 moment
Ok
http://nodeguide.com/beginner.html
https://nodejs.org/en/
https://developer.mozilla.org/en-US/docs/Web/JavaScript
https://discord.js.org/#/
Here are some common documentations and guides to get you started
- Start with figuring out Node.JS (you need that to run any server-side javascript)
- Head over to Discord.JS to see how you can use Javascript to interact with Discord API
- If you're not too sure about how to code at all, go to the official documentation and/or look up basics on Javascript for help to get started.
JavaScript (JS) is a lightweightย interpreted or JIT-compiledย programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScriptย is a prototype-based, multi-paradigm, dynamic language, supporting object-oriented,ย imperative, and declarative (e.g.ย functional programming) styles. Read more about JavaScript.
I have a question,Im a bigginer scripter and I watched a video but it confused me can you help?
- You gave me no context
- I have no idea what you're having trouble with
- ????????
Ok so I watched a video but it confused me and it's about putting commands in a bot
I know how to use node.JS
But with node.JS I have trouble

You're still being extremely vague.

Ok so I watched a video but it confused me and it's about putting commands in a bot
Still doesn't really tell me what your issue is lmao
yeah, uh, still making no sense 

Question: Is the 0th shard entirely DM's or does it handle some private messages, too? Using Discord.py.
^ That last part is what I was wondering. c:
I was wondering if it was only DM's or not. Thank you, Natan! โค
@barren brook https://www.youtube.com/watch?v=-5jJaO17Gjs watch this video.
๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ READ BEFORE POSTING A COMMENT! Please do not ask for spoon feeding in the comment section, feed yourself! Comments that simply dump all c...
yo peeps im new to python i want to make an accurate ping command but i dont know how to
hlep
measure the current time in ms
send typing to the channel
measure it again
turn both into ms with *1000
then do secondtime-firsttime
and then yo got ur ping
So I have
delete require.cache[require.resolve('../commands/${cmd}.js')];
Trying to reload a command but it has no effect 
Can you host bots on Windows Vista? ๐
@earnest phoenix Well, I have this shitty(sorry for my language) laptop from 2007, and it isn't doing in a good job
I think it mentioned something about out-of-date scripts?
lol
๐ค "doing in a good job" I need to work on my grammer, for real.
Anyways, back to my craptop thingy
JS
I did npm install Discord and all dat
Oh?
I also had to npm install cleverbot
I have it on the bot's file
Funny thing, my charger for my 2013 laptop works on the 2007 laptop! WOW, congrats modern technology!
ikr
Yes, I know
meh
I don't believe you
plugs out charger to be safe
Alright
I have it layying around somewhere
I am using a desktop now
I have three computers sitting here
My desktop is from this year, I think

was released in Aug 21st
I got it on Nov 12th
SyntaxERROR: Block-scoped declarations
@earnest phoenix
OH hell yeah
Kids Coding :p
aw hell yea, is that Google I see? @earnest phoenix
why do people think coding is mix and matching blocks together
that's almost nonsense
^
discord blocks scratch
Block them
no u
oki
Does anyone know how to set up a message collector?
@vital lark Also for a banmultiple command
what
Like of course it would have filters
I never used a message collector, so I don't know.
Your mention I mean
From befoorreee
On why I should use a forEach statement
:p
i wish i knew how to code
but i never got into it
i did learn some html and web stuff from a class tho
just basics, not much more
Watch some tutorials
from treehouse or udemy
Yo in njs you don't have to assign a type to a variable right?
not like a var can only be a string
or only a random other thing
Yes, you do not have to, unless you use strict or it is TypeScript
strict can be useful if you know how to use it properly
But well, TypeScript exists, so there is no need to use it when there's something better
fuck ts
TS is usefull af
- With node.js in order to seperate a file into multiple files you need to use modules.
- You can require one module into another module by using
const file = require('dir/to/file.js') - The file should look as such:
module.exports = {
something : "value",
another : false,
execute : function(){
// do things here
}
}
- The above is an object so you would call anything in here like
file.something/file.anotherand/orfile.execute() - https://nodejs.org/api/modules.html
what does the something and another thing mean?
so in a javascript object it has indexes and values
something, another and execute
are indexes
thats what you call on to get the values
"value", false and function()
so after including a module you'd call it with the variable "const file = require..."
"file.something" would = "value"
You can find more information on node.js modules here: https://nodejs.org/api/modules.html
And more on Javascript Objects / "JSON" here: https://www.w3schools.com/js/js_json_intro.asp
Any npm modules that can read times like "3h" "5m" etc?
No
Rip
Please?
how is it done for when dude mm DM my bot it him that I can use the commands in DM?
i think it depends on the command handler otherwise on the lib you use
w
@north fog discord.js
then I can't help you, I dont know discord.js and dont use js for bots ;/
@north fog ok thanks you
how is it done for when dude mm DM my bot it him that I can use the commands in DM?
ezpz
@quiet bobcat you can help me?
if(!message.guild) return;
How to make commands not work in dms
Return it right after if it is not dm
Inside a message event listener
Yes like on every command
@quiet bobcat for help commands ?
What?
If you want help commands to work then dont put it there
Lol
No problem lol
I have little issue here, I am using Discordlist.org API, and about the server count, if bot don't share this info with discordbots.org it's write "undefind" how do I change it to "This bot not publish this info on Discordbots.org" for example?
replace it ยฟยฟ
what
,
Map them @quiet bobcat
Ok
pydbl not supported on Python v3.6.1?
๐ค
Nvm. Just had to install from the GitHub repo
๐คท
@thorny hinge by complete fluke i was about to make something like that as in was minimising discord to open atom if you find anything lemme know
> register-scheme@1.0.0 install C:\Users\waa\Desktop\RPC\node_modules\register-scheme
> node-gyp rebuild
C:\Users\waa\Desktop\RPC\node_modules\register-scheme>if not defined npm_config_node_gyp (node "C:\Users\waa\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )```
anyone know why i get this
just started a new project
and when i try to install some npm packages it gives that
How do I make a stream and make the stream listen to the voice channel?
for discord? @vital lark
what are you using to stream?
or you mean for the bot
ffmpeg
ye
then something called node-opus
yumi.user.setActivity(`Version: ${yumi.currentCommit} | !y.Help`);
^
TypeError: yumi.user.setActivity is not a function what is new setGame?
nevermind
discord js docs for the win
its set presence lmao @wise nexus
Set activity is a thing too iirc
Well no shit you have to give it a game @wise nexus
you cant just put setPresence("Succ a ducc")
Does anyone know about shards???
yumi.user.setActivity(Version: ${yumi.currentCommit} | !y.Help);
^
i changed setact to setgame and it worked
so its gucci
d.js
do u know how to grab that shard?
then you should be able to just use shard.servers
or .guilds
@fervent goblet https://i.imgur.com/vVEYbLH.png
rip
@sinful meadow use the broadcastEval method
Ive legit never messed with shards @young cradle
You could literally search the docs for broadcastEval
<Client>.shard.broadcastEval();
You put a string inside it, it evals on every shard, returns a promise with an array of what each shard returned to you
Again, could read docs, and if did not understand, read it on d.js's repo
It's just an eval that is evaluated on each child process
w3schools vs Mdn
For webdev or application development?
But well, in general, MDN. Webdev I personally prefer w3schools, but MDN
what did i do wrong ugggh
whats error ยฟยฟ
no it doesn't check wether or not a type of currency is available
it just doesn't excute
make an array with arivable currency's ยฟยฟ
๐
ok
yea it has its own permission system with mongodb
and he called mongodb wrong
wtf
I need some help, I want all my tokens in a json file. How can I select them?
why are you using mongodb
using javascript
why do you not use mongodb
take them out of the json file
ez
ik, but it's just the same as normal?
o lol
@earnest phoenix JSON isn't terrible
what do you mean storing data
wtf do you even store
it is for huge amounts of data which is constantly being querried
what do you store
shitloads of objects regarding gamedata and positioning of npcs ect
I have +100K rows in my database ๐
No, I have a level system
and a waste of db space
why is it useless to save data
saving the presence data is useless
it's not
^
you can use it to make better games
@neon pasture Just to clearfy
JSON
{
"bitchbot":"Mx.your.token",
"dembot":"Mz.another.token"
}
JS
client.login(require('./tokens.json').bitchbot)
@earnest phoenix What are you storing in your Mongo
finnaly you got rid of your dumb nickname
@earnest phoenix What are you storing in your Mongo@earnest phoenix What are you storing in your Mongo@earnest phoenix What are you storing in your Mongo@earnest phoenix What are you storing in your Mongo@earnest phoenix What are you storing in your Mongo@earnest phoenix What are you storing in your Mongo@earnest phoenix What are you storing in your Mongo@earnest phoenix What are you storing in your Mongo
user data, position of units, position of ai's, values regarding strength of items in person backpacks ect
IT IS A GAME
I DID
nope
what lib do you use
discord.js?
going to tag u if u dont reply
@earnest phoenix ๐
@earnest phoenix ๐@earnest phoenix ๐@earnest phoenix ๐@earnest phoenix ๐@earnest phoenix ๐@earnest phoenix ๐@earnest phoenix ๐@earnest phoenix ๐@earnest phoenix ๐@earnest phoenix ๐@earnest phoenix ๐@earnest phoenix ๐@earnest phoenix ๐@earnest phoenix ๐@earnest phoenix ๐@earnest phoenix ๐
omg
eris
@crisp warren @crisp warren @crisp warren @crisp warren @crisp warren @crisp warren @crisp warren @crisp warren @crisp warren
fukkk
lol why fuk
i used discord.js for a long ass time
then moved to eris
because eris IS SUPERIOR
:o
heck yea it is
look at that memory and cpu usage
thanks eris
lysm
how dare you slander mongodb and then continue to use json files @crisp warren >:c
sql
SQL
nonsql superior
@crisp warren why is sql better then non sql like mongo
๐ angular, but I was with you until there
react is the way for most folks these days, state flow = god
i need to look into react
i always have figured its something simlar to electron but i havent done much research into it
start here: http://facebook.github.io/flux/
Application Architecture for Building User Interfaces
mk i will once i get home
i only recently began getting into web development like that, pretty much all my work has been with node and serverside scripts
been using handlebars, express, sockets, mongodb, and alot of html and css for small projects so far
i dont know i just litterally never looked into it before
im devin a utility bot. what should i add
bot.on guildMemberAdd
k
cool
its callback is the member and guild
@earnest trout here plice
U can't ๐
@thorny hinge https://npm.js ?
That can lead to bad things @thorny hinge
Just letting you know
And it can also be against the tos
theres a bot that records a voice channels then converts it to a mp3 files then sends the file to the usser
Doesnt matter
If the user doesnt not give consent on recording his audio
Or voice
its against the tos
@sinful meadow the user is gonna use a command to start recording..
Then they get an mp3 of themself

Doesnt matter still @thorny hinge
What if there is more then 1 person in the channel
And they dont give consent
@woven echo is privacy invasion
^
it's offline
I'll just scrap the vc record command 
i write everything in jsfuck
:^)
3 lines of code requiring eris, and connecting https://pastebin.com/qqZXq81h
(joking of course i dont actually write in jsfuck)
jsfuck != brainfuck
if you want to be that strict parent i guess yea
How can I reload a file? I wanna be able to reload commands in js. Im pretty sure mayo had a link but he got banned lul
@thorny hinge
make it so it deletes the cached data of the file
then reaquires it
Delete cached data sonniboi ใ3
I tried it but it didnt work @sinful meadow
rip
Like it had no effect
Instead of requiring a file maybe just fs read it?
Vlearing require cache shouldve worked ๐ค
fs reading is trash
where is the discord asm x86 library
Ask tonkku
So how do I reload the file? @sinful meadow
1 sec
@thorny hinge
this
This is were i started
Scroll down to find it
then study it
Thats just for deleting
my bot is somehow offline in every server even though it is running, on startup it now does this even though it has worked with no code changes in the past for a long time..
Loaded data!
Saved Data!
18:29:53.705 [HttpClient@293122976-18] INFO sx.blah.discord.Discord4J - Websocket Connected.
18:29:53.726 [HttpClient@293122976-17] INFO sx.blah.discord.Discord4J - Shard 0 websocket disconnected with status code 1006 and reason "Disconnected".
18:29:53.730 [HttpClient@293122976-17] INFO sx.blah.discord.Discord4J - Beginning reconnect for shard 0.
18:29:53.732 [HttpClient@293122976-17] INFO sx.blah.discord.Discord4J - Performing reconnect attempt 0 for shard 0.
18:29:54.262 [HttpClient@40118552-32] INFO sx.blah.discord.Discord4J - Websocket Connected.
18:29:54.264 [HttpClient@40118552-30] INFO sx.blah.discord.Discord4J - Shard 0 websocket disconnected with status code 1006 and reason "Disconnected".
@naive stag have you recently updated your d4j version?
no, I havent changed the jar for ~ a week and it worked up to today
And what if you would try to update
1006 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is designated for use in applications expecting a status code to indicate that the connection was closed abnormally, e.g., without sending or receiving a Close control frame.
I mean it does seem like a D4J problem
might be cloudflare
d.js had a similar issue a while ago iirc 
@umbral pelican Do you know how to use regexp?
everyone knows regex
i dont
@glossy sand well could you help me lmao
maybe
Im trying to make an anti invite link
Please help me
Annnd i wanna use regex
I need help with rpc
https://regex101.com ยฏ_(ใ)_/ยฏ
It keeps saying invalid client id
But my client is is right :/
(https?://)?discord(app(\.|\s*?dot\s*?)com\s+?/\s+?invite\s*?/\s*?|(\.|\s*?dot\s*?)(gg|me|io)\s*?/\s*?)([a-zA-Z0-9\-_]+)```
ยฏ_(ใ)_/ยฏ
^ you should probably also change com\s+? to com\s* in case of whitespace
How can i remove permissions from a channel
Lang?
d.js
Then I can't help you
Sorry
Would this help?
Seems pretty easy
And if you'd send an empty options value?
Tried
does nothing
sql.all(`SELECT * FROM queues WHERE guild ="${msg.channel.guild.id}"`).then(row => { row.forEach(element => { return element.title; }); });
Why doesn't this work?
^
btw, looking again to the code, it will return only 1 title, but the return is in a lambda (not sure if that works like you want it)
welp
cool
why does java's regex parer stackoverflow
because it doesn't have proper tail recursion support
but i would think it's a symptom of your patterns being too complicated
Output was:
Setup.wxs
C:\Users\jori\Desktop\dev\js\react\f2\builds\out\Setup.wxs(2) : error CNDL0108 : The Product/@Version attribute's value, '!(bind.FileVersion.justmaffies-todo-list.exe)', is not a valid version. Legal version values should look like 'x.x.x.x' where x is an integer from 0 to 65534.
C:\Users\jori\Desktop\dev\js\react\f2\builds\out\Setup.wxs(2) : error CNDL0010 : The Product/@Version attribute was not found; it is required.
bij Squirrel.Update.Program.<createMsiPackage>d__21.MoveNext()<---
System.Exception: Your package version is currently 1.0.0.0, which is *not* SemVer-compatible, change this to be a SemVer version number
bij Squirrel.ReleasePackage.CreateReleasePackage(String outputFile, String packagesRootDir, Func`2 releaseNotesProcessor, Action`1 contentsPostProcessHook)
bij Squirrel.Update.Program.Releasify(String package, String targetDir, String packagesDir, String bootstrapperExe, String backgroundGif, String signingOpts, String baseUrl, String setupIcon, Boolean generateMsi, String frameworkVersion, Boolean generateDeltas)
bij Squirrel.Update.Program.executeCommandLine(String[] args)
bij Squirrel.Update.Program.main(String[] args)
bij Squirrel.Update.Program.Main(String[] args)
no YOU can get aids
TIL vscode can do neet color things https://i.imgur.com/05eb7Ku.png
no more going online for color
!
ye lol
lol
ip: xxx.xxx.xxxx.x
&&&
?.?.?.?
About to submit my bot to the bot list and am unsure of this Bot Prefix field. There aren't any commands to call on my bot so not sure how this is applicable to me. Maybe I'm misunderstanding this bot prefix field?
out of curiosity, what does your bot do?
It's a secret word bot. So it's storing an array of secret words and it reads all messages sent to chat as it does it it's ticking a counter until the "secret word" is said. Once the secret word is said in chat it embeds a message saying "you said the secret word" and resets the secret word and counter.
It's based on all the secret words from Pee Wee's Playhouse
you ought to implement a help command of some sort
it's good practice
just in case someone wants to know what the bot is doing
i suppose. in my mind i wanted the bot to be passive and not have people interact with it. it makes sense with the theme of the bot because you don't know the secret word so it should be a suprise when it's said.
why's that?
annoying
i get that but isn't up to the owner of the discords anyways whether or not they want the bot?
it only picks one word to auto respond to each time. you could break it by just posting all the words at once but isn't that the same as calling a bot over and over?
not break, i mean "cheat" it
Well unprefixed responses do get muted in this server but they are allowed
So calling it a nogo is also not entirely true
aren't the majority of bots submitted useless? how many music and anime generating bots does anyone need?
srem
hay all..
im locking for a clock bot , somthig intrntional. can u help me?
@fervent goblet This is not my main language, I thought you would understand it alone, without explaining it.
jesus
no I only speak english, dutch, sarcasm, meme and idiotic
So how did you not understand it alone?
Nah he can just be a dick at times ignore it xD
Now I'm using a translator to make it easy for you, it's ok ๐
Lol
I'm starting to look like cf
@weak parrot It's okay, not all of them were born with a basis for manners, can you help me?
Sadly no I don't know many other bots on the list
sounds like you're looking for a bot you can call to display the time from a specific time zone?
I have a server with many people from all over the world. In order for us to coordinate events together we need a global clock or at least know what time each user has
@vestal horizon yes
that would be too easy to integrate into a bot
well, if I have enough unique ideas for a bot I'm gonna make a new public bot
I'll count this as one
@fervent goblet Why do I have a feeling that it will be something disturbed?๐
?
its gonna be a normal bot
which might slightly display my rick and morty addictions ๐
@vestal horizon you could have a setting that enables it per server
Don't know if your bot does anything else
@quasi marsh sorry not sure i know what you mean
Well, for the unprefixed responses
Allow to disable/enable them on a per server basis
So it could be disabled here
And enabled for someone who actually wants it
unless you're cheating (typing every word from the secret word array) the bot the responses won't come up very often. it only chooses one word from the array to respond to at random.
would this work in my bot
@amitai007#7895 a reminder bot?
bot dev role
asking if a copy pasted ping command will work
k

so i started working on a chat application for a school project
need UI opinion
dm me if yar can
does it work or work work
I don't see anything
^
Can somebody help me? I'm trying to get uptime in hours, minutes and seconds. Any way to do that?
Im using discord.js
@quiet bobcat take a look at moment duration format bpk module
client.uptime has the time it's been up in milliseconds
then just implement some math to calculate hours etc
Sorry, bpk = npm
ok
You can format what Thonkku said.
Yeah but how do I make it so it doesnt go over to one hour when only 30 minutes have passed
and how do I limit minutes to 60 and seconds to 60?
use modulus
ok
ok
Math.floor((client.uptime/1000) % 60) will get you seconds
Math.floor((client.uptime/1000/60) % 60) minutes
Math.floor(client.uptime/(1000*60*60)) hours
Why floor it? @bitter sundial
well you dont want decimals right
you could round it lmao
that produces false results after .5
True
Question what is days then @bitter sundial
???
shit
Math.floor(client.uptime/(1000*60*60*24))
?
what about it
Is that days?
i totally guessed that lmao
Sooooo wait
This will auto fix?
1 sec
Soooo this Math.floor((client.uptime/1000/60) % 60)
It wont go over 60?
it will go back to zero?
do you not know what a modulus is
~facepalms~
Lmao
Nvm i was just having a derpy moment lmao
If someone did like "tempban <user> 3h" how can I read the "3h" and change it to ms? Is there an npm package for that?
I can't seem to find one
Nope you would have to make it


Thanks man
np
same thing on one of my bots
kk
๐ข
Discord.ExecuteAndWait(async () =>
{
// lel rip bot XDDDDDDDDDD
await Discord.Connect("TokeN xd", TokenType.Bot);
Discord.SetGame("[type ~help I type ~webpage]");
});
no errors but doesn't start ๐ฆ
error code 4012
๐ข
}); The ; part is red after the launch :(
๐ญ
help pls
idk
D:
O.K
Hey babe we need you
๐
Just wait he might come lmao
k
What?
Sorta I guess xD
Well for a bot lmao
:D
@next wedge ask
k
Wait what version of Discord.Net are you using?
``Discord.ExecuteAndWait(async () =>
{
// lel rip bot XDDDDDDDDDD
await Discord.Connect("TokeN xd", TokenType.Bot);
Discord.SetGame("[type ~help I type ~webpage]");
});`` The `` ;`` part is red after launch and i get the error code 4012 :/
0.9.6
Hmm
๐ข
Cause the error is saying that the gateway version is no longer supported of invalid let me boot up one of my old 0.9.6 bots and see if I get the same if I don't get the same error I'll be able to help you more
Hmm
Well Discord.net 0.9.6 was supposed to get shutdown months ago but my old 0.9.6 bot also still ran fine so
lol
Let me check if it still runs though
A minute I just started up my server xD
No I meant like my server as in a PC
Ugh this is taking long
Welp mine starts up but it doesn't want to connect to the Discord gateway so I'd suggest you remake your bot in Discord.net version 1.0.2 or higher
Sorry for the bad news but it seems like they really stopped supporting 0.9.6
Yeah a lot has changed going from 0.9.6 to the newer versions
How do I make multiple sub commands in one command? Like !example test
#Args mate
ok thank you
Args are the first thing that comes after a command @quiet bobcat
For example
d <==== Arg 1
if(args[1] === "codingsucksass"){ //DO SHIT} else { //DO OTHER SHIT }
You have to define args yourself
Yeah
Its not default
@earnest phoenix
public class GuildCountUtil {
public static void sendGuilds(JDA jda) throws IOException {
String url = "https://discordbots.org/api/bots/" + jda.getSelfUser().getId() + "/stats";
int serverCount = jda.getGuilds().size();
//int shardId = jda.getShardInfo().getShardId();
//int shardCount = jda.getShardInfo().getShardTotal();
String query = "{\"server_count\": " + serverCount + "}";
String token = jda.getToken();
String charset = java.nio.charset.StandardCharsets.UTF_8.name();
URLConnection conn = new URL(url).openConnection();
conn.setDoOutput(true);
conn.setRequestProperty("Accept-Charset", charset);
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Authorization", token);
OutputStream output = conn.getOutputStream();
output.write(query.getBytes(charset));
output.close();
}
}
it's a modified version of one of the examples
oh
hm
that example uses the wrong thing for a token
<.>
that should maybe be removed from the #312614469819826177 channel since it's making people post their bot's token instead of the api token for discordbots
he meant token as in discordbots token

I need help with my bot...
Ut is coded in JavaScript
It is a bot that posts random riddlesintothe server chat and the first person to guess the correct answer wins!
Here is the starting code but it keeps coming up as my name being tagged because of message.reply...
//Riddle List:
var riddlelist = {
"riddle" : "What goes up but never comes down?",
"answer" : "Age",
"riddle" : "Testing?",
"answer" : "Yes"
}
//Riddle One
if(command==="riddle") {
var randomriddle = riddlelist[Math.floor(Math.random() * riddlelist.length)];
return message.reply(randomriddle)
}
wait toString maybe? hmm
var riddlelist = {
"What goes up but never comes down?",
"Age",
"Testing?",
"Yes"
}
lmao
The string that is extra is useless
oh
I'm confused now.. I'm definitely using the correct key now for updating my bot's server count but it's still not displaying
No but theyare the answers to it
@sinful meadow yes but where would i put the answers to the riddle?
No
?
@distant sparrow what lang?
ok
@sinful meadow https://this-is.definitely-not-a-sketchy.host/32f7e15987.png nope, java doesn't work like that
Anyone please?
Hey i dont know i dont fuck with a shit language @inner jewel
[] not {}
oh okay
@earnest phoenix
thank you:)
{} = key/value pairs
[] = list
const riddleList = [
{
riddle: "...",
answer: "..."
},
{
riddle: "...",
answer: "..."
}
]```
yes
Alrighty cheers ๐
Is it possible for me to find a riddle API that i could use instead?
if (message.content.startsWith(prefix + 'ping')) {
message.channel.send('Pinging...').then(sent => {
sent.edit(`Pong! Took ${sent.createdTimestamp - message.createdTimestamp}ms`)
} else```
why am i getting this error
Because you're missing a ) after argument list
- You haven't closed off your
.then - the sudden "else" makes no sense, unless you cut half your code
- As the SyntaxError suggests, after } you need )

it works

hey
does anyone know why do I get this error
{ DiscordAPIError: Cannot send an empty message
at item.request.gen.end (C:\Users\Win\Desktop\github\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:71:65)
at then (C:\Users\Win\Desktop\github\node_modules\snekfetch\src\index.js:218:21)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
name: 'DiscordAPIError',
message: 'Cannot send an empty message',
path: '/api/v7/channels/374201746462998528/messages',
code: 50006 } Promise {
<rejected> { DiscordAPIError: Cannot send an empty message
at item.request.gen.end (C:\Users\Win\Desktop\github\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:71:65)
at then (C:\Users\Win\Desktop\github\node_modules\snekfetch\src\index.js:218:21)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
name: 'DiscordAPIError',
message: 'Cannot send an empty message',
path: '/api/v7/channels/374201746462998528/messages',
code: 50006 } }```
because I don't get anything it says
ok
this is my code
let clean = text => {
if (typeof (text) === "string")
return text = text
.replace(/`/g, "`" + String.fromCharCode(8203))
.replace(/@/g, "@" + String.fromCharCode(8203))
else
return text;
}
if (message.content.startsWith(prefix + "eval")) {
if(!message.author.id === message.guild.ownerID) return;
try {
let code = args.join(" ");
let evaled = eval(code);
if (typeof evaled !== "string")
evaled = require("util").inspect(evaled);
message.channel.send(clean(evaled), {
code: "xl"
});
} catch (err) {
message.channel.send(`\`ERROR\` \`\`\`xl\n${cted}`)
}
message.channel.send("hi")
}```
how is this empty
Clean(evaled) probs
I know a good fix for that
Ken
Do you remember the download for the discord developers version? @languid dragon
Nope
Yep
Not when its hidden
Then How's anyone supposed to find it
Its 1am
But ive searched
i dont want the damn test build lmfao
Where exactly did you hear of this version?
I saw it a looooong time ago in this chat
Donuts screenshot lmao?
Right
@sinful meadow https://discordapp.com/api/download/development?platform=win
What do you need help with?
Im doing this c# thing
and im wanting to make a list view
and it to add or display the text of a guild i have selected with a dropdown menu could you help me?
Wait what exactly do you mean? Like a menu you can search trough? Or just list that shows info?
Like it has the drop down menu
of all the guilds
and i can choose a channel
and send a message in it
Well I do know how to make a list that shows all guilds but for channels in those guilds and how to send messages to em is something I have never tried
I do have a server with other C# developers though I have no idea if they have any experience doing this either I do know CF and DeStilleGast might have something like that
@weak parrot
How can i add all the guild names to a list??
I tried this
and it doesnt work
foreach (var Guild in Client.Guilds)
{
//metroComboBox1.Items.Add(Guild.Name);
richTextBox1.AppendText(Guild.Name + "\n");
}
i tried both
Welp I'm not behind my computer so I can't check the methods
rip
@stone kiln can you help him?
i got tagged?
give me a sec
gonna try to think how it was again out of my head
[OwnerOnly]
public async Task ListServers(int page = 1)
{
page -= 1;
if (page < 0)
return;
var guilds = await Task.Run(() => _client.Guilds.OrderBy(g => g.Name).Skip((page) * 15).Take(15)).ConfigureAwait(false);
if (!guilds.Any())
{
await ReplyErrorLocalized("listservers_none").ConfigureAwait(false);
return;
}
await Context.Channel.EmbedAsync(guilds.Aggregate(new EmbedBuilder().WithOkColor(),
(embed, g) => embed.AddField(efb => efb.WithName(g.Name)
.WithValue(
GetText("listservers", g.Id, g.Users.Count,
g.OwnerId))
.WithIsInline(false))))
.ConfigureAwait(false);
}
is how i have it @sinful meadow
any more of a basic version lmfao
Since all im trying to do is add it to a lable/richTextbox
let me think
`varc
public async Task ListServers(int page = 1)
{
var guilds = await Task.Run(() => _client.Guilds.OrderBy(g => g.Name)
await Context.Channel.EmbedAsync(guilds.Aggregate(new EmbedBuilder().WithOkColor(), (embed, g) => embed.AddField(efb => efb.WithName(g.Name)
}```
@sinful meadow how is that
@vital lark this is csharp not JS
for some odd reason i cant use async and await @stone kiln
oh right
exports.run = async(additions) => {
}
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace BotNameGoesHere.Common
{
public class AsyncLazy<T> : Lazy<Task<T>>
{
public AsyncLazy(Func<T> valueFactory) :
base(() => Task.Factory.StartNew(valueFactory))
{ }
public AsyncLazy(Func<Task<T>> taskFactory) :
base(() => Task.Factory.StartNew(taskFactory).Unwrap())
{ }
public TaskAwaiter<T> GetAwaiter() { return Value.GetAwaiter(); }
}
}```
EW
@sinful meadow you need to do that
Java is betterโข
no
@sinful meadow and when you have done that in the list command do
using BotNameGoesHere.Common;
// rest of code
using MyAss.Category.Common;
```did I do it right master @stone kiln
depends if you have the file listing specified
why am i keep getting this error
presumably you don't have a module called "return-deep-diff" installed
@elfin depot well first of all, you can start by not DMing me unsolicited
yeah that was the problem
second of all, you can learn how npm works
ok obviously you just cloned someone else's bot and have no idea how to use it
am I correct in this assumption?
How would I compare a created_at attribute to see which one is older in discord.py?
@earnest phoenix I would assume it's a datetime object
I mean if you followed it exactly and your code doesn't run, it must be a faulty tutorial
@glossy sand can u still help me
npm install --save discord.js
god
how would I split up a message say if its more than 2000 character? (please tag me in ur responce)
if (thing.length > 2000) {
// code
}```
thing is the variabled placed by []
like args
@undone plover you could create an array, loop through each 2000-char block of your message text and append the blocks to the array, then send each element of the array in sequence
the only problem is that you might end up breaking the message text somewhere awkward like mid-word
but breaking words is nontrivial so I'm not gonna go into that
that seems like way more complicated then it has to be
split on spaces
suppose it's a >2000 char message with no spaces in the first 2001-character block

then: (pseudocode) length = 0 s = "" strings = [] for(word in words) { if(length + word.length + 1 > 2000) { strings.push(s); s = "" length = 0 } length += word.length s += word + " " } if(s.length > 0) strings.push(s)
that doesn't work if you happen to have a 2001 char word
bot.user.setPresence({ game: { name: "test ~~ " + Version, type: 3 }, })
why does this still show playing
rip
@vital lark well it wouldnt return a error
@rich kiln .createMessage() is Eris, .send() is discord.js
channelid isnt defined :^)
@elfin depot is channelid defined?
@vital lark i used to use djs.
ok
sendMessge wouldnt return a error.
for discord js its bot.channel.send
new error
its .then
k
@elfin depot Defined channelid
it's in the fucking code
bot.channels.get('325648177178869760').send('message'); // 325648177178869760 is mod-log here.
then is getting me a error
show output
bot = new Discord.Client()
client.on('guildMemberAdd', member => { let guild = member.guild; client.channels.get('383355658705305620').send(Please welcome ${member.user.username} to the server!); });
better
if bot was replaced by client then yes
so will that work now
it should
same for me
I'm trying to make a guild list command for my bot. Anyone got any idea of how to do that?
this was YumiBoat's old guildCreate event: ```js
bot.on('guildCreate', guild => {
postServerStats();
try {
bot.guilds.get(${guild.id}).channels.find('name', 'general').createInvite({ maxUses: 5 }).then((inv) => {
bot.channels.get('358052869515116548').send(`
YumiBoat joined a new guild!
\`Guild Name\`: ${guild.name}
\`Guild Members\`: ${guild.memberCount}
\`Guild ID\`: ${guild.id}
\`Guild Owner\`: ${guild.owner.user.tag}
\`Now at\`: ${bot.guilds.size}
\`Invite\`: https://discord.gg/${inv.code}
`);
});
} catch(e) {
bot.channels.get('358052869515116548').send(`
YumiBoat joined a new guild!
\`Guild Name\`: ${guild.name}
\`Guild Members\`: ${guild.memberCount}
\`Guild ID\`: ${guild.id}
\`Guild Owner\`: ${guild.owner.user.tag}
\`Now at\`: ${bot.guilds.size}
\`Invite\`: \`${err.name}:${err.message}\`
`);
}
});





