#development
1 messages ยท Page 368 of 1
weren't u the guy that copied python from a yt video and then moved to js becuase I told you to understand the code 

try {
var [song] = resolveTracks(url || searchString);
} catch (error) {
try {
const presongs = await resolveTracks(`ytsearch:${searchString}`);
const songs = presongs.slice(0, 10)
if (!songs) return message.channel.send('๐ I could not obtain any search results for your query.');
let index = 0;
message.channel.send(`__**Song selection:**__
${songs.map(song => `**${++index} -** ${song.info.title} [${moment.duration((song.info.length/1000) - 1, 'seconds').format('h:mm:ss')}]`).join('\n')}
Please provide a value to select one of the search results ranging from 1-10.`);
try {
var response = await message.channel.awaitMessages(message2 => message2.content > 0 && message2.content < 11, {
max: 1,
time: 30000,
errors: ['time']
});
} catch (err) {
console.error(err);
return message.channel.send('No or invalid value entered, cancelling video selection.');
}
const videoIndex = parseInt(response.first().content);
const [song] = songs[videoIndex - 1];
} catch (err) {
console.error(err);
}
}
await handleVideo(song, false)
why tf is this broken
when it gets to songs[videoIndex - 1]
it says undefined is not a function, but when i console.log songs[videoIndex - 1] i get a result
I'm in the process of switching databases
Using sqlite rn
Which db should I switch to and is there an easy way to transfer the sqlite stuff to it?
idk
search up online switchers :/

@topaz fjord doesn't resolve tracks return a promise
then why are you awaiting it in one spot and not in the other
what are the default avatar urls again?
henlo
lib?
what language and what library
js and discord.js
mkk
okay
where do I put it and how do I write the string of code, I cant find any documentaion online
@trim plinth
client.setPresense("Hello") thats my taking from the docs
please do not ping me randomly
ok
i got a better idea https://discord.gg/bRCvFy9
ok
um?
how do you get bot token using eval
depends on the lib
eval <client>.token for d.js
and is youve defined the token as a var or an accesable way
First problem is the library allowing you to fetch the token from itself
imo all libraries should be like Discord.Net where you provide the token and it will never give anything to you where you can get the token
It stores it privately with no API interface
wait what do you put for <client>
what ever you defined your client as
;-;
In hind-sight. Don't open eval commands at all
It's a terrible idea and it allows anyone to execute scripts on your server on the bots behalf in a sense
fs and wipe dir if you wanna do dmg
process is not defined
take a look
oh....
It uses an external service to run js
or any eval stuff
No use trying to get anything from it
wellrip
Hey, using discord.js and err is always null. I'm not sure if what i'm doing is wrong, or its just broken..
require(./commands/${command}.js, (err) => {
if(err){
console.log(err);
return;
}
});
@south finch What's the problem with a google command?
How to enable Rich Embed to a bot ?
lib
?
google commands without safe search can return NSFW content
what's ur lib @frigid juniper
out of a NSFW channel, it is against Discord's TOS
Ah python
Discord.py the only one for python
no..
Really ?
there's disco
Sorry so
rewrite or async
Async
i think so 

because if you searched embed , this would come out http://discordpy.rtfd.io/en/latest/api.html#discord.Embed
or have u looked at source code 
I search something like that
Ah thats why I dont understand where is this
@drifting frost nah its not broke.., the code is wrong
oh rip ๐ญ
oof whats wrong?
@low rivet thanks anyways, have a nice day ๐
require has a callback ? o?
you cant use a callback on require
okay, any suggestions on what i can do instead?
what do you want to do tho
read docs 
oof
if your aim is just to catch errors that could happen with your require
well only way i know is a good old try catch
you can use if too
thank you! I don't really know javascript but having healp around the corner is super cool!
I get this error randomly, dunno whats causing it..
at VoiceChannel.get joinable [as joinable] (/app/node_modules/discord.js/src/structures/VoiceChannel.js:64:47)
at Promise (/app/node_modules/discord.js/src/client/voice/ClientVoiceManager.js:46:19)
at Promise (<anonymous>)
at ClientVoiceManager.joinChannel (/app/node_modules/discord.js/src/client/voice/ClientVoiceManager.js:45:12)
at VoiceChannel.join (/app/node_modules/discord.js/src/structures/VoiceChannel.js:120:30)
at Client.client.on (/app/app.js:442:15)
at emitOne (events.js:115:13)
at Client.emit (events.js:210:7)
at MessageCreateHandler.handle (/app/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/app/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65)```
the line it is talking about is `voice.join()`. I think this error could be the reason my bot joins the VC without playing anything then leaves right away. Any ideas what I should replace `voice.join()` with? oh btw voice = `var voice = message.member.voiceChannel;`
"has" of null, what.
Is there a 'has" anywhere?
That error seems like a mess.
just looks like you're missing / misusing something.
yeah you need to show the source code
^ basically.
I can't tell what the issue is from that one line and a redirecting error, lol.
if (message.content === (prefix + ' reee')) {
if(message.member == null) {
return;
}
var voice = message.member.voiceChannel;
// Only try to join the sender's voice channel if they are in one themselves
if (voice) {
voice.join()
.then(connection => {
const dispatcherone = connection.playFile('./sound/reee.mp3');
dispatcherone.on('end', () => {
voice.leave()
});
})
.catch(console.log);
} else {
message.reply('REEEee y0u n33d t0 b3 1n a v0ice ch4nnel f1rst!1!!11 :alien:');
}
}```
is the full code
one hell of a reply.
https://please.zbot.me/RG1vU77a.png
line 64 of VoiceChannel is basically checking permissions for the client user to see if it can connect to the voice channel
'has' of null is basically saying permissionsFor(this.client.user) is null
why its null
im not sure
yea
does the bot have speak perms.
@austere meadow it will be null where the member object for that guild isn't cached (e.g. guild is noted as LARGE), the solution would be to fetch it
issue on d.js end tho, I think
yeah thought so
@restive silo comment? ^
oh what
permissionsFor(this.client.user) is null when trying to join a voice channel basically
it could be
I had some issues with permissionsFor returning null before, it was the member obj not being cached ๐คท
o
yea
wait
i know that bug
yea since some time there is a bug that sometimes your own member object is not cached for some reasons, this sometimes still appears for some reason
that would explain why it crash while testing .joinable
because d.js checks your own permissions on that member
A temporary fix would be to force cache the client user member object, I suppose
is it even possible to populate guild member cache manually?
yea normally that shouldn't happen ofc, your own member object should always be cached
i think you can just run guild.fetchMember(client.user)
and then it should be cached
What kind of lib doesn't cache the client
Righto, thanks for the help guys. Iโll give it a shot later.
https://github.com/DiscordBotList/Luca
wth this is not the same code as @gilded plank at all
It's just a basic bot with tired commands
Yeah but why is it there
I thought it's an other bot.
thats the best bot i ever seen
Yeah but it has the same name as @Luca and a fitting description.
With API
@earnest phoenix u can't get it back to N/A after you post
Or do you want to post your server count?

What do you want to do post or what

Look in #312614469819826177 and find an example that works for you
Try looking for more
Do u even get an error
btw you need 100 servers to be able to apply a certification
@earnest phoenix ^^^^^^^^
OwO. . .
@unique star it's changed iirc
Is this the best place to request some help?
With what
I'm getting this error https://pastebin.com/ZuP82jyN and I don't why.
I added all of the libs in the classpath.
was just for prevent you to do a depresion 
thats why you just said
yes
do my name is in green ?
don't have any bot for the moment here
thats the DBL api
eyy
there is multiples exemple in #312614469819826177
wich one you tried ?
oh i see
there is some Missing line
dont forget @client.event ( or bot.event deppending what you choose )
@earnest phoenix before all async def on_ ect
if you have all ready an on_ready you have an exemple
try this i'm not not sure at 100% is that
and use hastebin.com
I'm sending the followin json data to the website but the shard count doesn't seem to update (the server count DOES update)
{
"server_count": 2570,
"shards": [ 2570, 3 ]
}```
that's an incorrect format
Use
{
"server_count": 2570,
"shard_count": 3
}
instead
its quite long
can u code block it
tbh do u know what hastebin is?
no
ok well its like a site u can post long docs on and get a link instead of like posting how u did
ok
try that
Go to hastebin.com paste all your code there then click the save button
ok
for once ur helpful 
Then give us the link
doing that now
@south finch :(
movin up in the world
that?
Yes
what tutorial are you following?
that one
Any what's your problem
yes
mm
@topaz fjord his bot won't "work" per say. Like he goes to run it and it won't start.
its put the packages in, so thats no issue
are you running the cmd prompt from inside the folder you put your files in?
no

there's your issue
but im putting the directory in so that it takes it from there
eh, don't use discord.io. It's pretty dead
hold shift while right clicking in your bots folder then click Open command window here, there you can run your bot from the folder
^
also io is kind of dead;; if u want a better tutorial to follow you can follow a diff one
like this one: https://anidiotsguide_old.gitbooks.io/discord-js-bot-guide/content/
k
and use discord and know discord well before making bots
you read through that whole thing pretty fast.

just reading it isn't going to help you.

im good at it
you're not gonna get anywhere if you don't put any effort in 
^^
@wispy pulsar give it another read and look carefully at it, it isn't a race
@wispy pulsar read this https://anidiotsguide_old.gitbooks.io/discord-js-bot-guide/content/getting-started/your-basic-bot.html
i already sent him to that
also bots aren't something u can just whip up out of nowhere. It takes time and patience to learn how to code one etc.
^^
Speed reading 
i had to move classes
?
then wait till you have time to do stuff instead of rushing yourself?
Is it frowned on to use discord bot maker on steam? ๐ค
Yes

But sites made with WordPress, xenforo, mybb, drupal, etc. Aren't frowned upon. And rpg maker games can still be good so why not bots? 
disgustang
drops mic
coding bots aren't that easy actually
^
it's frowned upon because DBM doesn't offer much in the way of customization
^
all the bots it produces are essentially the same
Yeah basically
and it's not frowned upon for... any of those other reasons
That's understandable
you're free to use it if you like
I just don't know how to code ๐
You can always learn
fyi submitting the example bot is not allowed here
You can't add as much custom features as making bots from scratch if you use DBM
I get maybe 3 hours of free time a day ๐ง so Idek if I'll have time to learn
3 hours is more than enough to learn some coding everyday
Yeah

try learning at www.codecademy.com
Any good websites to learn
just one
you could honestly set 30mins to an hour everyday aside or every other day or something like that to learn
What language though? I take it this site has lots of options, php, css html, java, etc. But what specifically for discord bots?

do you think i have a higher chance to succeed if I use python
not really
java, python, js, ect
there are channels for most libraries there
find one you like
and learn the language
Ayeee thanks
Almost every app language has a discord lib
JS and python are considered easy
Or most of them
is there discord.html
but you might find other langs easier

I'll probably do js
mk
That'll help in other things too I'm pretty sure
lua is also easy
I do not like LUA >:(
also besides syntax and some basic stdlib
node is different from what you'll have for website js
Yeah
websites have way less stuff and access to the machine
So it's harder to make a bot than a website?
Not really
depends
same
I own like 20 websites atm ๐
@split ermine h a v e y o u c o d e d a s i n g l e o n e 
N.o.p.e.
mk
I've edited the coding on them
But I have no idea how to code anything from scratch


@inner jewel teach me java
In my experience server count requests seem pretty instant
rip u
Hello
Did the request even return correctly lol
I need JavaScript dev
@earnest phoenix mmwaht do ya need
how do you make a bot that announces the release of a video of a specific ytb
I cannot answer that
@heady zinc oh bae
"bae" ? xD

webhooks
Si tu veux je peux te traduire tes phrase hein xD
If you want i can translate yourrre shit
Why is ```java
System.out.println(new DiscordBotsAPI(TOKEN.DBL).getUpvoterIds());
`null` ?
ask whoever wrote that wrapper thingy
you really don't need a wrapper for dbl's api
also its probably because it doesn't know the bot to get the upvotes from
Any opinions?
Cachet, https://demo.staytus.co/, https://statusy.statusy.co or other?
Can anyone help me with a website API / a forum for a mc server It's not for my bot it's for an other bot (private)
But I still can't seams to be able to fix the issue so I keep deleting & creating code.
If you do know please contact me (language: discird.js 11.3.0)
It's ain't easy to say that but I failed more then a week or so
And they wants it if they created a thread in announcements it sends in the forums channel
@digital fractal you need to give getUpvoterIds() the bot user id
async def doPayload(self):
dbl_token = "<token_hidden>"
dbl_url = "https://discordbots.org/api/bots/" + bot.user.id + "/stats"
dbl_headers = {"Authorization" : dbl_token}
dbl_payload = {"server_count" : len(bot.servers)}
async with aiohttp.ClientSession() as aioclient:
await aioclient.post(dbl_url, data=dbl_payload, headers=dbl_headers)
is this right?
YES, doPayload IS BEING RUN
that is confirmed
@inner jewel ๐
i dont think i did the api right
continue
Response == bad (read to know why). Is content type set to application/json properly
But that shouldn't matter for content type
(maybe)
Honestly read the response if you get one
If you don't then ๐
idk, just modded the one in #312614469819826177
Well I'd check response of server if anything
tbh idk how to do it xd
Look it up
wait i have an idea
nvm
async with aiohttp.ClientSession() as aioclient:
async with aioclient.post(dbl_url, data=dbl_payload, headers=dbl_headers) as resp:
print(await resp.text())
is this right?
(ignore spacing)
i dont thing print ever got ran
you cant ignore spacing in python or? 
i meant me copy pasting code from he file it broke it
o
All right developers, i have a question. Do you think it would be a bad practice to automatically DM a sever owner after they kick my bot and ask for feedback?
Don't think that's possible though
If they kick it, they probably don't want anything to do with it kek
^
Noted, thanks :P
@inner jewel hows ur nightcore thing going
gave up
ยฐโกยฐ
Any good weather npm packages? (I'm using weather-js but I want a better one if there is better)
how do i ping a role
discord.js
<@&id>
@trim plinth use an api
mk
Use Google's geocode and darksky weather
How can I remove every single duplicate in a sqlite db?
sudo rm -rf /
does anyone use discord.net

yes
I use python for my bot
i don't used to
Did they do something to the api?
My console has been spammed with some 429 error ๐ค
๐ค
ratelimits are a thing @junior lily
oh shit didnt see dat
let messagecount = parseInt(args[1]) || 1;
var deletedMessages = -1;
message.channel.fetchMessages({limit: Math.min(messagecount + 1, 100)}).then(messages => {
messages.forEach(m => {
if (m.author.id == bot.user.id) {
m.delete().catch(console.error);
deletedMessages++;
}
});
}).then(() => {
if (deletedMessages === -1) deletedMessages = 0;
message.channel.send(`:white_check_mark: Purged \`${deletedMessages}\` messages.`)
.then(m => m.delete(2000));
}).catch(console.error);
}
``` whats wrong
error code ```ReferenceError: bot is not defined
at messages.forEach.m (C:\Users\sande\Desktop\mybot\commands\delete.js:9:30)
at Map.forEach (<anonymous>)
at message.channel.fetchMessages.then.messages (C:\Users\sande\Desktop\mybot\commands\delete.js:8:16)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
In exports.run you have client and you don't have bot
replace bot with client
@fleet mason
Should fix it
ok when i run the command now it works, but it creates the message and then it deletes the message but none of my messages.
Are you trying to purge a specific users messages?
yea i want 2 purge commands. one that deletes a user messages and one who just deletes the last. but it dosent work atm
what
I can't help you with user purge, but I can help you with the other one
exports.run = (client, async, message, args) => {
async function purge() {
message.delete();
const fetched = await message.channel.messages.fetch({limit: args[0]});
message.channel.bulkDelete(fetched)
.catch(error => {
return message.channel.send(/*If there's an error it will post through this message.*/ `Error: ${error}`);
});
let m = await message.channel.send({embed: {
description: /*Deleted message here, eg:*/`Deleted ${args[0]} messages.`,
color: 0x82eefd
}})
setTimeout(function () {
m.delete()
}, 7500)
}
purge();
}```
That should work
(node:8708) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: message.delete is not a function
yea
You're using d.js right?
yep
What version?
where do i check that?
Do this: npm list --depth=0
you should see discord.js somewhere
Forgot how to do it for a specific module
+-- discord.js@11.3.0
XD
Npm list module_name iirc
To the website or to your server?
Go to https://discordbots.org/bot/155149108183695360 and click invite, then select the server you want it to be in (you might need to log in to discord). Then click Authorize and complete the capatcha
And it should be in your server
If it doesnโt work can I invite one of you to help me out?
Try it first
does anyone here know how to use sphinx? (pm me please)
How do I like.
?
go to discord.gg and open discord
then click on the cog wheel next to deafen
and click log out
Thanks so much
np
@earnest phoenix
@heady zinc when i run the command i got this C:\Users\sande\Desktop\mybot
`-- (empty)
whats wrong with this code: ``` exports.run = (client, async, message, args) => {
async function purge() {
message.delete();
const fetched = await message.channel.messages.fetch({limit: args[0]});
message.channel.bulkDelete(fetched)
.catch(error => {
return message.channel.send(`/*If there's an error it will post through this message.*/ Error: ${error}`);
});
let m = await message.channel.send({embed: {
description: `/*Deleted message here, eg:*/ Deleted ${args[0]} messages.`,
color: 0x82eefd
}})
setTimeout(function () {
m.delete()
}, 7500)
}
purge();
}
Why the hell is there "async" as an argument
I believe that is your problem
Am on phone so can't help much but im pretty sure "async" at "exports.run = (client, async..." Has nothing to do here
When async becomes an argument... :))))
Ready to server in 20 channels on 1 servers, for a total of 15 users.
(node:14020) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: message.channel.messages.fetch is not a function
(node:14020) [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.
(node:14020) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: message.channel.messages.fetch is not a function
it dosent work
i removed a sync and it dosent work
async*
that's a v12 thing
ok how do i fix it?
1 hour
@fleet mason don't copy and paste code, that's how you fix it :b
hey, im getting a bit of a weird issue with lavalink.js
what im trying to accomplish is an automatic-ender of sorts, where if the voice channel is left without any users in it for a certain period of time, it will disconnect from that guild
everything is basically working, but one major issue is that on client.player.leave(guild.id), music also stops transmitting in all other guilds, it doesn't disconnect or delete the player in other guilds, it just stops transmitting audio, lavalink still thinks its playing on the other guilds
i know this may not make sense but if anyone here has any idea what might be going on i'd appreciate any help 
wait that sounds like the discord bots voice bug
oh so is it just a bug on discords end or something
client bug
ah okay
this bug is around since a long time now and still not fixed
also its only if on a shared server the bot leaves VC
means if you only share 1 server this bug cant happen
@fleet mason, .fetchMessages()
i tried something else and now i get this error (node:12628) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): TypeError: message.delete is not a function
how isent message.delete a function
is message null?
the message is just a normal command. i have it working in my other commands
pastebin?
async function purge() {
message.delete();
if(message.author.id !== config.ownerID)
{
message.channel.send('You need the \`bot-commander\` role to use this command.');
return;
}
if (isNaN(args[0])) {
// Sends a message to the channel.
message.channel.send('Please use a number as your arguments. \n Usage: ' + prefix + 'purge <amount>');
return;
}
const fetched = await message.channel.fetchMessages({limit: args[0]});
console.log(fetched.size + ' messages found, deleting...');
// Deleting the messages
message.channel.bulkDelete(fetched)
.catch(error => message.channel.send(`Error: ${error}`));
}
purge();
}
yeah, that's because message doesn't exist inside of purge()
no
pass message into purge() as an argument
purge(message)
Its all in the exports.run scope, so message should already be defined
oh, hrm
it didnt work...
But try passinh it as an argument and see what happens
Ok so some tests
In the purge function, just add a line to log message
See if it is logged
Then you know message is defined and something else is broken
ok so i put a console log before message.delete()
ok so now i did it and the same error
its something with message.delete();
What event is this running on?
Oh wait i know
Remove the purge function all together
Only have the contents
And have async before exports.run
That should work
In my brain..
XD
\ . > . /
ok so i remove the purge() and then add a asic on the start and then remove async function purge()
exports.run = (client, message, args) => {
console.log('it works.');
message.delete();
if(message.author.id !== config.ownerID)
{
message.channel.send('You need the \`bot-commander\` role to use this command.');
return;
}
if (isNaN(args[0])) {
message.channel.send('Please use a number as your arguments. \n Usage: ' + prefix + 'purge <amount>');
return;
}
const fetched = await message.channel.fetchMessages({limit: args[0]});
console.log(fetched.size + ' messages found, deleting...');
message.channel.bulkDelete(fetched)
.catch(error => message.channel.send(`Error: ${error}`));
}
K.. Does it work?
nop
const fetched = await message.channel.fetchMessages({limit: args[0]});
^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Client.client.on.message (C:\Users\sande\Desktop\mybot\mybot.js:27:23)
You can't use await out of an async function
hum ?
Yup.
Never noticed x)
It has to be async exports.run
Anyone please tell me how to use the Discord Bot List API please? I'm using Python...
async def on_server_join(server):
We need the @client.event before no ?
Yup
There is none on the exemple
That's why lot of people don't do it correctly and come here to ask some help ^^
@austere meadow ๐
That's okay that's make a while and usually people who know what they are doing correct himself the little error ^^
That was funny haha...
Hum ?
Nothing...
๐
why is ytdl messed up?
ytdl works fine
info.title doesnt wanna work for me
^
TypeError: Cannot read property 'title' of undefined```
info is undefined
well u cant blame ytdl-core for that
const title = info.title;
message.channel.sendMessage(`Now playing \`${title}\``)
})```
ur probably doing something wrong lmao
i didnt touch the code for over a week
it does take the name
Use this if you only want to get metainfo from a video. If callback isn't given, returns a promise.```
yes
for example https://www.youtube.com/watch?v=wJnBTPUQS5A
without the <>
^
Error: Could not extract signature deciphering actions```
o nvm it's an open issue on github
:/
welp rip my music code
youtube-search seems to work still thou :/
so we wont be able to use ytdl-core for a while
Does anybody know if you can have an output of over 1 when using synaptic js
why do i get this Error ```
C:\Users\sande\Desktop\mybot\commands\purge.js:1
(function (exports, require, module, __filename, __dirname) { async exports.run = (client, message, args) => {
^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Client.client.on.message (C:\Users\sande\Desktop\mybot\mybot.js:27:23)
This is my code ``` async exports.run = (client, message, args) => {
console.log('it works.');
message.delete();
if(message.author.id !== config.ownerID)
{
message.channel.send('You need the `bot-commander` role to use this command.');
return;
}
if (isNaN(args[0])) {
message.channel.send('Please use a number as your arguments. \n Usage: ' + prefix + 'purge <amount>');
return;
}
const fetched = await message.channel.fetchMessages({limit: args[0]});
console.log(fetched.size + ' messages found, deleting...');
message.channel.bulkDelete(fetched)
.catch(error => message.channel.send(`Error: ${error}`));
}
it's exports.run = async () => {} not async exports.run = () => {}
the async is a modifier of the function not of exports
(node:5612) [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.```
now i get that error code
ok i got it to work but it gets a problem at this line when i dont type a number ``` if (isNaN(args[0])) {
console.log('it works3');
message.channel.send('Please use a number as your arguments. \n Usage: ' + prefix + 'purge <amount>');
console.log('it works.3');
return;
}```
would changing the 0 to null help?
ok i got it to help but if i type !purge 1
i get a error
yea
i fixed it
wow now it worked im so lost
this is the error that i sometimes get. Error: DiscordAPIError: Unknown Message
Its means the message you are trying to get is not valid
Hi
@earnest phoenix hello
hi
ola comas estas amigos
So what db are you using
Me habla espaรฑola
??
@thorny hinge May I recive the examples about DB (JSON and SQLite)?
Theres docs for both
For anyone who uses lavalink what is in place of the connect/disconnect events
@inner jewel it doesn't show a workaround
m.edit(Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(client.ping)}ms);
would this work?
ok
If you're asking if it'll work by itself, no.
const strings = args.join(" ");
if(strings.startsWith('-player')) {
playerdata = strings.replace('-player', '').trim();
playerData = playerdata.split(" ");
console.log(typeof playerData[0]);
if(!playerData[0]) {
msg.channel.send('no player');
} if(!playerData[1]) {
msg.channel.send('no region');
} if(playerData[1].toUpperCase() !== 'PC' || playerData[1].toUpperCase() !== 'XBOX' || playerData[1].toUpperCase() !== 'PS4') {
msg.channel.send('invalid region');
}
}
i'm trying to make a rocket league cmd, but when I reach the last else, even if playerData[1].toUpperCase() is one of those values, it sends that "error" message. any help?
log it and make sure
i am sure
then playerdata is wrong ๐คท
log it
also it's better to ['A', 'B', 'C'].includes(playerData[1].toUpperCase())
aaaah
hmm
maybe it's that?
i've already logged
before
playerData[0], playerData[1].toUpperCase() and typeof on both
what do you want the check to do
because if you want to see if it's none of them, you want to use &&
(or preferably Array::includes)
actually, Array::includes worked https://loritta.took-naughty.pictures/dcNUXNDoz.png
thank you so much aetheryx <3
Heyo, I'm looking for python Discord dev for a project
I can't afford to pay the dev(s) tho
terrible
good website design entails not using unnecessarily complex and long animations lol
iDerp that is amazing
How does top bots work on website 

cough should be first 2 pages cc tonkku
should be first page of search results for "author:phanta#1328"
how do i make it like if reply is y or n it says something in js
a... conditional?
if (msg.content === 'y') {
// do somethibg
} else if (msg.content === 'n') {
// do something else
}
msg.reply("Am i a human?");
if (msg.content === 'y') {
msg.channel.send(`I know`);
} else if (msg.content === 'n') {
msg.channel.send(`YES I AM`);
};
'servers': (msg) => {
msg.channel.send(`I am in **${client.guilds.size}** servers!`);
},```
i do that then it does this
it does the same thing for , and nothing
@glossy sand
uh well
you would, in this case, be trying to check the message content of the message that initiated the prompy
and you already know the conditional will never take either branch
i want it to send a message and then check there next message for y or n
so add some construct to store state and use two different message hander depending on that state
you might even want to implement some sort of middleware that routes between different message handlers, including the command handler
events.js:137
throw er; // Unhandled 'error' event
^
Error: Connection lost: The server closed the connection.
at Protocol.end (/root/Bots/SiriBot/node_modules/mysql/lib/protocol/Protocol.js:113:13)
at Socket.<anonymous> (/root/Bots/SiriBot/node_modules/mysql/lib/Connection.js:109:28)
at Socket.emit (events.js:165:20)
at endReadableNT (_stream_readable.js:1101:12)
at process._tickCallback (internal/process/next_tick.js:152:19)
``` need some help with this.. this keeps crashing my bot.
makes no sence to me @glossy sand
@deep parrot u eneded your mysql connection
But on what tho
in your code
Hey guys
Does anyone know why my bot is throwing https://i.imgur.com/jKzRCpO.png
but it works on my home machine but not the server
@topaz fjord sorry for tagging, but do you know?
@dusk verge.command(pass_context=True)
async def warn(ctx, user: discord.Member):
await bot.say("warn" {}. .format(user.name))
await bot.warn(user) will this work for warn command?
anyone know?
@here anyone know? sry for tag but it is urgent for my bot to work with warn commands
what is the error?
it says not known
paste the error
Ignoring exception in command None
discord.ext.commands.errors.CommandNotFound: Command "warn" is not found
well, command warn is not found
it no work idk how fix
What's the command ment to do?
Ur await bot.warn(user) doesn't seem like it would do anything to me
Well ur trying to do bot.warn and there is no built in warn method
idk how set that ๐ฆ
U don't, you get rid of that line commpletely
Well how do u want to warn people, send em a DM or something?
Anyone know why my bot joins, says it's playing, then leaves?
No errors
It just started today
I fixed it
YouTube updated sigs
Ye
Ah ok
Thanks though ^_^
@earnest phoenix if youโre using d.js, d.js has a built-in awaitMessages() method.
Anyone using discord.py could help me on this? Looks like the API doesn't have an event for when the client leaves a server...
Do you know how to get the bot's upvotes count by itself (discord.py)?
(node:13868) UnhandledPromiseRejectionWarning: Error: SQLITE_CANTOPEN: unable to open database file

Hey folks I am super new to discord and bots....and coding in general...but where do I get started on development?
You need a tutorial?
@leaden bane there is an event
Which event?
on_guild_remove
Anyone help me with SQLite.
I'm not seeing it in the discord.py's documentation... Its syntax is on_guild_remove(server), right?
IDKk anything.. I can MySQL but that was not in Node
async or rewrite @leaden bane
(node:6084) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'run' of null
at Promise (E:\auberant\node_modules\sqlite\main.js:219:19)
at new Promise (<anonymous>)
at Database.run (E:\auberant\node_modules\sqlite\main.js:218:12)
at message.channel.send.then (E:\auberant\react\setup.js:14:8)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:160:7)
(node:6084) 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: 4)
Who can help me with this err
The query is ```js
db.run('CREATE TABLE cash (account TEXT PRIMARY KEY, balance INT, private TEXT)')
@low rivet What did you mean?
But I don't know why.
@ leduyquang753#3761 yes I do need a tutorial
0.16.0
it's on_server_remove then
@last tapir I will guide you thru making a bot.
Great thank you.
@low rivet I tried but it seems not to be working...
send code
@bot.event
async def on_server_remove(member):
if member.id != bot.user.id:
return
global count
count -= 1
await bot.send_message(log_channel, """The bot has left the server **{}** (ID {}).
{} servers left.""".format(sv.name, sv.id, count))
The servers count...
just use len(bot.servers) 
I was lazy to change that xD...
continue having shit code then 
...
Ooooo he talked about your code!!
what's the problem about code
Dunno
Hmmm...
bjr
witch part of bot is shard

how i fix shard not defined in discordjs
use the shard manager ?
yeh i try call it out to API
dclient.on('ready', () => {
require('superagent').post('https://discordbots.org/api/bots/203781450905026561/stats')
.set('Authorization', config.authorization1)
.send({ server_count: dclient.guilds.size,
shard_count: dclient.shard.count,
shard_id: dclient.shard.id })
.end((err, res) => {
if(!err) { console.log('Updated Server Count to https://discordbots.org/'); return; }
console.error(`Failed to Update Server Count for https://discordbots.org/`, err);
});
});```
https://i.imgur.com/QmioRSR.png thiis all i get from API
do you use d.js sharding manager?
never used sharding manager before mostly i done is calling out Discords connected
and there is 1 but idk how exicute it
i know it seems like im coming here daily with shitty issues about lavaplayer and stuff but hopefully after this it should be all good
im getting this issue where Lavaplayer is having issues retrieving tokens or a cipher key https://please.zbot.me/JA7wWq2f.png
im not sure why im getting this and it happens on most videos
youtube had an update yesterday what forced most downloader/libraries to update, could be related
not sure tho
ah okay
actually just found this https://github.com/sedmelluq/lavaplayer/commit/71c8e8c59373c3846e1334e1a4b36370812c0b14
yea
is there anyway i can update lavaplayer without having to wait for a new version of lavalink to come out
update it by youself ยฟ
pmuch lul
why do i have to put so much effort into this 
because youtube updateโข
cuz google is eviiiiiiiiilll
@austere meadow lavalink already has a patch
but you can update just lavaplayer if you want
jar files are basically zips
yeah i know but the update is on v2
tho lavaplayer doesn't have a single jar
and there isn't a wrapper for js on v2
rip
@austere meadow u use java right
the only errors ive been getting is the one i listed above about the new update
otherwise its been pretty smooth sailing for me
relatively
o
I've been getting a playback failed error for only music and the lavalink.js Creator told me to update lavalink idk wether he means the module or the server
com.sedmelluq.discord.lavaplayer.tools.FriendlyException: Something broke when playing the track. at com.sedmelluq.discord.lavaplayer.tools.ExceptionTools.wrapUnfriendlyExceptions(ExceptionTools.java:40) at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.execute(LocalAudioTrackExecutor.java:102) at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.lambda$executeTrack$1(DefaultAudioPlayerManager.java:348) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.IllegalStateException: Must find action functions from script: /yts/jsbin/player-vflBjp0_H/en_US/base.js at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeSignatureCipherManager.extractTokensFromScript(YoutubeSignatureCipherManager.java:185) at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeSignatureCipherManager.getCipherKeyFromScript(YoutubeSignatureCipherManager.java:141) at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeSignatureCipherManager.getValidUrl(YoutubeSignatureCipherManager.java:100) at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.loadBestFormatWithUrl(YoutubeAudioTrack.java:99) at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.process(YoutubeAudioTrack.java:60) at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.execute(LocalAudioTrackExecutor.java:90) ... 4 common frames omitted
yeah thats the same error im getting
its because of the new youtube update
they made changes to the way they cipher stuff or something
so im assuming you're in the same situation as me and im not sure what to do
But when I play a let's play video it works 
most videos just outright dont work for me
so i dont think its worth staying on lavalink for now
Hmm
i switched back to ytdl-core just for now
just so that people have something thats working
Im Waiting for someone to make a module for lavalink 2.0
^
There so many py libs tho
i tried looking at making my own wrapper but gave up pretty quickly after i realised im just bad at programming
smae
I would but im stumped since they removed disconnect and connect
The events
So idk what they replaced it with
yeah im in the exact same boat
i didnt know how to use the discord api with VOICE STATE UPDATEs and stuff so i was just like ยฏ_(ใ)_/ยฏ
blake pls
look i know im bad
since when am i good at programming tho
idk you just sound smart lmfao
Only thing im good at is discord bots...
same
@topaz fjord correct me if im wrong but i thought your bot was in js?
Still is
ah
true
https://github.com/MrJacz/discord.js-lavalink
Jacz is apparently making a new wrapper for d.js
but that seems a bit far away
what's the deal with voice state update tho ๐
@heady zinc to join a voice channel you need to use the voice state update or something
one sec
voice server update sorry
Seems useless tbh
nice ๐
Anyone know anything good for making widgets?
what should i put on "message.channel.send()"?
the actual message?
idk how to make my bot post a pic so yeah
see d.js docs
what should i search?
the .send() method
Mk
afaik it describes what you can send
look at MessageOptions
is it this?
no its not
He can also make an embed and set the image
huh?







