#development
1 messages · Page 1276 of 1
i did make embed interfaces too and most of them are optional, yeah
its a super pain
thats example i gave is a simple example
but there are times where they return countries for example
as the property
not as value
things that go that route will wreck your interfaces
var today = date + 7884008640
today.toISOString().substring(0, 10);``
TypeError: `today.toISOString is not a function`
Am I doing this wrong?
you need a date
a number+toString() isnt a thing
also stop using vars
use let/const
Ah gotcha
we both evil geniuses
providing snippets in Ts so we can hear complaints afterwards about 'this code dont wqork'
and then reply in 'you werent suppose to copy it, but understand it'
yeah

Do you guys ever reach a point where everything in your bot is theorically working pretty good but you forgot how everything is working inside it so you have this mental confusion and you don't know if your bot is actually great or not?
yes actually.
sometimes
I feel like I all my code is trash
I still somehow know how my bot works despite the code being a total clusterfuck
every time i need to update something i need to study my own code again
^
// and /* */ are your best friends
hot take but
//and/* */are your best friends
you already know I ain't use them to describe my code but just to comment code out right?
comments are unnecessary if you write clean, readable and managable code
comments are unnecessary if you write clean, readable and managable code
which is why comments are necessary xD
comments are unnecessary if you write clean, readable and managable code
yeah, i do comment on public projects tho
It may seem clean at the time, but it'll creep up on you later.
and my codebases are pretty manageable and readable IMO
Even if you were to make your code as clean and readable as possible. Plus if someone else comes across your code comments will help
your code should be readable. if you need comments then the code is not readable
You can have clean code and still have a use out of comments.
^
the fact is my comments are unreadable while code is readable
There are cases where you should use comments, like if you're writing a library and document your public classes, methods, properties, etc.
like javadoc comments?
Even outside that, for maintainability, I'd suggest using them.
Yes
or JSDoc, or Rust doc, or whatever
documenting is good
I use docstrings in my bot because the stuff I return is just way too fucking hard to be understood without proper explanation
(I am lazy to use dictionaries so I just return everything in tuples)
are you following the principles of functional programming?
every function is always simple with functional programming
I don't go by any principles and do everything however I want tbh
So please enlighten me with knowledge
chaos coding
Hey, it works just fine and I write the documentation for the most part 😂
tuple programming
one rule is a function never uses global variables, only uses variable from input or locally.
the input variables are never modified. in fact no variables are ever modified
"modified" codewise?
mutated
Well yeah that's why I'm using tuples
eh no that's the part I doubt if applies to my code
It depends on what you're doing really. Is the global variable the only variable you'll be using (aka it's not passed as a parameter, so it’s unique rather than changed)? Then go ahead and use it if it doesn't make your code messy.
I don't specifically have any global variables. I only access the bot object through multiple files and rely on getting the tuple elements with it
that's about as global as my code is
do you have a functional that you can call twice with the same input and get a different result?
console.log(`New User "${member.user.username}" has joined "${member.guild.name}"` );
member.guild.channels.find(c => c.name === "welcome").send(`"${member.user.username}" has joined this server`);
});```
How can I make it find only in 1 specific guild, in a specific channel ID? and send a specific message?
Me or Ben is no?
then you probably are not breaking the rules too bad
Talking to Ben
Ahh alright
for a specific guild, check member.id against a string
you can memotize the functions to speed them up a bunch
@feral aspen the 1 specific guild I assume is supposed to be the guild the member joined, correct? If so, you can find the channel ID with member.channels.cache.get(...)
I think your mistake was calling .find() on .channels when it's a manager and not a collection
My bot is in like 100 servers, but I want to make the guildMemberAdd only to 1 server
so I would find the id of the welcome channel I need
const Discord = require("discord.js");
const ms = require("ms");
module.exports.config = {
name: "mute",
aliases: []
}
module.exports.run = async (client, message, args) => {
let perms = message.member.hasPermission("KICK_MEMBERS")
if(!perms) return message.channel.send(":x: **You don\'t have permission to run this command!** :x:")
let logchannel = message.guild.channels.cache.find(ch => ch.name === "log-channel")
if(!logchannel) return message.channel.send("Cannot find a log-channel.\n\n:warning:`you cannot currently change to a custom channel`")
let role = message.guild.roles.cache.find(ch => ch.name === "Muted")
if(!role) return message.channel.send("Cannot find Mute role.")
let user = message.mentions.members.first()
if(!user) return message.channel.send("Please specify a user to mute.")
let time = args[1]
if(!time) return message.channel.send("Please specify a time.")
let reason = args.slice(2).join(" ")
if(!reason) reason = "Unspecified"
let embed = new Discord.MessageEmbed()
.setTitle("User Muted | " + `${user.user.tag}`)
.addField("Muted by" , `${message.author}`)
.addField("Time Muted" , `${time}`)
.addField("Reason" , `${reason}`)
.setFooter("Modicus | log-channel")
.setColor(0x75ff58)
user.roles.add(role)
logchannel.send(embed)
message.channel.send(`${user} was successfully muted by ${message.author} for ${time}
with the reason of \`${reason}\``)
setTimeout(function() {
user.roles.remove(role)
message.channel.send(`${user} is now unmuted!`)
}, ms(time))
}
@compact oriole this a good tempMute.js command by me.
Bruh
doesn't guildMemberAdd require a oauth token?
no
No
No?
It just requires the bot to be in a server with the joining user
Maybe check if member.guild.id is equal to whatever guild ID
Why the living hell did I say member.id, oops
lmao
oh, the event listener doesn't require oauth. the method to add a user to a guild does
member.guild.channels.get('channelID').send(`"${member.user.username}" has joined this server`);
Would this work? for only 1 specific channel in a server
yes ^^
In js how can I .catch() something and not do anything?
Putting only .catch() doesn't work, but if I put catch(err => console.log(err)) it works
(I don't want to use try {} catch {}
Hamoodi are you using Discord.js v12
ty
You should handle the error though, or give the user some feedback
If you know you don't care about it, then go ahead and ignore it.
No I don't need to in this case
Nah I don't want my console to be filled with these errors
are they real errors? could you avoid the errors by adding more checks?
Hi, what do u think is better for developing a site, php or node.js ?
Use the one you like (they both have their ups and downs). I'd prefer Node.js
Which one is cheaper to host, faster and secured ? This is what I want to know
there is no difference in hosting
pins i misunderstood, but yeah ^
unless you go for something like wordpress which basically does it for you
node.js vs php is debatable, but most benchmarks indicate node.js is faster, because it uses an event loop, while php spawns worker threads for each connection
Python or node.js :^)
i heard that you should use any other than php, since it's outdated and unsafe sometimes.
not so much anymore, php became decent in 7+ but too late to the party
php is way too slow in modern web dev
if(unsafe) {
makeSafe();
}
I saw that there are no web hosting services that support node.js, so you I need to buy a VPS that is more expensive
a vps is like 3 bucks a month
you can get good enough VPS for 2-3 bucks a month
vps is not more expensive than webhosting
^
web hosting = 1 - 2 bucks a month, vps 2-3 bucks a month.
if anything, webhosting is more expensive than a vps
^
most providers offer a cheaper webhosting pack than a vps tho
What vps would u recommand for a site ?
hey @umbral zealot, im doing message.guild.ban(bannedUser); but for some reason its returning that its not a function
well
@earnest phoenix galaxygate is pretty decent
it's not a function you can call on a guild @honest perch
What do u hink about contabo ?
its bad
Why ??
@blazing portal could you explain
it's good, if you are willing to get lower disk speed
@earnest phoenix hidden fees, cheap, you get what you pay for, slow write speeds and read speeds
a ok.
what hidden fees? I've used contabo for over 3 years now, never paid any fee
slow write and read speeds are pretty irrelevant though unless you have millions of page views
If you're looking at static website hosting or simple web applications, PHP is a very mature language and has many frameworks and libraries to support it, not to mention along with flexible hosting providers and many options.
Other the other hand, if you need a large scale (web/otherwise) application or real-time applications, using NodeJS or more recent technologies with better support for realtime programs will be recommended.
@honest perch can you see a method ban here? https://discord.js.org/#/docs/main/stable/class/Guild
no but i was told it exists
documentation > i was told it exists
it has to do with members no? maybe check the property members of the guild 😛
GuildMemberManager#ban and GuildMemberManager#unban
I like the new system more
it also forces you to make better choices
client.guilds.cache.sort((x, y) => y.memberCount - x.memberCount).first().name
this is my script. How can i get the first 10 servers?
you can't ban a non member?
you can
You can
By id
oh?
The ban happens by an ID
nevermind then
wow, now that is just rude 😛
client.guilds.cache.sort((x, y) => y.memberCount - x.memberCount).first().name
this is my script. How can i get the first 10 servers?
you will still use the same ban method though, and just provide the id then
message.guild.members.ban(userid);?
yeah
@earnest phoenix use first(10), that will return the first ten biggest guilds
it's an array
you can map it to like first(10).map(x => x.name)
ah yes that worked
@earnest phoenix use
first(10), that will return the first ten biggest guilds
@pale vessel thanks
hey how could i make a !command #channel command?
so i have a !tweet command
but i want to assign a !tweet #channel function to it
so the command will only send tweets to that exact channel?
Guys is .setDescription = .setTitle?
Im new lol
@slender thistle sorry for the ping I need the answer quick
How do I end up being the chosen one
lmao bc u best
and no, a title is different from description
sec
what does this mean, why to do this?
import { xyz } from '.';
console.log(xyz);
export const xyz = 10;
sec
@slender thistle what?
what does this mean, why to do this?
import xyz from '.'; console.log(xyz); const xyz = 10;
@rocky hearth search it
what
is there a way to turn js "2,000,000" to ```js
"2000000"
one option is to use .replace
it only replaces once though
replace with regex
.replace(/,/g, "")?
^
what does /g do?
global
I guess I'm more used to Python's way of implementing .replace
replace(self, old, new, count=-1, /)
Return a copy with all occurrences of substring old replaced by new.
count
Maximum number of occurrences to replace.
-1 (the default value) means replace all occurrences.
If the optional argument count is given, only the first count occurrences are
replaced.
someone told me making a (non-hard coded) text adventure bot would be hard, i finished the core in 2 days (today and yesterday) xD
@karmic compass String.split("").forEach(x => if (x == ",") this.splice(this.indexOf(x), 1)).join("");
haven't tested this yet so i wouldn't consider this spoonfeeding
much as I try to recommend not using regex, why not do it in this case
regex is simpler
@karmic compass well you've been kinda struggling with it for the past half minute
Replying to @honest perch from https://canary.discordapp.com/channels/264445053596991498/272764566411149314/759823570330845264
i have a vps from contabo and read/write speeds are fine /shrug https://i.lukgth.xyz/0ojea.png
I need to not merge the remote changes which were previously on github, I should select rebase if I don't want the remote changes to apply right?
@fast relic but you have 32gb ram lol
higher end machines get faster disks
contabo's cheaper machines, ie the one with 4gb ram, have disk speeds of ~100mb/s
well the one with 4gb ram is not ssd
whats the install for the diskio test
i took it out of a bench script
someone else posted their speeds as well some time ago, they were much worse than that
good for you then lul
i took it out of a bench script
@fast relic hmm?
i took it from https://bench.sh/
Guys how the fuck should i choose a color for my embed
random
I match my bot's pfp color
random/authors highest role color/bots highest role color
Or match the author's avatar dominant color
someone else posted their speeds as well some time ago, they were much worse than that
@quartz kindle shouldn't ram be must faster than that?
disk, not ram
ram speed also seems fine with them https://i.lukgth.xyz/3tpnt.png
Has anyone used Commando here??
just ask
Can I have more than one commands in one file? leave....
explain
#general-int for other languages
Can I have more than one commands in one file?leave....
@rocky hearth why use commando then?
Veify.js command
yea
The hell is {max 1} supposed to be
@umbral zealot lmao but Im not sure what should I put instead
?
Learn JavaScript so you know how to actually write objects, maybe.
Its super important pls help me out
Endph, have you tried to google before asking?

Learn JavaScript so you know how to actually write objects, maybe.
@umbral zealot pls bro
learn js
forgot a colon there
No, just learn JS.
forgot a colon there
@slender thistle where
The hell is {max 1} supposed to be
shiv its not his first time
<property>: <value>
max being key
1 being value
The way JS objects are displayed are {key: value}
do I look like I care
no
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
(node:20059) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1311)
(node:20059) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined
at Client.module.exports (/app/events/giriş.js:47:43)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
(node:20059) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1312)
HELP
code???
How do you use .send?
You're doing send on something that's undefined.
c.o.d.e
Yes. Error. Undefined.
SEND YOUR CODE AND STOP USING CAPS LOCK
how do i fix this error
no code, no help.
Is there someone to help?
SEND YOUR CODE AND STOP USING CAPS LOCK
@earnest phoenix give code
yes
are you reading?
send code
E-
Maybe they thought we weren't taking to them.
https://hasteb.in pls?
@rocky hearth why use commando then?
@restive furnace what do u mean?

he put his error
in the
a) you are doing .send on something undefined
b) you are missing permissions
c) we cant help without code
Unfortunately Commando is only registering the Commands which are exported default
Where should I fix in this code
yeah
why would you do many commands in one file?
its the idea of the commando
that your seperate your commands into different files
member.guild.channels.get(memberChannel) seems to be undefined
Because some of them are really 5 lines, I dont want to keep scrolling in explorer
What's your discord.js version?
well, one of my command is 1 line, but still its kept in different file (the command itself, not the logic - the logic is huge, like 50 lines only for that)
i use v10
what
oh man
v11
who here knows how to use d.js v11
upgrade better
man
please update to d.js v 12 k thx - v11 is deprecated.
v11 will die in october shivvv
y'all wanna bother telling them to update?
yea
Well mind helping them out actually migrate then?
If someone will help me tag it
@earnest phoenix v11 is Deprecated and will lack in features, you can upgrade to v12 by following this online guide https://discordjs.guide/additional-info/changes-in-v12.html
And why npm installs djs11, though djs12 is stable version
@twilit rapids
How should I do? @twilit rapids
what version of node are you using?
If it's urgent, you better be quick about reading that page!
And why npm installs djs11, though djs12 is stable version
@rocky hearthnpm i discord.js@v11exists
Click the link I send and read the page
djs 12 doesn't support old versions of nodejs
??
i don't know how to v12 my bot please help
@earnest phoenix v11 is Deprecated and will lack in features, you can upgrade to v12 by following this online guide https://discordjs.guide/additional-info/changes-in-v12.html
we were talking about that djs doesnt support older nodejs versions, so i were excepting that you thought i was talking about the ✨ node.js version ✨.
djs already has a guide on v12 changes
@thick gull My brother, it doesn't work by just sending the link, what is my inside
pls
Interesting how people think their urgency needs to be our urgency.
learn to read pages hmm
inside link is guide on upgrade
It tells you what to change in your code
i read but i didn't understand shit
@thick gull
For example
RichEmbed => MessageEmbed
It's simple
Will you talk to me in Turkish?
basically two major changes:
RichEmbed => MessageEmbed (i do use raw embeds tbh),
CacheManagers.
Main changes:
1- Class names
2- Managers
3- Parameters from normal to objects
eg.: js channel.messages.fetch({limit: 50}); // instead of channel.messages.fetch(50);
hey guys
how do i make a !stop command?
i do have this:
else if(message.content.startsWith(prefix + "stop")){
message.channel.send('The twitter feed has been stopped!')
return;
}
if (message.content.startsWith(prefix + "feed")) {
if (message.channel.id == "735243676460253225") {
const args =
" " + message.content.slice(prefix.length).replace(/^feed/, "").trim();
queueMessageText =
"**The twitter feed has been searched and sent by this/these keyword(s): **";
queueMessageText +=
" " + message.content.slice(prefix.length).replace(/^feed/, "").trim();
setInterval(function Myfunction(){
console.log(Myfunction)
T.get("search/tweets", { q: args, count: 1 }, function (
err,
data,
response```
however, it kinda keeps going with the feed without stopping lmao?
Save the interval somewhere, and clear it via clearInterval in the stop command.
you are setting an interval
an interval without something to cancel it does not stop
ooowh okay
// set the interval and save it to "interval"
let interval = setInterval(()=>{console.log("fired")},1000);
// set a timeout for 10 seconds
setTimeout(()=>{
clearInterval(interval) // Cancel interval
},10000)
example
uhhm that didn't work for me
else if(message.content.startsWith(prefix + "stop")){
let interval = setInterval
message.channel.send('The twitter feed has been stopped!')
clearInterval(interval)```
Hey! Need help with basic stuff. When a member types certain message I want my bot to respond with another specific one but delayed by a certain time
And I don't know how to add that delay
setTimeout
Lang?
for js ofc
For py
It's for js
~~```py
import asyncio
asyncio.await_for()```or 🔥 something 🔥~~
@restive furnace you can also
from time import sleep
sleep(uwuowo)
DON'T DO THAT IN DISCORD BOTS
yeah, since its not asynchronous
for async use asyncio.sleep
for sync use time.sleep
No

@earnest phoenix https://aeon.js.org
Dm me
and its not mine
so im not adversiting ok
MongoParseError: URI does not have hostname, domain name and tld
help
const MongoClient = require('mongodb').MongoClient;
const uri = `mongodb+srv://P025:${dbPass}
@cluster0.dszlo.mongodb.net/plswork?retryWrites=true&w=majority`;
const client = new MongoClient(uri, { useNewUrlParser: true, useUnifiedTopology: true });
client.connect(err => {
const collection = client.db("test").collection("devices");
// perform actions on the collection object
client.close();
});
isn't that dumb to put it here?
And another dumb question
How do I make my bot @ the message author?
Don't ban me for spoon feed :(
search on internet.
You can just stringify message.author
Be more helpful than just "search it yourself"
user#mention on both, eris n djs
but he clearly could search for easy ways on the internet within seconds
@eternal osprey that's what I was trying to do, but I don't really found anything useful that's why I came here
owh okay sorry in that case.
Npnp
you could use message.author
Ty guys
i want premium user system in my bot (discord.js) can someone help me?
json db?
mongodb has great free options
@stark abyss no, go use ✨ PostgreSQL ✨ or 🔥 MongoDB 🔥, or ⬆️ MariaDB ⬆️
i tried using mongoDB but i just can't seem to understand on how to use it

i want a cloud db
don't wanna download no app
✨ PostgreSQL ✨ => Scalable and for high write/read rate
🔥 MongoDB 🔥 => Better JSON
⬆️ MariaDB ⬆️ => MySQL v2
🌟 Cassandra 🌟 => Is what Discord uses
Erwin I am listening I think you misunderstood me
all of them will require you to downlaod something
or I didn't do a good job of conveying whta I wanted to say
i dont have experience on that so i cannot comment
Does anyone else know?
ive seen plenty of example but never tried it myself, so i cant give anything solid
postgres offers me everything i need
relation tables, acid compliant, low latency queries and a TON of over the top SQL features, like types and the sorts
Okay
though if you use something like elastisearch you could get even faster results
Is postgres fairly easy to use?
easy? not quite

postgres has some really advanced usages
quick.db
Well quick.db would be the most easiest but not the most efficient
once you learn it its highly unliekly you'll need to change database
Mongo’s good for a lot of things
SQL is pretty ✨ easy ✨: SELECT * FROM users WHERE id = ? and yes i use prepared statements.
Okay
unless you doint some over the top webscaling like what im doing for twitch, i could use cassandra or some master/slave setup to increase the queries efficiency

im doing over 10k iterations a second
CQL has some diffencies compared to SQL tho
min*
wow
unless you getting that stupid amount of traffic you shouldnt worry about transfering to a faster database
postgres is my go to
What does the bot do
I see
on webscaling you might wanna go for something with a faster speed due to the sheer amount of queries you're running per second

if you getting on that level, do look for a different db
otherwise, postgres will most likely fit all your needs
just for the love of god, dont fuck with JsonB tables

i absolutely regret dicking with jsonb tables
its handy but hella complicated
yo'ure storing json in a table
its more reliable to stringfiy it and then save it
apart from that, i have no complaints with pg whatsoever
Okay I'll seen on youtube how to use it, if it seems something that I can use it then I will try
https://github.com/sayuribotbr/rapidsql this library probably can help you start with sql

It is very simpler and easier than postgres
like i mentioned, postgres is mostly good for everything, though some other db's have better advantages. if you want something lighter and more simple, there are better optionss. postgres is a good, reliable and efficient mid tier db. The example i gave you is the top tier end, where you get too much traffic and might wanna use something else. theres also the low tier where postgres is 'too advanced' for what you need
say, you only need a database to store prefixes for guilds
then postgres would be the incorrect tool for the job
can it do the job? absolutely
should you? likely not
unless you want to continuing developing the bot where you'1ll need more advanced tools
I plan to store quite a bit of information
I am planing to make a market kinda thing where people can add what they are selling (in game cards)
OKay
postgres would be a reliable option in this case
if you plan to future-proof* your bot, use that
Alright sounds good thanks
i put an asterisc there cuz like i mention, depending on the traffic you get you might wanna use elasticsearch or a quicker db

see @slender thistle ? i can offer good help while drunk 
i just cut more corners while drunk lol
@slender thistle What library are you developing
dblpy
im on the fence about releasing my code as a library type tbh
for caching in twitch-js
it should be an easy conversion but im still bug fixing it
https://discordapp.com/channels/264445053596991498/272764566411149314/757688211131859074
@flint warren are you using on_message or the commands extension for your bot?
Commands Extensions
..
@slender thistle what library did you develoo
I'm not sure if you are fucking around or actually serious
when the bot joins a vc, what would be its speaking state?
how do I get the channel id from a channel mention
@obtuse jolt Check <Message>.mentions. There should be a property to get that
@earnest phoenix dblapi.js
nothing useful https://cdn.yxridev.com/u/nwps7YjM.png
If anyone knows why a fetch "post" won't obtain a user/pass/hash cookie when the body is correct but all the other cookies needed. Writing a bot to log into a site and it works when I copy and paste the cookie but won't send it without replying bad statuses.
Not sure it's cors block either, or origins issue. Headers look right and are exactly identical to the sites header. Might be a cloud-front block or something odd.
@obtuse jolt try logging message.mentions.channels
It doesn't show up in the log for message.mentions, but it's a non-null return type so it should exist.
it literally logged everything about the guild and now i cant see anything useful
no?
Then you probably got a collection of channels
So you can just get the first item from the collection and its .id
How do I know, if the bot is playing music?
Is there any property to check if the dispatcher has ended or not?
whats the api abuse laws on webhooks
thats ridiculous
Most things on discord don't have set ratelimits, they're dynamic
we don't spoon feed code, have you tried to do it?
yes
well what did you try
using the admin tag
show me
what you tried
That's not bot owner
yes
yes because its <Message>.member.hasPermission()
bc i get my account banned alot
not member.hasPermission
if (message.author.id === "Your ID") {
// Do the command
}```
You said bot owner not guild admin
can i do multiple ids
Your bot is not approved
oof
@sinful thistle your bot is no approved
@sudden tulip yes there is a way to do it
can i do multiple ids
@sudden tulip Put the ids into an array
if (["ID", "ID", "ID"].some(id => message.author.id === id)) {
// Code here
} else {
// Do something if it's not the owner
}```
kk thx 🙂
i need a new phone battery
could go a step further: js if (["id", "id", "id"].includes(message.author.id)) {...}
5head
That's not actually a step further, just smaller, but js Array.prototype.some() is more, advanced than includes()
"confusing" 
How can i code a bot where it can latexify a given expression? discordpy
May I ask what latexify-ing is
basically converting a math equation to latex
does anyone have a host for the python bots ? I don't have a Raspberry, and I have a problem with heroku and github. My code perfectly works when I launch it from my PC but on heroku, it is doing some sh*t and not what I programmed
do u mean free?
yeah
where do u run it?
@modest smelt you want the user to write latex code and the bot outputs the printed/formatted equation?
I ran it on heroku with github. But I added code, and now, nothing is working but all my code is correct bc it works when I launch the .py from my computer
@modest smelt
no, I just copy and past the code lmao
Yeah thats what i said
you have to add some requirements
I copy / paste on github
look at some video
Platforms like heroku often require specific configuration for your project to run on it
I added all requirements
Check your error logs, read some heroku guides for using python
yes
heroku haven't any error
In any case if you want to move out, i recommend a paid vps
vps?
yeah
to put it simply, a 'server'/ 'computer' to run your code on
its 24/7
heroku, glitch and the sorts have plenty of limitations due to it being free
I need some help people.
@modest smelt you want the user to write latex code and the bot outputs the printed/formatted equation?
@quartz kindle yes
How do I get this to run correctly
wrap safe?
You will likely need a drawing library, and have latex draw on it
And send it as an image
i'd have a wild guess and say thats either library or node error
Not sure.
or your code
Show code @earnest phoenix
@quartz kindle
well thjere you have it
your linter is telling you
look in the bottom, you cant -/+ consts
remove the -/+
but how will i do that?
Also, you cant redeclare a const, you already declared config
^^
Heroku is installing python version 3.6.1 but I need the 3.7.7. How to ask heroku to install the right version ? in the requirements ?
why you even using config if you hardcoded your token?
@quartz kindle I'ma Dm you

@quartz kindle ?
@modest smelt check some stuff online such as https://stackoverflow.com/questions/1381741/converting-latex-code-to-images-or-other-displayble-format-with-python

ok
everyone relying on tim
lol
can anyone have me how to make a dashboard
same thing im working on

though im trying to move away from php to do it
and using an express like app
its hard when you dont rely on boilerplates

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: RuntimeError: Failed to process string with tex because latex could not be found
error
How can I get the participantId value of a person whose name is aproxthethat from a json file?
{
"participantId": 2,
"player": {
"platformId": "TR1",
"accountId": "gKXPhNTNeYEttj-xV9AWziRs6eDCGyWfxvxDiar4j4FpxIW23KGn9GKc",
--> "summonerName": "aproxthethat",
"summonerId": "ug1XDV8d5Bh4M6CmTiQVfvT7Gi4953SOnDrnKpKByaq9ouo",
"currentPlatformId": "TR1",
"currentAccountId": "gKXPhNTNeYEttj-xV9AWziRs6eDCGyWfxvxDiar4j4FpxIW23KGn9GKc",
"matchHistoryUri": "/v1/stats/player_history/TR1/2033771425100256",
"profileIcon": 4655
}
}
because latex could not be found That’s what he said. lel
@earnest phoenix what language are you using
javascript
because latex could not be foundThat’s what he said. lel
@boreal iron then how can i fix?
You could use Object.values to convert the object key/value into an array of the object's values, then call .find() on it, while passing it a function to see if summonerName is equal to whatever name. I don't know what the actual structure of the object looks like, so I can't provide an example.
let ahaha = data.find(uu => uu.summonerName === `aproxthethat`)
console.log(ahaha["participantId"])
like?
@sudden geyser
How about JSON.parse ?
^
w8 what should i do?
That's json there, you'd JSON.parse()
Then you can call it like player.summonerName
Why am I getting the message, "Unexpected Token 'else' "
because it's unexpected
@unique patio
let me run it one moment,
put } else if
Then for your token, make sure that's set to your bot
You can just const Config = require("./config.json");
Then Config.Token it.
remove the last }
well not last one but
if (first startment){
} else if () {
} else if() {
}
You have an extra }
Can't copy nor want to re-write the code, so spot that, and it should run no syntax error.
Still not working
Paste the code on hastebin
const { prefix, token } = require('./config.json');
const client = new Discord.Client();
client.once('ready', () => {
console.log('Ready!');
});
client.on('message', message => {
if (message.content.startsWith(`${prefix}ping`)) {
message.channel.send('Pong.');
}
else if (message.content.startsWith(`${prefix}beep`)) {
message.channel.send('Boop.');
} else if (message.content.startsWith('${prefix}serverinfo)') {
message.channel.send(`This server's name is: ${message.guild.name}`);
}
});
client.login(token);```
Theres the code
OH
‘${prefix}serverinfo’
Help in Command Handler
const Discord = require('discord.js');
const Config = require('./config.json');
const client = new Discord.Client();
client.once('ready', () => {
console.log('Ready!');
});
client.on('message', message => {
if (message.content.startsWith(Config.PREFIX) {
message.channel.send(`Pong.`);
} else if (message.content.startsWith(`${Config.PREFIX} beep`)) {
message.channel.send(`Boop.`);
} else if (message.content.startsWith(`${Config.PREFIX} serverinfo`)) {
message.channel.send(`This server's name is: ${message.guild.name}`);
}
});
client.login(Config.Token);
Few syntax issues, your startsWith had a non closing )
Also you were using the ${} wrong they are wrapped in ``
Oh
Thanks
Easily caught, try building your nested statements slower
and running console.log, if things underline red check them immediately or know why they are.
Sometimes it can be a lack of closing brackets or a function.
Wdym?
Which if that's the case you need to pass the right token
The code I copied and pasted, was that the file I said?
No
run_main_module.js
is this?
const Discord = require('discord.js');
const Config = require('./config.json');
const client = new Discord.Client();
client.once('ready', () => {
console.log('Ready!');
});
client.on('message', message => {
if (message.content.startsWith(Config.PREFIX) {
message.channel.send(`Pong.`);
} else if (message.content.startsWith(`${Config.PREFIX} beep`)) {
message.channel.send(`Boop.`);
} else if (message.content.startsWith(`${Config.PREFIX} serverinfo`)) {
message.channel.send(`This server's name is: ${message.guild.name}`);
}
});
client.login(Config.Token);
That was index.js
Your error isn't there then
Look closely at your message
Where it starts, and gets caught up at
Thats my config file
Oh match those to the copy/paste I sent
or adjust the Config.Token -> Config.token
and Config.PREFIX -> Config.prefix
Your JSON is formatted just fine!
If it still errors, it's not generating from this part of the project.
One seccond please,
gonna confirm too the library used is not bad-code.
Yup 🙂
discord.js changes so will confirm that too
Yeah the code sent as long as it matches JSON if ran alone, it should work no problem but you have issues at your djs/loader.js
cjs*
Okay.
if (message.content.startsWith(Config.PREFIX) {
message.channel.send(Pong.);
}
Missing )
Wheeps
Following on mobile is quite hard, sry
No worries trying to see where this issue kicked in but seems maybe more issues in the code than one bit?
hastebin it
Pastebin?
you can upload your loader.js file there
Sure
It may just be a syntax error
like found in the discord loader, hopefully not much more than the loader.js is broken
If you read the error closely @earnest phoenix look at its lowest initiator, what ran before it all went stumbling down.
I'll peak the code but for reference read it sort of like this your error messages, bottom up.
Oh
The green usually are ok, but the top red is your issue
So i need to reinstall the library?
This can confuse you though big time if syntax/etc is all janked so go slow and run often.
let me look
In all honesty with the code you got
that runs, your addon is what is not running
async def play(ctx):
global queue
server = ctx.message.guild
voice_channel = server.voice_client
async with ctx.typing():
player = await YTDLSource.from_url(queue[0], loop=client.loop)
voice_channel.play(player, after=lambda e: print('Player error: %s' % e) if e else None)
await ctx.send('**Now playing:** {}'.format(player.title))
del(queue[0])```
I don't know what the error is
You may have it installed wrong or using it incorrectly.
Can't help with java fully
Is Python
Okay.
Thanks though!
See what you can do port, the error is not with that new file you got and your config
Mkay.
Ill try to rewrite the script
Can someone explain what this means? This is quick.db
var economy = new db.table('economy')
economy.set('myBalance', 500) // -> 500
economy.get('myBalance') // -> 500
db.get('myBalance') // -> null```
is table like an object?
stop copying snippets from 2009
I am not copying them, it was an example in the doc
thats what i mean
help = "me"
well it may be bad but right now i am just focusing on 22-24 members in my server
var has some quirkyness to it, which you should understand before using it
there are very specific use cases for var
Well I do understand the basic variable in javascript
var bad
@opal plank yes use const
99% you should be using let/const
I am not sure about let or const
I never use var
const is constant which you don't change
All are fine
^?
No
EC6+ allows for it all
dont get me wrong, there ARE use cases for var
The rule for var is to rely on let usually
Just use it appropriately.
Eslint just tells me what to use soo
Maybe you'd rather suffer and use var to support old JS
fuck that
jeez you guys calm down I am trying to learn all works fine I don't need it to be like perfect as long as it works its okay
Many adapters use it
update your browser
So it's very acceptable, but yeah old-support; let is newer but no issues in compliance
Lint will not call you a bad person
table is a ordered storage for your stuff
is it like object?
Can someone explain what this means? This is quick.db
@stark abyss think of it like a key/value that can persist:
economy.set(...) sets the key as myBalance to 500.
economy.get(...) gets the key "myBalance", which returns 500 as that's what you just set.
I haven't used QuickDB but this is the concept behind it.
x | name | nickname
1 | erwin | Lerwin
2 | p025 | Poh
thats a table
all the 'rows' take the same shape
ah I see
usually you'd want an indexer on it
in this case, it'd be 1, 2....
its an unique identifier
so let's say if I don't want to include a nickname for someone I would have to since it's a table?
your tables can take any shape you want
To sum it in your mind, it can be seen like an object but it's fixed.
object but it's fixed okay
therefore you allow its shape
if you want a value to be permitted to be empty, so be it
otherwise, set it as NOT null
Scam
I think i get it now thanks guys
Whats twitch
and in a channel the bot has access to such as #commands
i assume you type n.link cuz of my stream
Yes
Twitch?
bruh
you dont know what Twitch is?
Nope
sus
Isnt it that website where that women threw her cat
prob the biggest streaming website
Bigger then the ornhub 😄
Do not use .json for a database
Using .json file for a database is not a smart idea. If you do use it as a database, trust me, you'll regret it.
First off, .json is a data format, and should not be used as a database. .json is usually used for configuration like your bot token or prefix.
Second off, .json is a way to represent data as a sequence of bytes, usually for transmitting as a message or storing in longer-term storage. A database is a way to organize data to make retrieval efficient. You can, at least in principle, store data in .json format then later read it in and extract out useful information. That would be using it as a kind of rudimentary database, but it wouldn’t be scalable or even practical for more than relatively small amounts of data.
Third off, if the ,json file gets updated frequently, then corruption may happen. The data in the file may be wiped out, and even if you make a backup every once in a while, you may still encounter the file being corrupt at an unexpected time. And you can save a lot of time just by using an actual database.
How do I prevent this from hapening?
I recommend you use an actual database such as MySQL, MongoDB, QuickDB, or other reliable databases.
Other Useful Resources:
https://discordapp.com/channels/264445053596991498/272764566411149314/756493131842584687
https://discordapp.com/channels/264445053596991498/272764566411149314/752260260672176221
Jesus
@opal plank lmao never heard of it
anyhow, check the docs for it
if you truly interested in it, there is documentation on it
as well as a visual tutorial
if you dislike reading
How can i make a programming language in html
If I can add, cause that was large. JSON is deserialized for fast search.
are you trolling misly?
Not ideal for DB but like XML; we'd not go storing info there either
Idk
Good for static data, not necessarily updated often for fast sorting/etc.
i'd me more than happy to guide you for using my bot if you arent trolling, though keep this chat on topic
anyhow, back to api development

I'm trying to sort the status block on my post response.
Can't seem to pass right data through headers/body to get a user/pass/hash r esponse from a server unless I'm in tab.
Thinking cloudfront got me beat or something.
how do u make ur bot online
Me?
no i need help
With a language
You need to select a language most comfortable learning with an discord API to require.
@honest perch discord.js
Mans messing
@honest perch go sleep
Ohhh
Its a hidden api feature
undocumented, dont use it @indigo flax
You can modify it in the node module












