#development
1 messages ยท Page 445 of 1
Maybe there's an event like auditLogUpdate?
nope
there isnt
checked
here's the class for an audit log entry
then all the types of audit log actions it knows of
which includes INVITE_CREATE, INVITE_UPDATE AND INVITE_DELETE
@old swallow
Got it, though ugh, that sucks.
They give us all these fancy events, though no audit log or invite events. Exactly.
I know this is possible though, bots like @earnest phoenix and @leaden arrow do it
is there a way to send a message into a certain channel in a certain server with a command?
discord.js, btw
nvm I figured it out XD
bot.channels.get('channelID').sendMessage('your message')
you shouldn't use sendMessage anymore, its deprecated
Sometimes the websocket latency (delay of the last heartbeat) is negative for me... It is d.py and I am wondering if it is just the lib's issue or you can also experience something similar with other libs aswell
oof just realised its deprecated, thanks ๐

Can someone assist me with an issue Im having involving discord.js and ytdl-core?
im sure someone can
@long forge, post your issue, don't ask to ask practically.
My bot for some reason won't continue through the queue of songs in my song playing command (play.js). It just stops. It doesn't give an error in console or anything. Only when you finally do the skip command will the bot continue to the next song, but once it ends, it just stops right there again.
node modules I am using: discord.js and ytdl-core.
https://pastebin.com/3KiNSCnn
^^^^^
SyntaxError: await is only valid in async function
``` why ?
The error is straight forward telling you that you can only use await inside an async function
not much to explain there
๐
mark the current function as async
first off please stop mentioning me, thats quite annoying and second thats basic js knowledge you can read it up here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function
Anyone know how to get Custom Colors in embeds? The syntax of the command requires you to say <text> color:<6-digit number>.
what lib
Basically, a user sends in a 6 digit color number, preferably RRGGBB, and it gets the number and put's it where the discord embed puts it's color
discord.js
so discord.js uses 0x[html/hex color code]
yep
so you'd need to do 0x[their color]
make sure to validate its a real color
the max is FFFFFF, which is white
Well, I already tried that and the DiscordAPI pumps out an error
what error
embed.color Color must be smaller than...
The number is too big, and it has to be 6 digits
uhhhh
basically thats what it means
what version of djs are you using
11.3.2
but thats unstable
It ain't.
not really tbh
rlly
oh, how do I upgrade discord.js?
@dusty bronze uses v12/discord.js master, and yeah. It works fine.
sorry, I havn't done it in ages lmao
uninstall discord.js and install hydrabolt/discord.js through npm
ok
@wild tide change your discord.js dep to github:hydrabolt/discord.js#master too
just remember that djs master has major changes
in package.json
also yeah
here's the 12.0.0-dev docs
hmm
in package.json I changed the version number to github:hydrabolt/discord.js#master
I uninstalled discord.js and installed hydrabolt/discord.js using npm
like what?
so some of your bot's functions might not be compatible
and need to be updated
well theres no real list atm
but some stuff's changed
not here to brag, just want to mention that i would say v12 is much better in many ways
zBot uses v12 (latest master commit) and it has nearly 1600 guilds
user caching and performance has improved a lot
yeah my bot uses v12 too
as well as adding some new features which are useful
welp v12 just broke my whole bot
and I still havn't fixed my custom colors
in fact I made it worse
soooo
meh
nvm ill just figure out how to fix my colors myself, since changing versiosn didn't work 
btw I downgraded discord.js back to v11
var argument = message.content.trim().split(" "); // text is the input
var lastArgument = arguments[arguments.length - 1];
if (lastArgument.startsWith("color:")) {
var color = lastArgument.replace("color:", "");
var sendcolor = lastArgument - color
}
if(color == undefined){ color = defaultcolor}
var noFlags = args.filter(arg => !arg.startsWith("color:"));
const sayMessage = noFlags.join(" ");
message.delete().catch(O_o=>{});
message.channel.send({embed: {
color: Number(`${sendcolor}`),
description: sayMessage
}})
console.log(sendcolor);
console.log(color);
console.log(lastArgument);
```
`sendcolor` is returning `undefined`
`color` is returning the defaultcolor (which is 3447004)
`lastArgument` is returning `/app`
I am proper confused rn
why are you using Number()
It turns a string into a integer
yes ik
i wasnt saying that
hmm
is there anything I am doing wrong? I mean, obviously I am, but I don't know where
do the console log for send color after you set it
like
right after
see what it does then
show me the new code
var argument = message.content.trim().split(" "); // text is the input
var lastArgument = arguments[arguments.length - 1];
if (lastArgument.startsWith("color:")) {
var color = lastArgument.replace("color:", "");
var sendcolor = lastArgument - color
}
console.log(sendcolor);
if(color == undefined){ color = defaultcolor}
var noFlags = args.filter(arg => !arg.startsWith("color:"));
const sayMessage = noFlags.join(" ");
message.delete().catch(O_o=>{});
message.channel.send({embed: {
color: Number(`${sendcolor}`),
description: sayMessage
}})
console.log(sendcolor);
console.log(color);
console.log(lastArgument);
```
oh
maybe its cuz you set it in the if statement
plus i'd use let
instead of var
could I move it out so it becomes a global variable?
yes
ok
welp its still returning undefined
(show new code)
I think it's because lastArgument is defined as /app for some reason
//Outside of code, global variables
var lastArgument = arguments[arguments.length - 1];
if (lastArgument.startsWith("color:")) {
var color = lastArgument.replace("color:", "");
var sendcolor = lastArgument - color
}
//Inside code
var argument = message.content.trim().split(" "); // text is the input
console.log(sendcolor);
if(color == undefined){ color = defaultcolor}
var noFlags = args.filter(arg => !arg.startsWith("color:"));
const sayMessage = noFlags.join(" ");
// Then we delete the command message (sneaky, right?). The catch just ignores the error with a cute smiley thing.
message.delete().catch(O_o=>{});
// And we get the bot to say the thing:
message.channel.send({embed: {
color: Number(`${sendcolor}`),
description: sayMessage
}})
console.log(sendcolor);
console.log(color);
console.log(lastArgument);```
no no
i mean
define sendcolor outside of it
as iN
var sendcolor;
outside
inside
if statement, set that sendcolor var there, etc
no no no
im trying to remove color: from the number next to it, and putting it into the embed
because the syntax is +command <text> color:<color-number>
if (lastArgument.startsWith("color:")) {
var color = lastArgument.replace("color:", "");
var sendcolor = lastArgument - color
}
okay uhh
i just read this code
and what are you doing
like
what
idek
but color is returning undefined
cuz you're defining it on the outside code
and in an if statement
what i mean is
you're CREATING
it
inside there
which doesnt work
"inside" means inside the if block that runs when the command is entered, "outside" means outside the whole code, where it can declare itself as a global variable
i dont think you get it
heres what i mean
//Outside of code, global variables
var lastArgument = arguments[arguments.length - 1];
var color;
if (lastArgument.startsWith("color:")) {
color = lastArgument.replace("color:", "");
}
ik it's spoonfeeding and all but this has been a while
ยฏ_(ใ)_/ยฏ
you define color
outside of the if statement
that i did there
then you set that value
and it knows you're trying to set that
creating color inside the if statement doesnt work
as it'll delete that variable
as soon as the if statement ends
@wild tide
hmm
you are also defining what the variable holds with the number you type in the command
hm?
doesn't work
if(color == undefined){ color = defaultcolor} its activating this line of code in the command if block
it just makes color the default color I set if you forget to enter the args
you should just do
if (!color)
that basically means if its false or null or undefined
ยฏ_(ใ)_/ยฏ
also use 3 equal symbols
== This is a permissive value equality sign: it checks for equality between two variable after trying to parse them to the "best" format ("best" according the ECMA specifications) === This is a less permissive value equality: it checks for valu...
@wild tide
ik that
color is returning the default color still, so it isn't recognising the args
lastArgument is still returning /app
well its skipping defining it them
if lastArgument isnt returning a string that starts with color:
*play fuck
I'm having trouble using CSS to make the upvote button say 20 Upvotes rather than 20Upvotes. Please could someone help, thx
#upvotebutton {
background-color: #ffffff;
}
#upvotebutton:after {
content: ' Upvotes';
color: red;
}```
It seems like the new content gets stripped of the space at the start, I want this space to be preserved
do ' upvotes ' maybe?
i did
oh
a space at the end
i'll try that
spaces at the end are getting stripped as well
I managed to do it by using a zero-width space. Thanks for helping anyway!
any mistake i have done
if (message.content === '++serverinfo') {
let server_name = message.guild.name
let Created_on = message.guild.createdAt
let server_size = message.guild.members.size
message.channel.send('Server : ' + server_name + '\nMembers : ' + server_size + 'Created At :' Created_on)
};
if (message.content === '++avatar') {
message.reply(message.author.avatarURL);
}
});
The Source Code Is This
if (message.content === '++serverinfo') {
let server_name = message.guild.name
let Created_on = message.guild.createdAt
let server_size = message.guild.members.size
message.channel.send('Server : ' + server_name + '\nMembers : ' + server_size + 'Created At :' Created_on)
};
if (message.content === '++avatar') {
message.reply(message.author.avatarURL);
}
});
ah
much better now
sorry, I just couldn't look at the bolded text any longer
you can also put the lang abbreviation for highlighting
if (message.content === '++serverinfo') {
let server_name = message.guild.name
let Created_on = message.guild.createdAt
let server_size = message.guild.members.size
message.channel.send('Server : ' + server_name + '\nMembers : ' + server_size + 'Created At :' Created_on)
};
if (message.content === '++avatar') {
message.reply(message.author.avatarURL);
}
});```
oh you did
hm
**if(message.content.startsWith(prefix + "++google")) {
let google = args.slice(1).join('+');
let link = https://www.google.com/search?q= + google;
message.channel.send(link);
}
if(message.content.startsWith(prefix + "++youtube")) {
let youtube = args.slice(1).join('+');
let link = https://www.youtube.com/results?search_query= + youtube;
message.channel.send(link);
}**
is any mistake in this
see the error
Could it be msg instead
Hey Can You Fix ANd Send The Code
you should learn to debug your code yourself
Yes But Please Help
Can you show the rest of your code
still the code is so big
const Discord = require('discord.js');
const bot = new Discord.Client();
bot.on('ready', () => {
console.log("Turning On Bot")
bot.user.setActivity("TESTING", {type: 2});
});
if(message.content.startsWith(prefix + "++google")) {
let google = args.slice(1).join('+');
let link = https://www.google.com/search?q= + google;
message.channel.send(link);
}
if(message.content.startsWith(prefix + "++youtube")) {
let youtube = args.slice(1).join('+');
let link = https://www.youtube.com/results?search_query= + youtube;
message.channel.send(link);
}
created another file
did you define message?
Where are you defining message, though
shivaco
My bot has declined because my bot was offline. Can I post again my bot? And wait for aprovate?
Yes
Ok Thanks
But first, get it online :^)
yes it is online now
You should learn at least basic js https://www.codecademy.com/learn/learn-javascript

shivaco
Yes?
How long will it take to see if you approve me or not?
It usually takes from an hour to one week
๐ฆ
Yes,
@cinder stratus I don't know js myself and I don't intend learning it, so you are on your own until someone who knows js comes here and help ya
That is the reason why my bot never get authorized hmmm
@slender thistle it's hard to say "from an hour to a week" anymore, thanks to the new web mods and how they handle offline bots now
from a minute to 2 days, I'd say now
minute? xd
yea if you are lucky and the queue is empty your bot might get very fast approved/tested
help
im on python
asyncio
whats wrong with this code
it only detects the name,not role
one sec
@client.command(pass_context=True)
async def role(ctx, *, userName: discord.User, role: discord.Role = None):
if role is None:
return await client.say("You haven't specified a role! ")
if role not in ctx.message.server.roles:
return await client.say("That role doesn't exist.")
if role not in ctx.message.author.roles:
await client.add_roles(ctx.userName, role)
return await client.say("{} role has been added to {}.".format(role, ctx.userName.mention))
if role in ctx.user.roles:
await client.remove_roles(ctx.userName, role)
return await client.say("{} role has been removed from {}."
.format(role, ctx.userName.mention))
if i only put username
it says i havent specified a role
and idk how to specify the correct role
because it says
"user <userID> rolename not found"
Probably put role param as a string and use discord.utils.get() on it
And if nothing was found, then output the string var "role"
could you give an example
of how the code would look
im preety bad at programming
just the line that needs to be fixed
async def role(ctx, userName: discord.User, role: str = None):
And docs should have examples on discord.utils.get()
a promise you made was not caching errors or was not in a try catch block, I assume your bot doesn't have message write permission
im still confused
i kinda fixed it
from @client.command(pass_context=True)
async def role(ctx, *, userName: discord.User, role: discord.Role = None):
its not
@client.command(pass_context=True)
async def role(ctx, *, userName: discord.User, role: str = None):
but now what>
its still the exact same
if it's someone else there,my problem is that when i use the command it sees both arguements as 1
the username
the one i put first
if i take out the * after ctx
it says that role doesnt exist
umm what code?
@client.command(pass_context=True)
async def role(ctx, *, userName: discord.User, role: str = None):
it has more to it
this is the part im trying to fix
when i use the command
it says i didnt specify a role
if i specify a role
it takes it as part of username
tbh you don't need to tell python the type
what?
i dont get it
from @client.command(pass_context=True)
async def role(ctx, *, userName: discord.User, role: discord.Role = None):
so this is the same code
oh oh I get it wait
?
i am really confused at this point,i have tried serveal ways
if i remove the * after ctx it says role doesnt exist
what is it
where does it say?
oh
its like
a thing i added
in the code
it sends a message
that the role doesnt exist
or i didnt specify one
if its wrong
@client.command(pass_context=True)
async def role(ctx, *, userName: discord.User, role: discord.Role = None):
if role is None:
return await client.say("You haven't specified a role! ")
if role not in ctx.message.server.roles:
return await client.say("That role doesn't exist.")
if role not in ctx.message.author.roles:
await client.add_roles(ctx.userName, role)
return await client.say("{} role has been added to {}.".format(role, ctx.userName.mention))
if role in ctx.user.roles:
await client.remove_roles(ctx.userName, role)
return await client.say("{} role has been removed from {}."
.format(role, ctx.userName.mention))
full code
oh wait
ctx.message.author needs to change
let me see if i did
it might fix it
lets try
@lyric lotus remove the *
i did
but all it does
is cannot let the role be specified
i put a role
and it cant find it
lets try again
What is your current code
currently
@client.command(pass_context=True)
async def role(ctx, userName: discord.User, role: discord.Role = None):
if role is None:
return await client.say("You haven't specified a role! ")
if role not in ctx.message.server.roles:
return await client.say("That role doesn't exist.")
if role not in ctx.userName.roles:
await client.add_roles(ctx.userName, role)
return await client.say("{} role has been added to {}.".format(role, ctx.userName.mention))
if role in ctx.userName.roles:
await client.remove_roles(ctx.userName, role)
return await client.say("{} role has been removed from {}."
.format(role, ctx.userName.mention))
even if i ping the role
it cant find it
like @rolename
Uhm
ctx.userName?
idk
It is just userName
Remove ctx from there
imstoopid
im new to programming so
And everywhere else where ctx.UserName is a thing

lets try
before it could only give me roles
thats why i changed it
still
same problem
the role doesnt exist
its sth about
either
the 1st line
or the 4th
I am not even sure, maybe replace discord.User with discord.Member
ok
its i think about the 4th line
which says
if role not in ctx.message.server.roles:
return await client.say("That role doesn't exist.")
because it always gets me this result

Probably...
for server_role in ctx.message.server.roles:
if server_role.id == role.id:
# do stuff```
I wish I had my eval command available rn
Well, you can put your stuff under that if statement
Just not the "if role not in ctx.message.server.roles"
hm
let me see
so i put this
over the one which says
hm
if role not in userName.roles
Basically, yeah
ok
And don't forget the indentation
and switch out all ctx.message.server.roles
oh yeah
tab
thing
do i replace those
Replace what
the ctx.message.server.roles
forserver_role
or not
no
i get invalid syntax
awat client.add_roles(userName, role)
await
what
whats wrong with that
hm
oh got it
nop
i didnt
please stop writing like this, thx
so I've realized that "printing ascii characters" issue is not related to python or it's version, but rather an OS, since the same ascii can be easily printed on windows cmd, just not on linux terminal
ok
I don't remember the actual error message, but it's about failing to encode those characters
any ideas?
UnicodeError?
Why is discord api printing: `(node:359) UnhandledPromiseRejectionWarning: DiscordAPIError
at item.request.gen.end (/rbd/pnpm-volume/9fd7e761-dc73-4c63-b85b-3e9e850038ca/node_modules/.registry.npmjs.org/discord.js/11.3.2/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:71:65)
at then (/rbd/pnpm-volume/9fd7e761-dc73-4c63-b85b-3e9e850038ca/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
(node:359) 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: 2)
(node:359) [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.`
missing a .catch
how do i run a file in index? i tried doing ```css
var file = require(./file.js)
file.run(client, message, args)
but then message is undefined
i do that in the client.on('ready', () => event
I mean, you'd need to add quotes around the file name, and have a run function in the file. What does your file.js look like, or whichever?
yea i just wrote that real quick
now not much, but i want to add so that it "remembers to remind" after it has been shut down
i managed to save the info from the reminder in a json file
Just remember JSON can corrupt easily.
can anyone help me with the issue I posted above ๐
ik, but my bot isnt used by anybody so for now thats not an issue ๐
what alternatives are there?
a real Database
SQL or NoSQL
for SQL i would recommend Postgres since its really fast, reliable and low RAM usage aswell as it supports NoSQL types like JSON and Arrays, for NoSQL i know MongoDB or Rethink are common used
Thanks!

I use mysql ๐คท
MySQL is very slow compared to Postgres and has less features while using more ram ๐
but yea
it surely works as DB
so SQL makes like a database?
SQL is a language what is kinda the "Syntax" for working with the Database
SQL ( ( listen) S-Q-L, "sequel"; Structured Query Language) is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS...
๐ค this will be interesting
never done that before ๐
think this is going to help me getting started? https://www.w3schools.com/sql/sql_intro.asp
may i ask what Language do you use for your bot? big languages like js or python have ORM (Object Relational Mapping https://en.wikipedia.org/wiki/Object-relational_mapping) LIbraries for SQL Databases so if you don't wanna learn SQL you could use that instead
i use js
if you use JS and wanna use SQL databases (like Postgres, MySQL or SQLite) then you can try Sequelize (http://docs.sequelizejs.com/)
pretty new to coding in general so my experience is quite limited
oh well yea you wanna take time and look some examples/references up then
take time and experiment a lot thats how you get experience in general for Programming 
and read docs aswell, this helps a lot while developing/testing
personaly, to me SQLite3 looked hard af at first cause of false expectations, but it's way easier than you think xd
๐ thanks for your time! ill work on this ๐

how do i start making a c#/,net database
i saw the js db conversation after i scrolled up but i was wondering how to .net it
first off you dont "make" a database im sure because that would be a lot of work, you maybe wanna use one
and you can use any db what has a library/driver for .Net
ok
but its a library not a ORM like Squelize
ok
means you still need to write your own SQL queries
thats normal, learning always need time
๐
how long does approval normally take?
t i m e
usually about 24 hrs
ok, thanks
well from my expirience
thanks for the info
np ๐
How would one break a forEach loop..
const words = swears.var
const arrays = byp
arg.forEach(arg => {
words.forEach(words => {
gogo(arg, words, arrays, stopped);
})
})```
Its a censor bot and it goes thru an array of words but if their are two words that match it runs "gogo" twice
Id like it to stop once its done it once
switch to a for loop and use the break keyword ๐
Idek how to do that honestly
Cause all of these tutorials show all this crap. but i cant seem to find any that take any use of an array
im still really confused
Are you saying itd be like
for(let i in words) {
gogo(arg, words, arrays, stopped);
}
}```
to break out just put a return after you find a match
also the for in loop only returns keys, not values. you need to access the value on each iteration
if you're using objects
@quartz kindle If i put a return it still keeps going
It stops that one part of the array from forEach
so, im back after a bit, doing some bug fixes and optimization for my bot, the only issue im having is the slowness to "await client.send_message" each lineor that's what i assume it is from because it prints in python console lightning fast; is one of the only ways to make it faster is to do a compressed post instead of each line indivisually?
But continues on the rest of it
what does the gogo function do?
the function is always being fired without any check
do an if arg = word in the second loop to check if there is a swear word in the message
if found: gogo then return
also you need a different pointer in each loop, you cant use i in both of them if you're going to compare them
something like for a in arg for w in words if a === w gogo return
also use toUpperCase() for case insensitive matches
sorry for interrupting, but is embed text the best way to go for posting large datasets?(such as Name. Hobbies, and Description/Bio)
there's no "best way", it simply is the most elegant/beautiful way
specially if you need titles, fields, columns, etc
the only down side of embeds, is that they dont work is the person has embeds turned off
gotcha. i have a program set to scrape data off a website with about 4k lines in that section, and it goes and sifts through each line, sets all the valid lines into list, then makes sed lists available via a search function which returns all the matches and their matches' corresponding columns/data
and it totals to 784 object/ sets of data
but when the search function goes, it takes like 5 minutes just for one search post
5 minutes? thats way too long
even with a data set of about 10mb in size would be searched through in less than a second
ya, in the console it gets done extremely quick, just through the "await client.ssend_message()" function does it take so long
so the problem is when sending the message to discord?
then the problem is with your internet's upload speed / response time
when my bot was self hosted, it would take anywhere from 2 seconds to 15 seconds to send messages
now with a vps all messages take less than 1 second to send
oo
ill definitely note that, it has a decent chance of being the root of the issue, i assumed it was just a limiter set either on the server, the bot, or the program module to limit spam
the only limits discord has are attachment size limit, text character limit, and consecutive messages limit
is your data being sent in only one message or more than one?
yes
every line of each set, with each set having 11 posts
having from 5 to about 30 posts
i mean 5 to 30 sets
so your bot sends 5-30 consecutive messages?
yup
the rate limit is 5 messages per 5 seconds
that would definitly do it
so sending 30 messages will take a minimum of 30 seconds total
thanks for the help, it would try to send around 55 to 330 lines of code per search, so that's 99% the issue, either way, doing each set in an embed post would be much more efficient
try to reduce the amount of data you post, and join it as much as possible in a single message
will do
i mean, considering i learned data scraping yesterday, and discord bot modules today, i couldve done worse xd
good job :D
the main performance bottlenecks are always external data transfers, either network (http requests) or hard disk (loading files)
if you keep those to a minimum, everything else should be fine
๐ก Pong! 778ms.
Oh no
It's coming back
cedric wont stop writing
still writing
Hi, I want to translate my bot in 4 languages, what's the best way to do it plz ? I though about copy my command file (that contain all commands scripts) in 3 other files that will be translated and use the adaptated file by it's language (so 12 commands files in total for normal commands and games commands).
I thing it's a bad solution but the other solution i've found its by using a json where I will put all trads for all commands it will be somethinglike that:
if (msg == "command"){
creating embed
.setAuthor(commandTrans.Author)
.addField(commandtrans.msgtitle, commandtrans.msg, true) } ```
But json files take a little time so, what's is the better solution ? Do you have an alternative ?
database
Yeah writing a lot but it's because i'm not good in english
oh np
https://hastebin.com/uvetaboyet.js
nothing nothing is the issue.
database ? ok i will look for that thx for your ansew
@earnest phoenix, I keep files like lang_en.json, then depending on my servers config setting (en, etc..) I require lang_{langname}.json and use the presets and such.
Do it in differents jsons ? Is that not better to use multiples js files with a translated copy of the original command ?
I would recommend different jsons
oh ? Because it's faster or take less memory ?
Less confusing...
ok then I will do that
Whats wrong with my bot? I installed ffmpeg, though when I try playing music it says cannot find FFMPEG??
@coral lichen, VPS.
did you try restarting your vps
What's this mean? ๐
(node:7955) UnhandledPromiseRejectionWarning: TypeError: fn.bind is not a function
Its erroring w/ that when I try making a channel.
@old swallow have you tried installing the ffmpeg-binaries package
from npm
(if you use d.js/eris)
anyone know how to repeat music with ytdl-core?
?help
Ok i should never do that again
@sick cloud you know what line is causing that error?
@sick cloud are you on master? this was caused in d.js by passing incorrect parameters in collection functions like .filter
for example on master, .filter no longer accepts key, value parameters but a function instead, so calling it the old way would cause the fn.bind error
its thrown as unhandled promise rejection in your case because its coming off a promise or an async function that you're not catching / nor catching rejected promises globally
@sick cloud discord.js master doesnt accept strings for functions like filter anymore
if im trying to get my bot approved, should i be running it constantly?
thats.....a weird question.
are you planning for it to have extensive downtime after getting it approved?
well, more of i was unsure whether i would be running it locally, or it would be run through the coding desc, as well as i was unsure as to whether they tested the bot
essentially just being unsure about the process
coding desc?
Detailed description of your bot *
HTML & Markdown allowed, minimum 300 characters
ok re-reading that, i might just be retarded
it was late, i was coding for the past 8 to 10 hours
i read "html" and said: Welp, ill just copy and paste ma code here

dbl doesn't care about your bot's uptime after it got approved, but it does need to be online while it is being tested by website moderators @flint river
kk ty, and someone said approval process tends to take around 24hr?
well there's a queue of bots that are also waiting for approval
and mods don't get payed for that
they are volunteering
gotcha
on another server your bot gets autokicked if it has a poor uptime
we don't talk about other bot lists
I know just saying
all bot lists have their own rules, and dbl works the way I just described
also a bot that isnt online doesnt make sense to me 
i was originally unsure about how the bot would be host, whether it was locally or i had to run it globally
what you mean with run it globally?
uh, run it locally on my computer, streaming to each bot
specifically this bot list doesn't care about uptime at all, but they do decline bots if they are offline during their testing phase, and you never know when it will be your bot's turn
streaming to each bot I dont get that
maybe iam stooopid
excuse me
nvm I wouldnt use your local pc to host it, maybe some free like glitch.com (not really a long term solution) or a vps (assuming you use node)
ya, that's why i was wondering about runtime(srry if i used incorrect terminology), is skysilk able to host Discord Bot programs/Python Script
discord is an actual vps
if you don't know what vps is you might want to google it
wait
what
I meant skysilk is an actual vps

wasnt it that website you need a cc for verification?
oh, well skysilk is a free host, yet you need to be accepted into their program in order to use it
not a problem with that, but I aint got a cc
what's a cc?
credit card
don't you need that for all vps'?
someone also said I should visit a website with beta free vps, but you needed a cc for verification, but dunno if that was skysilk
sry cc for verification
skysilk is in free beta yes, but you still need a credit card to verify your identity, so like if you use it for illegal shit or something they'll know who to blame
Yes I understand that, iam okay with that, but thats not really an option for me, no cc
but too late anyways, already got a vps and iam good with it
xD
I saw that
No u didnt
Idk what your talking about
does anyone why i'm getting that when i'm installing the dependencies for my bot? I'm on windows.
if it says that i edited "@invalid-user" instead of my bot's name, what does that mean? it hasnt had approval yet or that its approval has been denied?
how can i make my bot make a invite on the servers its on and then send me the invite link
What's wrong?
String.prototype.toAlternatingCase = function () {
tmp = this.toLowerCase(); (this[0] == this[0].toLowerCase() ? i = 1 : i = 0); for(i; i < tmp.length; i = i+2) { tmp = tmp.substr(0,i) + tmp[i].toUpperCase() + tmp.substr(i+1); } return tmp;
}
@flint river it's a discord thing, technically it mentioned your bot but since your client didn't cache data about your bot it says invalid-user instead
@earnest phoenix I would tell you, but I'm afraid it breaks server privacy, and possibly even discord tos
what library?
discord.js
in your library there should be documented how to create an invite to a channel, just loop through all servers and create an invite from each one of them
but don't say I didn't warn you if you get in trouble
@ruby dust can we talk in dms
no thanks, I'd rather keep them locked from randoms
ko
ko
thanks for the help i did it and i got the invite ๐
๐
But im gonna remove the code for it now
can one python file have more than one while loop going on? or should I make separate files for them?
2 different uses
like I currently have 1 loop to post server count on 2 different sites
and I kinda want to separate them
Why seperate them
Because I don't know python that well and I'm not sure if u can have 2 at once
But if u want it to run under different conditions
you could do smth like
while True:
if condition1
//Whatever
if condition2
//Whatever
It would be in the same loop but different conditions
I don't need ifs 
the fact that I'm opening an aiohttp session, I can't use it again to post another server count stat even if I close it
so I have to wait at least 10-15 seconds and open it again
so I need 2 different loops
@jolly mist are you trying to dO tHiS?
note that whatever that code is supposed to do is creating globals
you don't want globals
yo, how would I like add two files together? so in my index.js it would be ``` const discord = require('discord.js');
require('dotenv').config()
const token = process.env.botToken;
const prefix = "s!";
const cmds = require("./commands.js");
var client = new discord.Client();
client.on('ready', function(message) {
});
client.on('message', function(message) {
if(message.author.equals(client.user)) return;
if(!message.content.startsWith(prefix)) return;
switch (args[0].toLowerCase()) {
case "help":
//send help command from cmds ("./commands.js")
break;
}
});
client.login(token) ```
@uncut slate no
so what are you trying to do
Just a bot for discord
@ruby dust if you still have the issue, you could do 2 or 3 programs, with either a parent program starting 2 different child programs, each with a while loop, or 1 parent with 1 while that spawned another child with a while (before it initiated its own while ofcourse)
hey,so i made a command where i used a loop, is there a way to make a command that stops the same loop in js?
i use a var x = setInterval(function() { loop
clearInterval(x) ?
yea, but i want to make it do that on demand
so if i do -command stop
it does clearInterval(x)
@Rubikscraft#4079
@sour perch you'd have to store a reference to the interval
e.g.
let interval;
exports.run = function someCommand (client, msg, args) {
switch (args[0]) {
case 'start':
interval = setInterval(() => console.log('hi!'), 1000);
return 'I started';
case 'stop':
clearInterval(interval);
return 'I stopped';
}
}
if (message.content.startsWith('ยฟCรณmo hago un rol?')) {
message.channel.send({embed: {
color: 0x8dff94,
description: "๐ Buscando pregunta"
}})
setInterval({ m.edit(
({embed: {
color: 0x8dff94,
description: "Ajustes del servidor -> Roles -> Dar click en el signo de `+`"
}})
)}), 2000);
Unexpected token . (in m.edit)
so i put that in an own file or add it to the command with the loop? @uncut slate
that's nothing more than an example for you to understand and adapt
do you have seperate files for all of your commands or is it all just bunched up in one file?
show me the simplest one
module.exports.run = async (client, message, args) => {
if (!args || args < 1)return message.channel.send('Just type your suggestion here and it will be sent to the devs :smile:');
message.reply('Your suggestion was sent to the Developers, Thank you! if you want updates on your suggestion, join our devserver')
const Discord = require('discord.js')
const embed = new Discord.MessageEmbed()
.setColor(746215)
.setFooter(`ยฉR3mind3r by Hab, Suggestion by ${message.author.tag} `, 'https://i.imgur.com/GH1Omx2.png')
.setTimestamp()
.setThumbnail(message.guild.iconURL())
.addField(`Server: ${message.guild.name}`, args.join(" "), true)
client.channels.get("454242855179780096").send({embed})
console.log(`${message.author.tag} Sent a suggestion!`)
}
idk if its the simplest, but i just picked it
why do I feel like you either poorly copied the code or it's actually a bad code
you somehow made your variables into strings, and strings into variables
No one answered my question xd
what do you mean my variables are strings?
module.exports.run = async (client, message, args) => {
if (!args || args < 1)return message.channel.send('Just type your suggestion here and it will be sent to the devs :smile:');
message.reply('Your suggestion was sent to the Developers, Thank you! if you want updates on your suggestion, join our devserver')
const Discord = require('discord.js')
const embed = new Discord.MessageEmbed()
.setColor(746215)
.setFooter(`ยฉR3mind3r by Hab, Suggestion by ${message.author.tag} `, 'https://i.imgur.com/GH1Omx2.png')
.setTimestamp()
.setThumbnail(message.guild.iconURL())
.addField(`Server: ${message.guild.name}`, args.join(" "), true)
client.channels.get("454242855179780096").send({embed})
console.log(`${message.author.tag} Sent a suggestion!`)
}
thats the right markdown
oh yes
yeah
so like
module.exports.run is a function
the bit of code inside of the function is what gets ran whenever someone runs the command
you understand so far?
yea
so, code that's outside of that function is NOT ran whenever someone runs the command
that's where you can store references
play around with this:
let counter = 0;
module.exports.run = async (client, message, args) {
msg.channel.send(counter.toString());
counter++;
}
and you'll see that the counter variable is "shared" and gets increased every time you run the command
ok, thanks
just like the counter, you can store an interval variable outside of the function
but how do i run it when someone does another command then?
well, they dont have to. do they?
if you have a command structure where one file = one command and you're talking about two different commands, they will be in seperate files
if you're talking about the same command with different arguments, like my first example, they can be in one file
Good developer :pat:
No both of us
help
every time i use a command
it puts here the command i used
and i want to remove that
What lib
python
e = discord.Embed()
e.set_author(name="Add HQ|Music", url="https://discordapp.com/oauth2/authorize?client_id=467400879763357697&scope=bot&permissions=70380544")
e.colour = 638064
e.set_footer(text='HQ|Music|[v{}]'.format(BOTVERSION), icon_url='https://cdn.discordapp.com/attachments/467402459946680330/467402502334054410/NEWMUSIC-BOT-LOGO-3.gif')
return e```
thats my embed
mention me when you got an answer
I donโt have one
the help is being set somewhere else, not in that code
i will double check then
So you know how some bots give you something when you upvote. Pokecord given you credits when you upvote, but it's not working for someone.
can you elaborate on that? What do you mean?
Well, when upvote the bot, youd type in a command and get credits. But it's not working. They upvote, it says thank you, but the bot seems to think they didn't. They tried voting again, it said come back in 24 hours. They've tried logging in and out, but that's about it. they don't have other devices
if its an issue with a specific bot, you have to contact the bot developer or their support server
They said it was something the developer couldn't control
And to contact discord bots
then the developer should be the one to seek help here
most likely he needs to change some code in his bot
Okay, I'll see into it
It's not a thing that happens to everyone, just this one person
Hey, so I'm able to do basic discord features such as message.channel.send but using embeds and other things I get an error saying client is undefined, and yes it is defined in my main js file.
const Discord = require('discord.js');
exports.run = (client, message, args) => {
const myEmbed = new Discord.RichEmbed()
.setTitle(`${message.guild.name} Info`)
.setColor("#C61E84")
.setDescription(`unfinished`)
.addField("unfinished")
message.channel.send({ embed: myEmbed });
}
can you send how you defined client in you main js file? dont have to send all you code, just the client const
const client = new Discord.Client();
In the file with your embed, define your client under Discord
You cannot declare a variable that is in another file I believe, I mean, every time I have done that it hasn't worked
lmao
@restive silo hi, can you explain something to me.
oh probably asleep
big rip
Am I missing something insane and simple?? Because it seems that I'm looing at stats.clusters so how is it undefined
**bot.on('ready', () => {
console.log("Turning On Bot");
bot.user.setActivity("TESTING", {type: 2});
})
bot.on('message', function (message) {
const args = message.content.slice(prefix.length).trim().split(/ +/g);
client.on("guildMemberAdd", (member) => {
const guild = member.guild;
if (!newUsers[guild.id]) newUsers[guild.id] = new Discord.Collection();
newUsers[guild.id].set(member.id, member.user);
if (newUsers[guild.id].size > 10) {
const userlist = newUsers[guild.id].map(u => u.toString()).join(" ");
guild.channels.get(guild.id).send("Welcome our new users!\n" + userlist);
newUsers[guild.id].clear();
}
})
client.on("guildMemberRemove", (member) => {
const guild = member.guild;
if (newUsers[guild.id].has(member.id)) newUsers.delete(member.id);
});**
is any mistake of
hey help
@keen anvil Maybe try using stats["clusters"] ?
@cinder stratus error?
if(message.content.startsWith(prefix + "help")) {
message.channel.send({embed: {
color: 3447003,
author:
"name" (client.user.username)
"icon_url" (client.user.avatarURL)
}
title: "My Commands Are",
description: "This Is The Commands Of LITHIUM Bot.",
fields: [{
'name': "++serverinfo",
'value': "By These Command You Can Get Info About Your Server."
},
{
'name': "++avatar",
'value': "By These Command You Can See Your Profile Picture ."
},
{
'name': "++invite",
'value': "By These Command You Can Join The Support Server Of LITHIUM."
},
{
'name': "++youtube",
'value': "By These Command You Can Search Anything On Youtube."
},
],
timestamp: new Date(),
footer: {
icon_url: client.user.avatarURL,
text: "ยฉ LITHIUM"
}
}
});
'name': "++invite",
'value': "By These Command You Can Join The Support Server Of LITHIUM."
},
{
'name': "++youtube",
'value': "By These Command You Can Search Anything On Youtube."
},
],
timestamp: new Date(),
footer: {
icon_url: client.user.avatarURL,
text: "ยฉ LITHIUM"
}
}
});
see this
leave that
for this code error is error is unexpected end of input
It means your missing a ) or } or such somewhere in your code usually.
@keen anvil no i actuall dont know why that would ever happen, and yea sorry was sleeping

Does anyone have any experience with Level/LevelDB?
Is it against TOS to have a chat logger if the server owner specifies to log their chat and dump it at a later date?
if you are about to log these events in a private channel it's fine, but if you want log onto your machine then make sure you either keep the database as secure as possible or encrypt it so no one can read it
@sick cloud a little, whats up
why do bots message me 24/7
What bot messaged you?
i think i will need a multiple command in one file, (in file serverinfo) and examples server emojis but idk how ๐น
any example for me?
4 bots from a different discord
owo
there's no way 4 users would be online at the same time, play the same "game" (link) and message me at the same time\
there was this bot messaged me out of no where.
like... just messaged me saying "ez"
checked mutual server... but no mutual servers with it. :/
@prisma bluff a bot bot had a bot tag
obviously
bot bots don't show mutal guilds
lmao
async def cmd_clear(self, player, author, server): await self.disconnect_voice_client(server) player.playlist.clear() return Response("test")
Code
# find channel to send welcome message too
async def find_channel(server):
for c in server.channels:
if not c.permissions_for(server.me).send_messages:
continue
return c
# server join handler
@bot.event
async def on_server_join(server):
channel = await find_channel(server)
embed=discord.Embed(title="Hi, I'm Arc", description="Thanks for inviting me. If you need help with anything, [join here](https://discord.gg/) and for the command list, [check here](https://gitlab.com/Joshek/discordarc/blob/master/commands.md). Hope you enjoy using me!", color=0x176cd5)
await bot.send_message(channel, embed=embed)
Error
Ignoring exception in on_server_join
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/discord/client.py", line 307, in _run_event
yield from getattr(self, event)(*args, **kwargs)
File "bot.py", line 661, in on_server_join
await bot.send_message(channel, embed=embed)
File "/usr/local/lib/python3.6/site-packages/discord/client.py", line 1152, in send_message
data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
File "/usr/local/lib/python3.6/site-packages/discord/http.py", line 200, in request
raise HTTPException(r, data)
discord.errors.HTTPException: BAD REQUEST (status code: 400): Cannot send messages in a non-text channel```
why
ah crap
^^ toxic
Didn't mean to do it on purpose
Anyway
Can't define text_channels so I'm not sure how I'll find the default channel.
The server I tested on's hierachy only has text channels too.
I posted my bots code and it had the support server invite embedded.
And discord sends invite embeds even if it's in a block.
ooooooh i thought you put it in there
that's fine
Which I completely overlooked
i think
async def cmd_clear(self, player, author, server): await self.disconnect_voice_client(server) player.playlist.clear() return Response("test") shouldnt this work???????????????
i dont get an error message
tho
but it doesnt work
it does disconnect
but it doesnt clear the playlist
When adding a detected description for a bot on discordbots.org - is it possible to include stylesheets from an alternative source?
If linking a stylesheet is not permitted, mind me asking why? <@&264889767072628742>
You did not have to mention all of us
you don't haev to ping every web mod
@earnest phoenix it is possible?
I'm unsure, that's why I'm asking the team.
You can also just ask one of them
My bad for mentioning the whole crew ๐ฎ
So, is that a yes or no to allowing external stylesheets?
Should probably work, otherwise you can just copy paste it in to a style tag
Will do, thank you. @native narwhal
@earnest phoenix Check your terminal

Add an if s.type is discord.ChannelType.text: or if isinstance(s, discord.ChannelType.text):
The bot is most likely grabbing a voice channel

Try print(c) and see what you really are getting
okay
It could somehow be a category (but I doubt since async doesn't support those, I guess?)
Np
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/discord/client.py", line 307, in _run_event
yield from getattr(self, event)(*args, **kwargs)
File "bot.py", line 663, in on_server_join
await bot.send_message(channel, embed=embed)
File "/usr/local/lib/python3.6/site-packages/discord/client.py", line 1152, in send_message
data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
File "/usr/local/lib/python3.6/site-packages/discord/http.py", line 200, in request
raise HTTPException(r, data)
discord.errors.HTTPException: BAD REQUEST (status code: 400): Cannot send messages in a non-text channel```
Didn't print
Must be fidning catergories
Lemme try delete them
Aha, sent now
Was an issue with the catergories
@slender thistle thanks for helping
๐
can someone tell me a good guide to start with image modification in node?
Iam okay with node,but never did image modifications
How can you set custom statuses like this?
Your library should be providing it
@waxen quest on node its:
client.user.setActivity( "Thats custom", {
type: "WATCHING"
});
Thank you
just use setPresence instead
"status": "online",
"game": {
"name": "Discord API"
}})```
this is for nodejs
using djs
"game" cough https://big.animetitti.es/i/m8q.png cough
Yea, need to use setActivity for that, sorry.
hi, so i made a command that use a loop, and i want to make people able to stop that loop by doing for example -command stop, so i did this:
let interval;
exports.run = async (client, message, args) => {
switch (args[0]) {
case 'start':
interval = setInterval(() => console.log('hi!'), 1000);
console.log('I started');
case 'stop':
clearInterval(interval);
console.log('I stopped');
}
}
but it only returns 'i started' then right after 'i stopped'
never mentions 'hi!'
i got this from someone here yesterday
Don't take code from here then?
i changed some off it though
this is the original XD ```js
let interval;
exports.run = function someCommand (client, msg, args) {
switch (args[0]) {
case 'start':
interval = setInterval(() => console.log('hi!'), 1000);
return 'I started';
case 'stop':
clearInterval(interval);
return 'I stopped';
}
}
I don't do d.js or eris or whatever lang, so I can't help.
Ooh
body {
background: url("https://i.giphy.com/media/6R3boOvvH0IMw/giphy.webp") no-repeat;
background-size: auto;
}
.bot-description {
color: white;
}
.is-flex {
color: grey;
}
.lib {
color: grey;
}
</style>```
Any idea why this is only changing the bot description?
is-flex is another classs
class*
open it in the element inspector


