#development
1 messages · Page 764 of 1
It sums up 80% of this discord @earnest phoenix
@earnest phoenix
@earnest phoenix it wasn't supposed to 100%. Your token should be private always
Anyone help me please
help with what
@odd dune what do you need help with
One message removed from a suspended account.
@earnest phoenix when you reset your token, it changes
so you need to update it in the code
^ note: it only changes when you explicitly tell it to or you login 1000 times in a 24h period, those are the only times it resets as far as I know
Eh? Since when
since a while
found out the hard way a couple times as i accidently commit it and the bot instant gets kicked off
I don't remember anything like that being put in place but okay
I'll try in a bit on a bit i don't care about
yeah i also found that the hard way
good safety feature tho
i changed a bot's token and committed to a repo multiple times
i thought the way i would fix it was by resetting the token, committing and logging in really really fast lol
worked some times
const top = client.shard.fetchClientValues("guilds.size").sort((a,b)=>a.memberCount-b.memberCount).array().reverse()
TypeError: client.shard.fetchClientValues(...).sort is not a function
not working
...
@earnest phoenix fetchClientValues is a Promise. do you know what a Promise is?
nvm :)
How to add roles to a User in d.js v12-dev?
I tried member.roles.add() but it gives me an Error
read the docs and find out
rtfm
@uneven wyvern show your code and error
remove [ ]
.add does not take a function as a parameter
message.member.roles.add(message.guild.roles.find(r=>r.name === "Community").id)``` try this
ty
or you can just do Member#addRole 
that's only on stable 
well define webhookclient then
well logically you cant really
cuz if its a default emoji it will be unicode not an ID
sorry for less info /:

well you could just have a on_reaction_add event
that would work aswell i think
reacted too
what is ur lib
d.js @summer torrent
if you get a list of reactions just iterate through them
LastSentMessage = await Data.channel.send(embed=EmbedList[0])```
I am
Really quite stumped
Info:
EmbedList has Min two Embed Objects in it, ive checked and logged it, each time two elements
the Data object is similar to the Message object just with client in it for ease of use
I get
No Error
yet it isnt sending the message
python?
that ain't d.js so yes
xD yus
wanna know the most annoying part
ocassionally
it works
but most of the time it doesnt
@vital lark im on Master =}

got some code for a profile command to use canvas to display info
i need help getting info from a table from MySQL so i can use it in canvas
use a text sharing service like hastebin to share code
removed the password since its a password xD
i originally was close when i had let level = await conection.query(`SELECT level FROM info WHERE ID = '${msg.author.id}'`) but it would display on the canvas [object, object] or something like that
help?
ive been at this for hours xD
are you sure your mysql library supports async tho?
last time when i checked, it didnt seem like it did
you cannot use await connection.query() if query() is not a promise
if you want to use async/await, you need to promisify it yourself
like this js let level = await new Promise((resolve,reject) => { connection.query(... , rows => { resolve(rows[0].level) }) })
or just stick to callbacks like you were doing before: ```js
connection.query(... , rows => {
// do all your code here
let canvas = new Canvas(...)
.addText(rows[0].level)
...
msg.channel.send(...)
})
imagine using a lib that wasnt based on promises
I mean SQL does have a async version
For Py atleast
Alchemy also is async I do believe
most databases have at least 5 or 6 different libraries and drivers for them lol
afaik hes using this one https://www.npmjs.com/package/mysql
last publish 9 months ago
Yh
Python has a asyncsqlite version
Idk if theirs a js version that isn't alchemy
but like, database tech is pretty solid and slow moving, you dont really need "the latest modern actively updated library", you can stick with the old and proven drivers
most newer ones are built on top of the old ones any way
Yh
And unless it's a massive and I mean massive db
The effect of the blocking code is pretty much unnoticeable
db's are non-blocking by design, unless explicitly marked as sync
they use node's i/o callbacks
Yh
hey guys, is it possible to get the game that a user is currently playing through an API?
yes
how? i couldn't find the relevant docs
what api are you using
hmm not sure if i understand. my question was whether such an API exists
I mean...?
js or py
If you mean what game they're playing as shown in discord, discord API does that
does it? i can't find it from the official docs
Discord Developer Portal
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
i'm not seeing any API that tells me what game they are playing
What programming language r u using
Because it's defo available for the d.py and d.js libs
I don't think it's a listed thing on discord's docs
ah.
Idk about JS
hold on lemme get it
Probably the same though, maybe
should be in presences
got it, i see that it's under User as well: https://discord.js.org/#/docs/main/stable/class/User?scrollTo=presence
thanks guys
this is the discord api link https://discordapp.com/developers/docs/topics/gateway#presence-update
Discord Developer Portal
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
thanks 😄
how to fix this:
There was an error processing your song.
[ffmpeg was not found.]
FFmpeg IS installed, but im still getting this
ffmpeg is not an installable program
it is a CLI
portable
it needs to be in the directory you are searching it in
No
Put it where main.py is
@minor kelp
Or whatever you run for the bot to start
ok
Yes
??
Their site is a little broken rn
@unique nimbus Its in the main bot folder, but didnt work
ah ok thats what im seeing too
Is website crashed?
Is there any body that can program or help me program my discord bot?
I tried all day
@pearl canopy If its Python, i can help
I don't know what it is
Lol
What programming language will you use?
I don't know all I know is I been trying to follow. Some type of manual
Link it.
I have created most of the files but i dont think im using the correct app
What app.
Node.js consol note pad ++
send link ps
Im busy
ok
I think i have the right one, it should be downloading, btw i am using windows 10
same
@earnest phoenix is helping me right now
If I wanted to use JSON for a "database" is there a chance of loosing "data" if the bot is in multiple thousand servers?
Ping with response, please.
it depends,
if every server has it's own file then it should be fine
if everything is in one file but there is only 1 write or read action at a time then it should be fine
the main problem is that JSON isn't made to be used as a database and it might be slow when it gets bigger
I use a json based database on get requests and post requests only, and all that
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Ah, okay. Thanks. 😄
One message removed from a suspended account.
If you manage to not do many I/O operations all at once, JSON isn't that bad but it's still recommended to use an actual database for bigger bots
@everyone
I know that
@earnest phoenix
Is it a problem for reviewing, if I Have a code that the bot reacts to messages saying hi and hello?
Yes
plus the obvious like logging etc
(node:1661) UnhandledPromiseRejectionWarning: Error: A token must be provided.
at Promise (/home/pi/avibot/node_modules/discord.js/src/util/Util.js:57:25)
at new Promise (<anonymous>)
at Function.fetchRecommendedShards (/home/pi/avibot/node_modules/discord.js/src/util/Util.js:56:12)
at ShardingManager.spawn (/home/pi/avibot/node_modules/discord.js/src/sharding/ShardingManager.js:113:19)
at Object.<anonymous> (/home/pi/avibot/index.js:5:9)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
(node:1661) UnhandledPromiseRejectionWarning: Unhandled promise rejection. Thiserror originated either by throwing inside of an async function without a catchblock, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:1661) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
How tf does changing my API key do THIS
@earnest phoenix any ideas?
Like it thinks the token isn't provided
But it is
It's right fucking there
Unable to think clearly rn
@stable horizon that isn't why?
If you just want to get the JavaScript contents you would have to parse and remove everything else
@west raptor actually im trying to save my toggle button checked data on db.
Im stuck from 4 days
All times its undefined db
you can pass data into an ejs file
render(ejsfile,data)
the other way around is more complicated because ejs is supposed to be like html, to render and send
but you need to explain better what you're trying to do
because ejs is rendered server side
so you mean save something to a database during rendering while still on server side?
or do the database thing on the client side after the user receives it and uses it?
Im trying to save a toggle switch button data on firebase
when a user clicks on it?
Yes
thats client side code
has nothing to do with ejs
you probably want to use ajax for that
But that button inside .ejs
it doesnt matter
ejs is a rendering file
the file will get converted into html/js/css
and sent to the user
the user doesnt receive ejs, he receives html/css/js
And how lt possible with ajax
when a user clicks the button, the button executes js code and sends data to the server
this is browser javascript, not server javascript
like a .js file that you put in your <script> tags
so you need to do something like <button onclick="js function">, or have a <script>document.querySelection("button").addEventListener("click", function())</script>
Wait ill show you my code
and then the function must be in ajax (asynchronous javascript execution) if you dont want the page to reload
and ajax has a million of security vulerabilities by the way so its not easy to protect
also make sure you dont send any authentication or api key to the client
manage.ejs
<script>
var input = document.getElementById('toggleswitch');
var outputtext = document.getElementById('status');
var db = <%db%>
input.addEventListener('change',async function(db, guild, guildID) {
if(this.checked) {
outputtext.innerHTML = true;
db.ref(`servers/<%=guildID%>`).update({
autojoin: true
}).catch(function(err) {
console.log(err + "\n\n\n");
});
} else {
outputtext.innerHTML = false;
db.ref(`servers/<%=guildID%>`).update({
autojoin: false
}).catch(function(err) {
console.log(err + "\n\n\n");
});
}
});
</script>
deshboard.js
app.get("/manage/:guildID", checkAuth, async (req, res) => {
const guild = bot.guilds.get(req.params.guildID);
if (!guild) return res.status(404);
const isManaged = guild && !!guild.member(req.user.id) ? guild.member(req.user.id).permissions.has("MANAGE_GUILD") : false;
if (!isManaged && !req.session.isAdmin) res.redirect("/");
const autojoin = (await db.ref(`servers/${guild.id}`).child('autojoin').once('value')).val();
renderTemplate(res, req, "manage.ejs", {
guild: guild,
guildID: guild.id,
db: db,
autojoin: autojoin
});
});
error is db.ref is not a function
that will never work
then ?
look
imagine a discord bot
what you are doing is like doing message.send(db)
on discord
you're trying to send the database connection to the client
Ah
because ejs is like message.send()
How should i do this
as i told you, you need to write client side code
@nimble steppe wait plz
ok
what you are writing inside the <script> tags will be sent to the user and executed on the users computer
the user's computer is not your server, it has no variables no databases, nothing
@earnest phoenix ?
Ah right
@nimble steppe what is your problem
Invites maganer
is my server offline
!invites
no
?invites
no
$invites
no
So i need to pass that data to my server right ?
????
i invited the bot to my server
go to support server of inv manager
@quartz kindle
@nimble steppe https://discord.gg/S977tw2
i can t join
@earnest phoenix you need to code a script to be executed on the user side that does everything: listen to the button click, create an http request back to your server, send data to your server
and then in your server you need to have an endpoint to accept it
@summer torrent i'm banned on this server
it s from discord a friend invited me on a server and i had the same problem
Im confused i really dont know how to send data from client side to my server side
@solemn viper you created a bot and invited it to your server? thats all you did?
do you understand?
@nimble steppe plz wait some sec.
@nimble steppe help with what? we are not "invitemanager" this server is not the invitemanager server
He says invitemanager is offline
@quartz kindle bro is this right way?
<form action="/" method="POST">
<input type="hidden" name="autojoinbtn" id="toggleswitch" value="">
</form>
that is one way to do it
a <form> tag will automatically send the the contents to the url in the action when the submit button is clicked
but that is not ajax, that will reload the page
like clicking a link
Oh
there are a million different ways to do it
you can use a <form> and overwrite the action with preventDefault()
or you dont need a form at all, you can add a click listener on any kind of tag
or any other kind of listener
basically what you want is:```js
<someElement>.addEventListener("click/change/whatever", function() {
create a new http request here
you can use the Fetch API or use XMLHTTPRequest
})
Ok and where i listen that request ?
send a request to, lets say, "yourwebsite.com/ajax/autojoin"
and in your server code you add .post("/ajax/autojoin", (res,req) => {})
Ok i understand but i will be new page
yes, its a new page, but you dont need to send anything
the ajax will connect to it without reloading the page
and your new page will receive, do something, and optionally respond
and the ajax will do something with response or not
all in the background of the page
Is ajax easy for bigginer
👍 good luck
Ajax is good but can be a pain for some other systems
Is the site fixed
Can someone pls tell at which position my bot is in the waiting list for checking for the add bot
bots can be processed out of order, and as for how long read #502193464054644737
i dont think that will happen, applications are probably time-stamped and they will see if there is an application that's been waiting for a long time
And they're mostly done in order of being added
@earnest phoenix it's against tos. That's why we don't do it. There's no philosophy or other shit. It's simply because it's against tos.
...
Mate I don't know what other shit you want
Hey @quartz kindle i got the time now to try the code you sent but i get this error
Anyone got any advice on fixing the following error
Error: socket hang up
at connResetException (internal/errors.js:570:14)
at TLSSocket.socketOnEnd (_http_client.js:440:23)
at TLSSocket.emit (events.js:215:7)
at endReadableNT (_stream_readable.js:1184:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
That is most likely Discord being a dick
It is trying to connect to something but timed out
@earnest phoenix whats User-profile.js line 43? if its rows[0] that means an entry was not found in the database, unless you did something wrong
i managed to fix it now 😁 thanks for all your help Tim
JavaScript
How do I delete a whole JSON file? I know how to create a new JSON file with code, but I don't know how to delete one with code. I've Googled and found nothing helpful.
Please ping with response since I have this server muted.
I'm using this to create a file. I can't do it manually. It needs to be automated.
fs.writeFile(`guilds/${guild.id}/settings.json`, defaultSettings);
I just need to know how to delete the file.
File.Delete() : File « MS JScript « JavaScript Tutorial
im guessing maybe that link might help
that isnt node
^
i literally sent a link
to the docs
where it describes the function
and even gives an example
Ah, thanks. I didn't see that.
@modern sable ads
kk
Ok so im just looking to vent for a few mins. Please check out my scything sarcasm below.
I present to you... the generic bot list (not top.gg).
It's written in node.js and is a fork of someone else's bot list. It runs on glitch, but eventually I'll get a $3 VPS and run it there as root.
For a database I'll use a JSON database.
I'll make sure to cover it in ads.
My server will be full of drama where I bicker alongside other list devs.
At the bottom of all sites will be a protected by DMCA notice even though I'm not even American.
/S. 👍 😁 comments welcome.
And yeah I'm not picking on anyone in Particular, just making fun of the culture that seems to spring up around discord bot lists in general.
Am I creating a .json file correctly? Because it doesn't seem to be working.
fs.writeFile(`guilds/${guild.id}/settings.json`, defaultSettings);
doesnt json have its own system rather than writing to it like a txt file
wait a minute is that json being used as a database??
I don't know, I'm using Glitch. Every time my bot joins a server, I want to create a new file. And when it leaves/is removed a server, I want it to delete that file. I haven't used json this way before, so I'm confused.
Directed to @modest maple
oh god
@wooden lance Well, yes.
Why don't you just use a database?
dont use json
Lol, glitch makes good devs do bad things
Yes dont
user a DB
dont even bother starting with a json it will kill you in the future
Well...
A friend and I are programming the bot on Glitch and then exporting the code to GitHub.
But json should be able to work.
use a db don't use json
Wait wut someone's using glitch for its intended purpose of collaborative prototyping?!?!
We may need to transfer to a better database in the future...
What the hell the world's gone all right
If you don't understand or dont want to learn how to interact with a db just use something like enmap
json file collation is not a database and can't be compared to one because it's simply too poor in performance
and breaks when ever you write to it
I've tried so many databases, and even tried enmap, in the past, but it has always failed me. JSON is the only thing that has worked.
works for me
I have two file types in my bot that are JSON: it's config file, and help files. The help files are just raw embeds
buy a server and host a database server on there, that way both you and your friend can use it at the same time while having synced results
JSON is fine until you want multi user access, or indexing, or Fk relationship, or atomic access....
I can't upload Pictures lmao
Or replication, or security, or redundancy, or...
Oh gosh.
Index.js
//requirements
const fetch = require("node-fetch")
//actual code
if(options.name === name) {
var url = `https://www.instagram.com/${name}/?__a=1`
var res = await fetch(url).then(url => url.json())
let user = res.graphql.user
console.log(user.username + " found")
}
}
module.exports = search```
server.js
const {search} = require("./index.js")
search({"name": "thegstwins"})
Err
@uneven wyvern you dont need {search}
We don't have a server to host it on at the moment. We may have one, but if not, my friend will keep it online via his computer.
just do search
He will back up the JSON files with his drive also.
btw Ace, no database has "failed" you, rather you probably failed to use them properly :P
I always get a bunch of errors no matter what tutorial I follow.
@uneven wyvern what did you change? did you save?
yes
because tutorials are trash
even twice
to properly use a database you need to learn how to read documentations
and follow that instead
is it because I have === name?
I've tried, but...
ok solved. But now I get undefined found
@uneven wyvern there are many things wrong with your code, but is its still saying search not found?
ok
now you need to fix the parameters
what parameters?
because function({some:thing}) is the same as function(something) its still only one parameter
if you want to use two parameters, then properly use two
search(name,something)
so I can basically delete the parameter name?
basically dont make it an object
if you use {something:something2} thats not two paramenters, thats one object with a key and a value
oh fuck now I get invaild-json
One message removed from a suspended account.
One message removed from a suspended account.
roll a random number
One message removed from a suspended account.
if smaller than (or bigger than) whatever number is 5% of the max/min number
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
//requirements
const fetch = require("node-fetch")
//actual code
if(options.name) {
var url = `https://www.instagram.com/${name}/?__a=1`
var res = await fetch(url).then(url => url.json())
let user = res.graphql.user
console.log(user.username + " found")
}
}
module.exports = search```
Now it says `cannot read property name of undefiend`
in js it would be 0.05
One message removed from a suspended account.
One message removed from a suspended account.
@uneven wyvern because you are not passing any options
@uneven wyvern options.name probably doesnt exist
why are you using both name and options.name?
One message removed from a suspended account.
should be the same
One message removed from a suspended account.
for .../${name}/?__a=1
but why do you need two names? are they two different names?
.name is actually the username
but you dont need it, do you?
you only need one name
the name you are searching for
so just change your function to async function search(name) {
and change your if to if(name) {
then call the function like result = await search("username")
now I got it ty
I know people don't recommend it, but how do I create a file? I'm trying:
bot.fs.writeFile(`guilds/${guild.id}/settings.json`, defaultSettings);
But it doesn't work. I've Googled and can't find anything.
use a relative path and make sure the directories exist
...huh? Sorry, I'm confused.
what do you mean "doesnt work"? any error? does the file not get created?
also, writeFile needs a callback
@quartz kindle The file isn't created AFAIK.
Error when trying to access the file:
Cannot find module './guilds/664176673997979649/settings.json'
*that's the server ID
have you actually went into the folder and checked?
dont rely on your code for that
I reloaded the page. That is a different ID.
That's a different file.
I don't think the file was ever created.
bot.on("guildCreate", guild => {
let checkSettings = require(`./guilds/${guild.id}/settings.json`);
if (!checkSettings || !checkApps) {
let defaultSettings = {
"prefixes": ["/"],
"inServer": true
};
bot.fs.writeFile(`guilds/${guild.id}/settings.json`, defaultSettings);
} else {
checkSettings.inServer = true;
}
});
```This is the whole code.
again, writeFile needs a callback
its an async function
unless you use writeFileSync
fs.writeFile('message.txt', data, (err) => {
if (err) throw err;
console.log('The file has been saved!');
});```
also, as far as i know, trying to require a non-existent file will throw an error
so doing if(!requiredfile) wont really work
you need to try/catch it
let file;
try {
file = require(..)
} catch(e) {
file = {
// default settings
}
}```
🤷♂️ Still nothing.
then you're still doing something wrong
bot.on("guildCreate", async guild => {
let checkSettings, defaultSettings;
try {
checkSettings = require(`./guilds/${guild.id}/settings.json`);
} catch(e) {
defaultSettings = {
"prefixes": ["/"],
"configAt": "channel",
"inServer": true
};
fs.writeFile(`guilds/${guild.id}/settings.json`, defaultSettings, (err) => {
if (err) throw err;
console.log('The file has been saved!');
});
}
checkSettings.inServer = true;
});
bot.on("guildCreate", async guild => {
let checkSettings,checkApps, defaultSettings;
try {
checkSettings = require(`./guilds/${guild.id}/settings.json`);
checkApps = require(`./guilds/${guild.id}/applications.json`);
} catch(err) {
defaultSettings = {
"prefixes": ["/"],
"configAt": "channel",
"inServer": true
};
fs.writeFile(`guilds/${guild.id}/settings.json`, JSON.stringify(defaultSettings), err => {
if (err) console.log(err);
console.log("File saved.")
});
fs.writeFile(`guilds/${guild.id}/applications.json`, JSON.stringify({}), err => {
if (err) console.log(err);
console.log("File saved.")
});
}
checkSettings.inServer = true;
});
😩
I don't know why it won't work.
Gosh.
is that the full stacktrace trace in red? You don't return if there was an error in the callback, so it'll log "File Saved." regardless. Are you possibly requiring ./guilds/.../settings.json somewhere else in your code
@sudden geyser I didn't have return but yes, I require it in the message event lower down.
🤷♂️
One message removed from a suspended account.
@sage bobcat Yes.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
so
wdym (dvsaezi)?
no text file databases
on glitch
well I have an api and such
wich makes an image each time you submit an url to a certain path
@sage bobcat I'm pretty sure glitch does.
I think you're talking about it not appearing on the sidebar but it's still there
One message removed from a suspended account.
One message removed from a suspended account.
You need to check if it's 5 or lower as 0.05 will never be true
One message removed from a suspended account.
One message removed from a suspended account.
you're checking if it's exactly 5. That's not a 5% chance; that's a 1% chance
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
very good js
if I Insert a client.on message event in and client.on channel create how can i exit it from both the events?
d.js
there is a removeListener function iirc
What does this mean?
FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.
I searched the error and got this: https://stackoverflow.com/questions/47114090/what-does-an-empty-maybelocal-mean/47144507#47144507
As for where it came from, maybe provide the stacktrace
how do i send a embed with a image?
Its a v8 error, are you coding a native C addon? If not, inform the developer of the library youre using
@faint grove use an attachment
What library?
idk
What language?
js
discord.js or eris?
discord.js
Thats the library
Use it’s richembed builder
Yes, now look at discord.js's documentation
i try .setImage(message.author.avatarURL) but that doesnt work
i have 5 errors in doing so
As i said, check the documentation
thats what the docs said to do :/
It explains how to use setAttachment
Also check this
https://discordjs.guide/popular-topics/embeds.html#using-the-richembedmessageembed-constructor
@faint grove send the error
isnt it displayAvatarURL?
Can anyone here help me think about the design for linking discord accounts to usernames on a website?
Trying to make a token command that sends a token to the mentioned user via Direct Message, But i keep getting TypeError: 'Member' is not iterable
Code:
@commands.command(name='vtk')
async def vtk(self, ctx, *, member: commands.Greedy[discord.Member]):
vtkn = await client.bot_token()
for m in member:
await m.send(f"Hey! Your token is here, {vtkn} \nPlease DM SBot V3 and tell him your token, then he will whitelist you.")
Then what do i do?
You have member variable that is an instance of Member
Yes.
So use member.send
Correct
Can anyone here help me develop a discord bot? Would be a paid project
English

@minor kelp The website is coded in PHP, but I can forward it to any language that you use. Preferably Python but I can work with NodeJS I believe
I mainly use Python.
Nice, I will DM you the details and if you are interested we can proceed. If not, no worries.
Alright, DM me, i'll have a good read
i mainly use .net/c#
Is there anyway that I can add mySQL on an Acer Chromebook?
Ping with response, please.
These are the options. What do I pick? I'm not good with this stuff.
@floral bloom Chromebook uses ChromeOS
shouldve picked source code then they wouldve just given you what you needed to do
No.
Thank you
guild_create?
Anyone have any rules designed neatly? Looking for neat/stylish designs to text posts
Yes
require('axios').get('https://api.ksoft.si/images/rand-reddit/panda' , {headers: {'Authorization': 'Bearer '+ksoftToken}}).then(res => {
const e = new Discord.MessageEmbed()
.setColor('RANDOM')
.setDescription(Image not showing? Click [here](`${res.data.image_url}`) !)
.setImage(res.data.image_url)
.setTimestamp()
.setFooter("Command Ran By: " + message.author.username, message.author.avatarURL());
message.channel.send(e)
});
Where is the error
ERROR :
SyntaxError: missing ) after argument list
the description
.setDescription @earnest phoenix
The `` are missing coz I copy paste the code
You need to add a ) at setDescription
Error: (node:2585) UnhandledPromiseRejectionWarning: FetchError: invalid json response body at https://www.instagram.com/accounts/login/ reason: Unexpected token < in JSON at position 0
Index.js ```async function search(name) {
//requirements
const fetch = require("node-fetch")
//actual code
if(name) {
var url = https://www.instagram.com/${name}/?__a=1
var res = await fetch(url).then(url => url.json())
let user = res.graphql.user
console.log(`Found ${user.full_name} with ${user.edge_followed_by.count.toLocaleString()} Followers`)
}
}
module.exports = search```
Invalid JSON
@earnest phoenix message.author.avatarURL);
how do people keep making up their own properties on (invalid) objects lmao
this just keeps on amusing me more and more
They return undefined, meaning they aren't erroring out -> it's fine
who?
Nonexistent properties
ah yeah
but still
it's funny how just because js is not oop and doesn't error out, people think that their own made up props will be filled
Don't try to understand that logic or you'll get used to it :^)
@modest maple it worked yesterday
the response is in html
not json
and if you had the effort to actually look at the error, you would have realized you got redirected to the login page
@grizzled raven v12 is different
oh wait
my bad
didnt see it was a part of the footer
well then read the error
What ) is missing
I tried adding one like in every line / everywhere it gives me unexcepted token
Hello is there any workaround for YouTube Bots? My YT won't play some songs anymore due to youtube changes
wym with this
bot just joins the channel and then quits instantly without any error on some videos
you using LL?
lavalink
LavaLink
doesnt lavalink have issues now because of api changes
no I don't use it
quit as in leave the voice channel?
The force disconnecting a bot while connected is not handled yet with the changes, only creates and error and handles the rest fine
Lavalink is still fine
I think you're talking about being banned by YouTube because you're sending to many requests
I don't think that I'm banned
because some videos still works
but videos for example from VEVO won't work xd
They might be blocked in your country
nope they aren't
What are you using to search and stream the songs
And of course, what language and library are you using
do you use a library to play youtube songs, or did you write it yourself?
he said he isnt using LL
Still many others that can stream
yeah javascript
youtube is funny like that
video might be blocked in your vps's country
nope it isn't
wouldnt ytdl give an error message
Yes it would
tested my bot in finnland and in germany
yeah so is there any error in your console when trying to play music
Maybe check if there is an uncaught error that makes your bot disconnect from the voice channel
nope there isn't any error
???
maybe you catch an error and dont log it?
I used another bot from github just to test if it works
and it doesn't work either
my guess is it can't download the track for whatever reason
but dont quote me on that
try from the same PC if the URL that doesn't work with your bot works with your browser
did it already
it is for example this video: https://www.youtube.com/watch?v=UZwi9SHgzGY
Let me try to play it
bot joins -> disconnects
Hm works, and you're sure that other tracks do work?
yep
and that song never works, or does it sometimes work?
this song/meme works for example: https://www.youtube.com/watch?v=6Dh-RL__uN4
the 1st song will never work
add breakpoints, check all steps of the code, try to find where exactly the failure is
;)
tested it with discord.js-musicbot-addon and ytdl-core
thank you for your help I fixed the problem
Is there any nice way to convert sqlite3 dump into mysql-compatible queries?
im pretty sure SQLlite db's and mysql db's are cross compatible
there SQL queries are both identical tho
for example mysql uses single quote for string while sqlite3 can use doube
they cant be indentical, they have to be exact
mysql wont accept "identical"
I got this message (node:30697) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added. Use emitter.setMaxListeners() to increase limit and im confused on how I fix it
Could I get some help? please
by not using as many message listeners? how are you adding them?
stop creating a new handler for each command
ok
handle your commands in one listener only
ill try that
youtube-search
are u sure lmfao?
hmm then I am maybe too retarded rn
How can I change this to make it to where my bot is streaming not do not disturb
await bot.change_presence(status=discord.Status.dnd, activity=discord.Game('hello all'))
Yes but when I put it in I streaming It does not work
its discord.Streaming
altho it might still need .status.streaming for you and you just havent given it a url
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.7/site-packages/discord/client.py", line 270, in _run_event
await coro(*args, **kwargs)
File "<string>", line 10, in on_ready
AttributeError: type object 'Status' has no attribute 'streaming'```
well then .Streaming it is
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.7/site-packages/discord/client.py", line 270, in _run_event
await coro(*args, **kwargs)
File "<string>", line 10, in on_ready
AttributeError: type object 'Status' has no attribute 'Streaming'```
Sam exact error
its discord.Streaming
altho it might still need .status.streaming for you and you just havent given it a url
Read this again
we have established that status.streaming is no
well yes but actually no
Capital letters
Streaming requires a url
this is all listed on the docs
@unique nimbus can u maybe help meh?
So I have an infuriating problem, https://oliy.is-just-a.dev/zqdczx_2587.png this clears the connections of all nodes, I then log the nodes to see if this problem went away, but there's always some (like this https://oliy.is-just-a.dev/c3sg0s_2588.png ) that keep their connections for whatever reason.
This isnt bot development obviously 
you can ask about anything here iirc
Okay this might seem like a stupid question but I just can't figure this one out:
I'm currently working on a system to do with levels and I'm trying to implement when they hit every 10 minutes they will increase a level but I just can't figure out how to do it without listing all levels (trying to do it to not hit a max level),
All that's coming to my head is something like this [which I know is a stupid method]
let level1 = 600;
if (_user[variable].time == level1) _user[variable].level = 1;
which is what I'm trying to avoid due to how irritating it will be with having to add each and every level...
Something which checks for each minute for example:
if _user[variable].time = 1200 that will then automatically change the level to 2
if _user[variable].time = 12000 that will then automatically change the level to 20
(Hopefully that should explain and help to get the gist of it)
If anyone has any ideas that'll be gratefully appreciated,
Thanks.
Just divide by 600?
crap I'm an idiot...

Thanks for that, I'm just going to go on the walk of shame now...
guys rate my website I made for my bot 1-10 https://fierce.glitch.me/
For me personally it's
The lack of support for PC-built browsers (screenshot will be provided below)
The layout of the site
What I mean by this is that it's all compiled into one page instead of separating it out like into
Different pages for example: Home (index.html) - Staff (Staff.html) - About (About.html) - Support (Support.index)The Color Scheme
Gradient light and dark blue just doesn't go well with a discord grey color in my opinion, Try actually sticking to Discord's color scheme is my suggestion (can be found here: https://discordapp.com/branding)
I already have freehosting.
Lmao.
from where?
A new upcoming web hosting service. It's decent.
But it get's the job done.
Here is a basic template from html5 on the web hosting as a test:http://aniwuey.is-great.net/?i=1
Except it doesn't offer HTTPS yet does it Aniwuey?
whats the link to the site
Dm me it
I don't believe it breaks a rule...
I think you are allowed to post a link when someone asks for it, but if you are afraid it isn't allowed then you can DM the person
Oh. Yas
@real cedar Your going to have to accept my friend request. Due to me settings
I'll try to fix them one second
I posted it in your DM's
How would I go about making a prefix for @bot and not !
Python
I'll assume dpy then, use commands.when_mentioned
Ok
Read the docs if you want it for cogs and if you don't wanna use cogs for it then learn the basics of python
I .posted on hastebin.com/documents but it returns 503 Service Unavailable why?
hmmm
can someone please offer me a bit of feedback on how i can improve this? https://github.com/braindigitalis/botnix-discord-cpp/wiki/Advanced-Chat-Commands#Embeds
I chose json because it easiest represents the embed format, but isnt that user friendly for non-programmers. however, any other format i pick is also not too friendly once i go into the realms of inline fields etc, and arrays of objects inside objects.
Thoughts?
I'm also considering adding a generator to my dashboard for them.
but isnt that user friendly for non-programmers
how so? I've seen non-programmers being able to follow json easily without any explanation
The only issue I've had with that sort of thing is embedding the bot prefix in the embeds, but that's just running it through a very simple template engine
so youre saying im not giving people enough credit if i asssume they'll all go "meh too hard"
😛
@fresh mural how do you mean embedding the bot prefix?
Some of my global embeds include examples of commands to be ran and the bot prefix is configurable
Just have the prefix as a var and format the strings
That's exactly what I did :P
Just made it slightly more complex than it should have been
If I were to do something more complex, Jinja2 might have been a decent idea
Whats the point of doing it complex way, even tho there is simplier way, and doing so, it may lead eventually into problems
is it possible that once the bot has been added it gets redirected to a url?
ye
Discord Developer Portal
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
here they do write You'll also notice the absence of response_type and redirect_uri. Bot authorization does not require these parameters because there is no need to retrieve the user's access token. but it doesn't require but can it be used?
then what did i do wrong?
i cant remember the extension on the url you do for the redirect
redirect_uri is life
well that's the issue i added the redirect_uri but it ain't working
How did you add it
i've
Give me the url
I am tryna setup a gitbooks site, does anyone know what URLs on pages look like
Like would it be URL.gitbooks.com/h
yh
@wheat jolt did you figure it out yet?
is there an way to have an Or in js without that only use one of the options? like having 2 member ids and if one of them is valid that use this one and not just outputs invalid.
so you want to check if a user id is one of two ids or not?
currently when i try to use || in an if statement only one of them is used but the output is still invalid bcs the other id is invalid
|| checks if the value is "truthy"
an id is a string, and a string is a truthy value
as opposite to a "falsey" value, such as "" 0 null undefined
etc
hmm. What i wanted to do is a small override for certain commands that should be either aviable for the Guild owner or the Botowner (set an id for this in my configs)
|| always gives me invalid
so in fact you want if (id === guildowner || id === botowner)
yes
[guildowner, botowner].includes(id) maybe?
if (message.author.id !== message.guild.owner.id || message.author.id !== "247359861929672714") return message.reply("Only Guild Owners can perform this command!")
is the current way i try it
interestening. i looked up the docs for Or and i got || as answer
IF author id is NOT EQUAL to owner id AND author id is NOT EQUAL to bot owner -> return
you want the error to happen if NOT AND NOT
thanks.
makes sense
i was still thinking on my Days in Lua where or was doing what i wanted to do here
I don't know any language where the logic is like you described, since it wouldnt be logical
could be I also start to make a ton of mistakes when im tired
Does anyone know how to use .htaccess?
stackoverflow answers do
Thanks
Hey! I've never really been able to figure out because i just use try {}catch(err){}, but how do you catch a missing permissions error?
Instead of catching it, you could check if your bot has the required permissions to do X action before you try to do it
true.
Hey how would I handle the members, when dealing with messages I just use messages.forEach()
but it says that isn't a function for members.
For some things you can't check if your bot has permissions to do X and you're forced to catch the error (e.g. when trying to send a direct message to a user and the user has DMs disabled or blocked the bot). Libraries typically throw an exception (or reject the promise in JS) when an API error occurred, so you will either want to append .catch(callback) to the promise or make the scope asynchronous, as try/catch blocks don't catch promise rejections unless the inner scope is async
message.guild.fetchMembers().then(members => {
members.forEach(...);
});```
that wouldn't work.
How would I do this
even moreso how do i tell if that person owns the guild o.o
i don't normally work with fetch stuff.
if you've got the user ID, you can compare it to guild.ownerID (or whatever library you're using)
the guild owner isn't cached and causes a crash.
are you using discord.js
what are you trying to do exactly? sending a message to all members is a no no no
@slender chasm client.fetchUser(message.guild.ownerID)
How can I make a prefix so this way I can @ my bot instead of using !
what language?
Some update changed the mentions so it's the <@!id> one
some platforms still use both
use isMentioned (if djs)
eg androids
Both still work my dude.


