#development
1 messages · Page 538 of 1
async def on_ready():
print("The bot is ready!")
await client.change_presence(game=discord.Game(name="Making a bot"))@client.event
async def on_message(message):
if message.author == client.user:
return```
I think...
wait
it says message is not defined
Sucks
Learn programming
I'm not going to spoon feed you
That was typed on a 5-year-old phone,
it is probs wrong.
The idea is you get the general gist.
So
is !d music help more intuitive than !d help music
in order to get the help of the music module
life is a lie
your command structure won't matter in 20 years
do what you want
but yes
help should be after
How would I grab new YouTube Uploads from a specific youtuber using Webhooks? I'm not familiar with using Webhooks
oof
pls rich
no u
kkk
no
god dayum
How would I grab new YouTube Uploads from a specific youtuber using Webhooks? I'm not familiar with using Webhooks
PING ME WHEN YOU RESPOND! JavaScript btw
you develop a bot
once its approved you will prob get a role
Luca will tell you if your bot has been approved
K
Does anyone have any alternatives for glitch.com?
money
no i mean like hosting softwares.
a vps
WHERE DO I FIND A GOOD VPS
exacly my point
POLL (sorry spooder lmao and c)
I need a name for my dictionary bot (dont steal me idea)
- Words
- Dictionary
- Word Bot
- Dictionary Bot
- Word Definitions
@raven bronze https://silkyservers.com/
I use their more expensive plans, but they have very cheap vps's
hi does any one know how to set up a music command in discord.js ?
how about no
ok we dont need to be rude about it
thx
yw
jmusicbot isn't even js
i just now relized that im an idiot
This includes music commands
So its not fully spoonfed
thx rain
np
https://i.imgur.com/DibhAU6.png for all scala /java devs. is there any better way of doing this?
(JDBC)
I mean it looks fucking disgusting and I have 0 intention of using an ORM or an alternative that uses jdbc
How do I force discordjs to get the textchannel instead of the guildchannel so i can reliably access msg.channel.topic
@high anchor from message? from what?
TypeError: Cannot set property 'random' of undefined anyone know why i would be getting this
facts.random = () -> @facts[Math.floor(Math.random * api.facts.length)]
coffeescript btw
noitsnot
send full code then
@spring ember try with resources
Scala
actually

UPD: Apparently, in top 5 results from Google, there are no correct examples, changed text accordingly.
you could probably make a macro to defer closing to the end of a block
though i just got it from the dev page
now it's this https://i.imgur.com/jfzkyyZ.png
but it somehow thinks it's not infered
I am not sure why
nvm
I changed it to return 0
it's wierd because Scala usually does use the last value as return
scala has non local return
i'd get rid of those returns
using(rs) { if(rs.next()) rs.getInt("totalvotes") else 0 }```
sexy
thanks
Natan also finally defers that's why people usually use it
it always executes after the try block closes
and before the next block begins
like Java
@inner jewel it doesn't accept without returning explicitly
super wierd
especially that the other usings return on last value
I KNOW
add an overload with f: () => B
because that's the type of the closure you pass to using(rs)
or you couldscala using(stmt.executeQuery()) { rs => if(rs.next()) rs.getInt("totalvotes") else 0 }
it'd be possible to defer closing with implicits but that'd be a bit more complicated
would lead to somewhat cleaner code
it's closeup
how do you add a ban command to your bot in python?
closing { (implicit c: CloseContext) =>
val conn = deferClose(pool.getConnection())
val stmt = deferClose(conn.prepareStatement("..."))
stmt.setInt(...)
val rs = deferClose(stmt.executeQuery())
if(rs.next()) rs.getInt(...) else 0
}```
anyone want to tell @earnest phoenix wrong channel?
if you made it a macro you could find AutoCloseable subtypes based on static analysis
but that's complex
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = bot.guilds.size;
</script>
why its not work?
How should I do this work?
are you sure bot is defined
<p id="demo"></p>
<script>
var bot = new Discord.Client();
document.getElementById("demo").innerHTML = bot.guilds.size;
</script>
its not work also this way
ho
and i dont know about you, but i wouldnt want my token to be literally available in the source of my website
<p id="demo"></p>
<script>
var bot = new Discord.Client();
document.getElementById("demo").innerHTML = bot.guilds.size;
bot.login(process.env.TOKEN);
</script>
i think you should login before you request the guild size
ok
<p id="demo"></p>
<script>
var bot = new Discord.Client();
bot.login(process.env.TOKEN);
document.getElementById("demo").innerHTML = bot.guilds.size;
</script>
its not work
hm
where its need to be?
why are you making a javascript bot using script tags in HTML
people can take your token from that you know
thats what i said earlier
and it basically makes the bot start a new instance every time the website is visited
i got this unban script for python but it says self is not defined
coffee.on("guildCreate", guild => {
coffee.editStatus({name: `Brewing Coffee in ${coffee.guilds.size} servers! @Coffee#3719 for help`})
coffee.channels.get("523824132492886034").createMessage(`📥 Joined a new server called ${guild.name} (${guild.id}). Member count: ${guild.members.filter(m => !m.user.bot).size}/${guild.members.filter(m => m.user.bot).size} (Users/Bots)`)
})
``` hi this piece of code isnt working i dont know why
anyone can say why it wouldnt be working
d.js?
what exactly isn't working?
does discord.py's AutoShardedBot object share the same guild/user caches from all shards?
how do you turn off @everyone when making a bot
@spring ember i resolved the issue, the scope wasn’t passing to the promise correctly for some reason lol
lol
anyone know why this would be undefined https://skullbite.is-for.me/i/gpyk8qng.png
also this is "js" if you cant tell
its actually coffeescript but who cares
props.file = f
@commands.set [props.info.name, props]
props.settings.aliases.forEach (a) ->
@aliases.set [a, props.info.name]
loggr.info "#{f.slice(0, -3)} has finished loading!"
^ in jsjs props.file = f this.commands.set(props.info.name, props) props.settings.aliases.forEach(a => { this.aliases.set(a, props.info.name) }) loggr.info(`${f.slice(0, -3)} has finished loading!`)
i dont know???
can you compile it
coffee --compile dir
does it compile everything
check rpc
ok i compiled it
show js
uh
props.file = f;
this.commands.set([props.info.name, props]);
props.settings.aliases.forEach(function(a) {
return this.aliases.set([a, props.info.name]);
});
return loggr.info(`${f.slice(0, -3)} has finished loading!`);
E
hastebin
can i just post the loadcommands func
this.loadCommands = function() {
return fs.readdir("./commands/", function(err, cmds) {
if (cmds.length === 0) {
loggr.info("There are no commands to load!");
}
if (err) {
throw err;
}
return cmds.forEach(function(f) {
var props;
props = require(`../../commands/${f}`);
if (props.settings.disabled) {
loggr.info(`${f.slice(0, -3)} has been disabled, reason: ${props.settings.disabled.reason}`);
props.file = f;
this.commands.set([props.info.name, props]);
return props.settings.aliases.forEach(a)(function() {
return this.aliases.set([a, props.info.name]);
});
} else {
props.file = f;
this.commands.set([props.info.name, props]);
props.settings.aliases.forEach(function(a) {
return this.aliases.set([a, props.info.name]);
});
return loggr.info(`${f.slice(0, -3)} has finished loading!`);
}
});
});
};
cmds.forEach(function(f) {
thats weird
use an arrow or store this outside of your scope
why can't you use an arrow
Does anyone know how to use a embed without colors, i have seen it before.
...
@knotty steeple yeah that 100% worked, no its still bad tho
you said no color?
yes
thats no color
no strip of color on the side*
yes that works quite well thanks
np
You can't remove the color 😂
You're just making it look the same
Which that method is already fucked if they use light theme instead of dark
^
Or if they use client mods 👀
👀
also the left corners will be sharp
..
thats a codeblock not an embed
h
oh
sorry
i was just scrolling trying to find one and my brain thought that was an embed
lol
I wonder how many bots directly interact with the Discord API instead of through a library
Stupid question
At that point you’d just build your own lib/interface 
@high anchor its pretty simple to do, gateway connection, identify, etc. but its painful and i bet no public bots directly interact
it's not exactly simple
connecting is, but doing anything more gets complicated very quickly
eg properly handling rest ratelimits, calculating permissions, keeping a cache
prolog
that probably goes in #memes-and-media
@lilac grail use css
my eyes
events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::5000
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at Server.setupListenHandle [as _listen2] (net.js:1367:14)
at listenInCluster (net.js:1408:12)
at Server.listen (net.js:1492:7)
at DBLWebhook._startWebhook (/home/ubuntu/bot/node_modules/dblapi.js/src/webhook.js:45:18)
at new DBLWebhook (/home/ubuntu/bot/node_modules/dblapi.js/src/webhook.js:27:12)
at new DBLAPI (/home/ubuntu/bot/node_modules/dblapi.js/src/index.js:69:22)
at Object.<anonymous> (/home/ubuntu/bot/HALOindex.js:14:13)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
anyone?
what do you mean how?
uhm... you add css in your html description
tutorial?
i would like a way to get a random word from the english disctionnary
no need of the definition or anything like that just a random word
with if possible a way to specifie filter like length and if i want a word splitted with -
do you know any ?
get a array of words and pick a random one
i guess yeah
its exists fornat?
moment.duration(ms(args[1])).format("ms [miliseconds]")
what is the rate limit for editing messages (in different channels)
Well if it’s 5/5 in one channel then it’d be 50/10 across guilds I guess? I guess it’s the same as the normal message send? Idrk tho that answer is dependent on @lament meteor’s answer @mossy vine
Oh yeah it is 50/10 global
However I’m pretty sure that it’s only 5/5 per server so therefore you’ll still be stuck at 5/5 if the channels are in the same guild??
Maybe? Not sure tho
global is 50/1
ratelimits are per channel for messages
5/5s
Step up your game with a modern voice & text chat app. Crystal clear voice, multiple server and channel support, mobile apps, and more. Get your free server now!
so i can edit a message once every second, correct?
you can, but shouldn't for long periods of time
if it's eg, 5 edits then you'll be fine
but even if you stay inside the ratelimits it can still be api spam
oh, so its better to just send new messages instead of editing one?
hmm, i guess ill try achieveing a similar effect with a different method then
thanks for helping
How i make that everyone can use my bot, i use .js
anyone willing to help me code my bot so it works better i dont really get javascript
im a coding novice
Um
um what
if you mean "help me code my bot" as in "code my bot for me", then no
no no i need some help
then explain exactly what you need and post the code in question
nice token
with code blocks please
this is my bot rn
and you just hacked yourself
wait what hte actual fuck is that code lmaooo
you posted your token, which will give anyone access to your bot
i suggest you go to back to the discord app page and reset it
^
`const Discord = require ('discord.js')
const bot = new Discord.Client();
const TOKEN = 'insert token'
bot.on('message', function(message){
if(message.content == 'kys')
{
message.reply('No u');
}
})
bot.on('message', function(message){
if(message.content == 'gay')
{
message.reply('No u');
}
});
bot.login(TOKEN);`
triple `
like i said coding novice
so whats your issue?
like this
yes
also, dont repeat bot.on("message..."
use it only once, and put all your commands inside it
else you're making your bot do double the work
and after 11 of those d.js will go crazy
you have 2 event listeners when you could have just 1
const bot = new Discord.Client();
const TOKEN = '*token*'
bot.on('message', function(message){
if(message.content == 'kys')
{
message.reply('No u');
}
})
function(message){
if(message.content == 'gay')
{
message.reply('No u');
}
});
bot.login(TOKEN);``` so like this?
dont repeat function either
k
let me try to explain
i only realy know a bit of html so coding novice
bot.on("event",function)
^ listen to bot
^what to listen to
^what to do when you hear something```
function(arguments){code}
^ function block
^ things to send into the function
^the function itself```
bot.on("message",function(){ your code goes here. ALL of it })```
🤔
bot.on("message",function(){
you can also do like this, doesnt matter
})
is there also a way to detect a single word in a whole sentence
yes
so...
what way?
if(message.content == 'kys')
{
message.reply('No u');
if(message.content == 'gay')
{
message.reply('No u');
}
});
bot.login(TOKEN);```
i got this now it good?
it still doesn't work
nou

What's up?
whot u got?
const bot = new Discord.Client();
const TOKEN = '*token*'
bot.on('message', function(message){
if(message.content == 'kys')
{
message.reply('No u');
}
if(message.content == 'gay')
{
message.reply('No u');
}
});
bot.login(TOKEN);```
any error message?
nope
You're gonna have to reset your token now sir
the other one wokrk just fine though
Try doing 3 = instead of two of them
add this to your code js bot.on("ready",function(){ console.log("ok") })
You deleted the message but multiple bots logged your token in #265156361791209475 just saying..
And instead of function do async
why is every bot logging messages wtf
Cause they were design to
const bot = new Discord.Client();
const TOKEN = '*token*'
bot.on('message', async(message){
if(message.content == 'kys')
{
message.reply('No u');
}
if(message.content == 'gay')
{
message.reply('No u');
}
});
bot.on("ready",async(){
console.log("ok")
})
bot.login(TOKEN);``` like this
Close
It's a worth a shot to use async
@latent sleet you should change your bot token
async works like this
ill just change it back nw
function() {} //normal function
async function() {} //async function```
but you dont need async
Also isn't J's need === to exactly equal to something?
refreshed the token
Instead of ==
Yes
And seen as a good practise
He should also combine those 2 if's
And just use an or
||
Yes
const bot = new Discord.Client();
const TOKEN = '*token*'
bot.on('message', function(message){
if(message.content == 'kys')
{
message.reply('No u');
}
if(message.content == 'gay')
{
message.reply('No u');
}
});
bot.on("ready",function(){
console.log("ok")
})
bot.login(TOKEN);```
remove an if?
Why is the ready event last?
alright, run the bot, and check if you get "ok" in your console
The order doesn't matter koreanpanda
I mean it works, but why last
the order of events doesnt matter
I know that, but it's more sense if its first
at WebSocketConnection.client.ws.connection.once.event (C:\Users\bartw\Desktop\testbot\node_modules\discord.js\src\client\ClientManager.js:48:41)
at Object.onceWrapper (events.js:277:13)
at WebSocketConnection.emit (events.js:189:13)
at WebSocketConnection.onClose (C:\Users\bartw\Desktop\testbot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:390:10)
at WebSocket.onClose (C:\Users\bartw\Desktop\testbot\node_modules\ws\lib\event-target.js:124:16)
at WebSocket.emit (events.js:189:13)
at _receiver.cleanup (C:\Users\bartw\Desktop\testbot\node_modules\ws\lib\websocket.js:220:12)
at Receiver.cleanup (C:\Users\bartw\Desktop\testbot\node_modules\ws\lib\receiver.js:535:15)
at WebSocket.finalize (C:\Users\bartw\Desktop\testbot\node_modules\ws\lib\websocket.js:206:20)
at TLSSocket.emit (events.js:194:15)
(node:69416) 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:69416) [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.
PS C:\Users\bartw\Desktop\testbot>```
Oof
make sure you changed it in your code as well, after you reset it in discord
i did copy it after i changed it
imho its better to have the less important but necessary parts on the bottom (ready, login, etc.) and important parts (require, functions, etc.) on the top
;-;
Yes
Use command handlers
In your main file
???
But you want it to make sense
😂
;-;
i literetly started today
It's all good
@latent sleet try reseting the token again, and copy/pasting it again, make sure you save your code, and try running it again. it should say "ok" in your console
This literally happen to me the first day I did this
(node:72544) UnhandledPromiseRejectionWarning: Error: Incorrect login details were provided.
at WebSocketConnection.client.ws.connection.once.event (C:\Users\bartw\Desktop\testbot\node_modules\discord.js\src\client\ClientManager.js:48:41)
at Object.onceWrapper (events.js:277:13)
at WebSocketConnection.emit (events.js:189:13)
at WebSocketConnection.onClose (C:\Users\bartw\Desktop\testbot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:390:10)
at WebSocket.onClose (C:\Users\bartw\Desktop\testbot\node_modules\ws\lib\event-target.js:124:16)
at WebSocket.emit (events.js:189:13)
at _receiver.cleanup (C:\Users\bartw\Desktop\testbot\node_modules\ws\lib\websocket.js:220:12)
at Receiver.cleanup (C:\Users\bartw\Desktop\testbot\node_modules\ws\lib\receiver.js:535:15)
at WebSocket.finalize (C:\Users\bartw\Desktop\testbot\node_modules\ws\lib\websocket.js:206:20)
at TLSSocket.emit (events.js:194:15)
(node:72544) 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:72544) [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.
PS C:\Users\bartw\Desktop\testbot>```
I want to say you were watching a tutorial, I want to say threebrow, but it's not
im tryng
Ummmmmm...I would suggest you watch source code, he will most likely help you a ton
are you guys on tomorrow?
im in Central European Time
of...
Us
its still urly for you huh
It's only 1:16 pm for me
well im going to sleep thanks for the help i wil be back tommorow i wil try to lear via youtube
Ok
is it possible to have a python file literally just open another python file, and if so, how?
@earnest phoenix execfile('file.py')
Or import filename
Execfile is really easy to be hacked
I suggest using import filename @earnest phoenix if this is what you mean by open...
I don’t believe it’s possible for a file to be able to physically open another
@earnest phoenix how does it allow you to be hacked?
im just trying to get my discord bot to run another version of itself
It is just the most vulnerable way of opening a file
@earnest phoenix so shards?
Explain in more detail
What exactly do you want to do
im trying to have my bot restart itself
close itself and open another version
so when im not home i can just type a command if something messes u
up
Hmmmm
It’s not possible I don’t think
fr ?
damn
You as a human have to open the file
The python script can’t
is there any languages that can do that
Erm
Setup a 24/7 host
they all cost money tho
plus thats not my issue
Not if you use https://glitch.com
sometimes it just randomly fucks up, but the whole bot never crashes
@earnest phoenix then your command has an error
well no
its just people spamming it too quickly
i need to make some sort of cooldown
some guy used the music commands a bunch and broke the queue
Use JavaScript it’s much simpler
welp i dont know javascript
guess i could learn
just use whatever you want to use
Then your kinda screwed about a free host
@west raptor
Is there any free python hosts?
heroku works although its a pain in the ass and you cant use local dbs
But if you follow a few tutorials I guess your fine
But I don’t believe heroku is 24/7
Is it?
it is afaik besides a few down times
ok
i am a noob and apparently dont know how to code yet...
and no one will teach me
so do you think that an online course would work?
oh i am in development
@unique dock what language?
@unique dock https://anidiots.guide/
idk what language
that is not what i said but ok
ik that
- Pick a coding language
- Learn a coding language
ok
lol
anyway idk why but aliases for commands arn't working in discord.js. Ik this is the problem code do everything else logging properly etc, and commands now being able to be used in anyway.
let cmds = client.commands.get(cmd.slice(prefix.length)) || client.commands.get(client.aliases.get(cmd.slice(prefix.length)));
if (cmds) {
cmds.run(client, message, args, setting, prefix, loadCommands); //checks if command is real, runs said command if so
};```
no errors anything. if I'm being stupid feel free to yell at me
What is loadCommands
Hey there fams, if anyone is familiar with rythm and when it joins it sends a message instantly, how would i do that for my bot? Its starting to get up there with the servers so im just trying to make it more advanced
what language and lib
FYI sending a message on join is generally considered to be annoying
Im confused I am trying to make my bot print out images in JS and this is the error I get
0|DameBot | ReferenceError: Invalid left-hand side in assignment
0|DameBot | at Client.bot.on.message (/home/pi/JSBot/index.js:134:36)
0|DameBot | at Client.emit (events.js:187:15)
0|DameBot | at MessageCreateHandler.handle (/home/pi/JSBot/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
0|DameBot | at WebSocketPacketManager.handle (/home/pi/JSBot/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65)
0|DameBot | at WebSocketConnection.onPacket (/home/pi/JSBot/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
0|DameBot | at WebSocketConnection.onMessage (/home/pi/JSBot/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
0|DameBot | at WebSocket.onMessage (/home/pi/JSBot/node_modules/ws/lib/event-target.js:120:16)
0|DameBot | at WebSocket.emit (events.js:182:13)
0|DameBot | at Receiver._receiver.onmessage (/home/pi/JSBot/node_modules/ws/lib/websocket.js:137:47)
0|DameBot | at Receiver.dataMessage (/home/pi/JSBot/node_modules/ws/lib/receiver.js:409:14)
@earnest phoenix its already telling you which file and line that the error is coming from
index.js:134:36
events.js:187:15
Lol
I had them on my windows pc
So I reset my bot and it does this constantly
Fix it
if(msg.author.bot) return;
if (msg) return; 
how can i cancell(stop) ffmpegs '''ffmpeg.outputstream.base.stream'''
cause when i copy from ffmpegs output stream to discord stream i have to await
what
and when a user want to play another somg i have to stop the last one
thats the problem
what language
CancellationToken then
im doing something tje wrong wY
i cant use cancelation token
with copyasync method
theres nothing liek that avaliable
any links?
Pretty sure you can
i just noticed that you dont have to create mute role for an mute command 
yeah, but it's muting for voice only
no text muting
in an extra thread so it does not effect the bot performance
but it doesnt look good on channel perms client-side
or are you able to delete perm overrides?
idk i try
How would I make a snipe command?
well first u need to try it out yourself
ig u use a cache is the best idea
@wispy jay yes you can delete perm overrides
how @modest shore
@wispy jay for me in discord.js i just have to loop trough each text channel and get the collection of permissions overrides in the channel then use get(member.id) and delete it
np
what permission a bot need in order to add role to a user?
ManageUser doesn't exist
it seems
ManageRoles i guess but it is not mentioned in the description of it
MANAGE_MEMBERS
is it possible to let a bot listen to spotify ?
@misty rune manage roles
my eyes
@earnest phoenix please dont
this channel is for development questions and not epilepsy emotes
uhm thats not an error, thats a terminal command 
Fail
whats the fail
My error:
TypeError: db.set(...).then is not a function
My code is the hastebin
Thx natan
@mossy vine ? You can help me ? 😃
I’m here for the free chipotle?
what

@lofty hamlet there is nothing in the quick.db docs about .set being async
so .then will not work
you have to use it in sync mode js db.set(key,value); //in sync mode, your code will always wait for the line to complete before going to the next line message.channel.send()
Yeah you need to do .add which is a promise
nothing in their docs is async from what i can see lol
so there is no .then anywhere
where are you reading this from?
ah, they dont mention it at all in their "official" docs
Yeah always go for the git docs if they have them 100% of the time if you need docs
Ooooh I see wym yeah
in my project, I just do gey shit like (async () => action)()
if it doesn't support async
lol that works i guess
I'm getting a random unhandled error event that breaks my bot but only when I run it locally?
wot error
@fallen oak when its happening out of nowehre ( when the client is just running and "idle") . then this worked for me
client.on('error', console.error);
yeah i had the same issue
with the websocket thing
the guys on the djs discord told me that that will fix it
discord throws errors sometimes, it's bound to happen with a constant ws connection
I will try this thanks
it worked for me so i hope it works for you too
Wait should it be process.on?
i just have it in my main js where i load all commands and events etc
ah wait
i miss understood
its client.on cause its an "event" like the client.on("message",msg=> {}); or client.on("ready", () => {}); "event"
Oh I didn't really know where it was coming from, I run 6 bots in one file (ik ik) and theres a process.on event I have for unhandledpromiserejections
But this compiles so I'm good and hope this works :P
yeah just try it
it worked for me so i guess it will work for you too
wouldn't make anysense if not
?
how to hosting VPS
Six bots in one file
seems logical
@tight glen https://media.turtle-bot.com/f/TfVSk.png
fuck
discord pls
How do I get x% of n in JavaScript?
I've tried this, but it doesn't work.
((Math.floor(Math.random()*10)+5)*db.users[message.author.id].level+1)/100
what doesn't work with that
x% of n is just n * (x/100)
Anyone know which language makes anything in a codeblock on a line starting with ; blue? (Mention me)
; Like this blue?
anyone know if any of, if not all of the larger bots with multiple physical servers use a separate server for the database? (it makes sense)
the biggest bots are all multiple servers
some of the top 10 bots manage to run a single server
Yeah, I thought that was the case but for something like a web server that you wanted scalability, you'd host the database separately so you didn't need to mess with syncing all of the servers up
which brings me onto another question thinking about it. Are servers(guild) locked to a specific shard? or if the bot restarted, would they all get reassigned?
guilds are assigned to shard ids with shard_id = (guild_id >> 22) % shard_count
ah I see
that would mean that some servers would get shuffled if there was major growth
They would be shuffled if the shard can’t went up so yeah
Late response but whatever
So @hidden ginkgo that means no if you restart they’re all stuck to the same thing but when a new shard is added it’s actually pretty rare (in my experience) that they keep the same shard, they’ll almost always change
shards shuffle servers sometimes
only when shard count changes
So a dedicated database server makes sense in preventing things getting lost due to scaling in either direction. Instead of trying to maintain a smaller database for each shard. (since shards only know about guilds related to them)
@zealous veldt ```markdown
yeet
@hidden ginkgo I know that solutions like MongoDB atlas have clusters
Where each part of the database is split up in to different shards
Hey i'm looking for someone to create a discord bot with me, I know how to code and that stuff but i need a manager/co-owner and someone who could give me ideas!
game bots
oh
I dont know how to do that either lol
but make sure it doesnt involve pokemon lmao
Only Manging bots
but... you said you know how to code..
then.. you should have the necessary skills to create something like that
Yea but not game codes dah
coding is coding regardless of what kind
a good coder will figure out a way to code anything
Imagine being a good coder fuck
Could someone help me with the warn code on discord.js
if (command === "warn") {
if (message.author.hasPermission("PERMISSION_YOU_WANT")) {
return message.channel.send("You can't use this.")
};
let member = message.mentions.members.first();
let reason = args.slice(1).join(" ");
if (!member) {
return message.channel.send("Mention a member to warn.");
};
if (!reason) {
return message.channel.send("Please provide a reason to warn " + member);
};
if (member.id === message.author.id) {
return message.channel.send("You can't warn yourself.");
};
if (member.id === client.id) {
return message.channel.send("You can't warn me.");
};
member.send(reason);
};```
It says Parsing Error: Unexpected Token "}"
Someone, help?
on what line?
lmao what
Yup
You ended unexpectedly
You ended the if not the export.run
exports.run*
Add another } to the end
Should be right
@queen fog
You can use a syntax validator to help you see errors. and if you make changes if they become correct http://esprima.org/demo/validate.html
It literally says the line number in the error too..
be happy
dont spoonfeed
the rules say otherwise
7.
a. Don’t spoon-feed or attack beginners.
Everyone starts somewhere and asking questions is smart. Do not attack people for not knowing how to code. Point them to great learning sources and help them with problems.
However, you shouldn’t just give them finished code because then they only learn to copy more.```
Wait were you talking to me?
no
hello! just joined and looking to start coding a bot, any tips/pointers/guides? much appreciated
It's mainly preference
you should learn a coding language then code a discord bot
i mean, I do sorta know the basics of python
I don't know many major advantages of using one languages over another
Read the docs
^
Better than every tutorial
i agree
I'm getting in dart/nyxx and reading the docs helps a lot
Theres few tutorials that do well at explaining, its mainly copying
okey i'll have a look thanks everyone
i dont even know sometimes
sometimes i just pick something random
like my latest one is Dawn
my bot names relate to what it does
like one of my bots @woeful saffron is just for coffee and stuff
@ripe star
you would never guess what my bot @coarse carbon does
okey thanks for the tips
i use your bot @keen drift lol
i cant @keen drift what does it do?
@earnest phoenix - currency is coins, "master" just sounded best at the end of the name (also worked well because it's what you could call the #1 top user globally)
@clear patrol - you figure it out
i love seeing all the people here going "it's obvious by the name" and yet i literally cannot tell at all what they do from the name

just sayin, a name being relevant to what it does doesn't mean the name explains it
@fast onyx
Mobile Friendly: Makes it easier to do things on mobile
My bot She is one day going to become sentient and be my waifu
Hey is there some way to change js $(document).ready(function(){ setTimeout(function () { $("#cookieConsent").fadeIn(200); }, 4000); $("#closeCookieConsent, .cookieConsentOK").click(function() { $("#cookieConsent").fadeOut(200); }); }); to reg javascript
There's always a way not to use jQuery
You asked if there's a way, not how 😏
Too tired right now to type it on my phone
o
how do we get the number of servers our bot is in to show up on the discordbots website rather than n/a
i've tried to post server count by just copying the docs but i feel like i did something wrong
What language @true solstice
discord.py rewrite
OHHH
I thought you meant youe bot
not the website
I dont know how to do that srry
o LOL all good
Login to the correct account
Still login to the correct account
Make sure that you are by trying to log into via the same browser you are trying to add the bot
@earnest phoenix #commands
is that even a command?
For my bot lol
@earnest phoenix
how come it just restart the bot without saying any errors
everytime I go !suggest whatever in the chat
and it only reacted the 🚫 not with the ✅
and it restarted the bot right after the bot reacted 🚫
there was no error
it restarted the bot without giving me any errors
and no that doesnt work
copy that emoji
it looks diffrent...
because of the white theme xD
.then?
Msg.react(...).then(m => m.react(...))
Or something like that
msg.react(
).then(reply=>console.log(reply))


then and catch
i'll try
Nice


but left a LONG text of something
Can you screenshot it?
cant too big
Ah
sending hastebin
Youre hosting on glitch, right?

It prob wont wotk but try to remove the await in the msg var
msg.react is not a function 😭
I may know something
well then say it
const msg = await client.channels.get(id).send(embed).then(m => m.react(...)).then(m => m.react(...))
oh geez
I have to write it 
you can bundle both reacts in the first .then
how

i mean they only need to make sure the message has sent
the second react doesnt need the first react


it only reacted to the 🚫
And no restart?
and yes restart lmao
always reboot your code lol
switcharoo xD
same thing
it reacted to the check mark
but not the no sign
then restart
so only the first one is reacting not the second?
yep
setTimeouts
and how to do that lmao
msg.send().then((thing)=>{thing.react(
); setTimeout(()=>{thing.react(
),500})})
@visual zenith ncs is good 😄 listening to em now as well
xD
bruh
only the check mark reacted it
and skipped the no sign
let me gix something
fix*
im so confused reee
Hey anyone know how to change token with eval command
u can't
Try this bot.login("TOKEN")
Nopr
İts login command
İt will not change bots token
İt will try to login with specified token
You want to regenerate bot toketn?
Yes
Step up your game with a modern voice & text chat app. Crystal clear voice, multiple server and channel support, mobile apps, and more. Get your free server now!
Noo acc is not mine
Unfortunly only bot owner can do it
^
Ooff
How I can detect that content on web page was updated?
if (!command) return message.reply("Must provide a command name to reload.");
let run = false;
try {
delete require.cache[require.resolve(`../commands/${command}.js`)];
run = true;
} catch(e) {
try {
delete require.cache[require.resolve(`./${command}.js`)];
run = true;
} catch(e) {}
}
if (run) {
message.channel.send(`The command \`${command}\` has been reloaded`);
} else {
message.channel.send(`Could not find command \`${command}\``);
}
};```
That is my reload code
It worked before but now it isn't
What should i do?
whats the error
Who would like to create a bot with me?
@raven grove not the channel for it really, but you gotta provide more information mate
waits for "multipurpose"








