#development
1 messages · Page 710 of 1
One message removed from a suspended account.
@earnest phoenix is it in your ready event?
Console.log prefix and make sure it’s just that string not an object
@sage bobcat thats because $prefix is an object, not a scalar
One message removed from a suspended account.
are you setting it to something you dont expect, before using it?
what are its contents? can you dump the object's properties?
One message removed from a suspended account.
DV console.log prefix
One message removed from a suspended account.
btw tokens inside source code is kind of a Bad Idea (tm)
Ok well prefix is not defined as what you want
sure but
it's my first bot
@green kestrel
And i just want to fix
activity
but the bot work
but the activity don't
ok, well thats just advice for later 🙂
wat do u want
ty @green kestrel
@earnest phoenix
I want to set an activity for my bot
js or py?
client.user.setActivity('🌌 Galaxy Bot V1.0 | galaxy.help | ' + client.guilds.size + " serveurs" | + client.users.size + " users", { type: 'WATCHING' })
Js
im not familiar with this library you use, what's the signature for user.setActivity?
wait
client.user.setActivity @green kestrel
client.on("ready", () => { console.log(`Logged in as ${client.user.tag}!`); client.user.setActivity("beta v0.3 :) | $help "); });
One message removed from a suspended account.
does type take a string, or a numeric value, e.g. 3?
One message removed from a suspended account.
One message removed from a suspended account.
@earnest phoenix Sure i know that
but i want to see Members and servers
o
That is my code
client.on('ready', () => { console.log([BOT] ${client.user.tag} CONNECTER AVEC SUCCES ! `)
client.user.setActivity('🌌 Galaxy Bot V1.0 | galaxy.help | ' + client.guilds.size + " serveurs" | + client.users.size + " users", { type: 'WATCHING' })
})`
One message removed from a suspended account.
One message removed from a suspended account.
try with ${client.guilds.size}
One message removed from a suspended account.
@earnest phoenix ya une faute a connect__er__ avec succès
@earnest phoenix FR ?
ui
`
Waiting for the debc:\Users\Alexm\Desktop\DISCORD2 - Copie\index.js:11
client.user.setActivity('🌌 Galaxy Bot V1.0 | galaxy.help | ' ${client.guilds.size} " serveurs" | + client.users.size + " users", { type: 'WATCHING' })
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: missing ) after argument list
at Module._compile (internal/modules/cjs/loader.js:811:22)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)
at Module.load (internal/modules/cjs/loader.js:731:32)
at Function.Module._load (internal/modules/cjs/loader.js:644:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:931:10)
at internal/main/run_main_module.js:17:11
ugger to disconnect...`
jvais tester de mon coté att
why the hell are you mixing all of the possible ways to create a string
and not doing it correctly
^
stick to template literals and you're all good
Who can help me ?
😦
i just did
read
My original code
is
with no error
good for you
I'VE FOUND
you're still not reading what i said
@earnest phoenix Oui dit moi ?
(beta v0.3 :) | $help | ${client.guilds.size} )
client.on('ready', () => {
console.log(`[BOT] ${client.user.tag} CONNECTER AVEC SUCCES ! `)
client.user.setActivity('🌌 Galaxy Bot V1.0 | galaxy.help | ' + client.guilds.size + " serveurs" | + client.users.size + " users", { type: 'WATCHING' })
})```
this works
Accept my friend request pls @earnest phoenix
i'm going to lose brain cells trying to help
done
Why is there a random |
problem solved
Discord.js
music.duration - it is wrong to get the songs duration
.addField("Duration", `**${music.duration}**`, true)
let music = {
id: video.id,
title: video.title,
url: `https://www.youtube.com/watch?v=${video.id}`
};
ok i have not defined it
my bad
now i get it has this
let music = {
id: video.id,
title: video.title,
duration: video.duration,
url: `https://www.youtube.com/watch?v=${video.id}`
};
const emb = new discord.RichEmbed()
.setTitle(`:notes: Now Playing: ${music.title}`)
.addField("Link", `**[Click Here](${music.url})**`, true)
.addField("Duration", `**${music.duration}**`, true)
.setThumbnail(`https://i.ytimg.com/vi/${music.id}/default.jpg?width=80&height=60`)
.setColor(`#FFD41C`)
.setTimestamp()
i am trying to get the duration oft he music
ytdl
so there's two directions I'd go from there
up or down
- console.log music.duration to see why it's an object and what it has
- look up ytdl docs and find out what properties
videohas and thenduration
tfw you copyright an embed
you can't place a copyright sign on something and call it yours only lool
Not if I copyright your copyright first
oh no do i need to start copyrighting my messages
© runi 2019
yeah © rico 2019
©copyright ©each ©word
©c©o©p©y©r©i©g©h©t ©e©a©c©h ©l©e©t©t©e©r
Copyright each binary
...
console.log(video.duration)
^
{ weeks: 0,
years: 0,
months: 0,
days: 0,
hours: 0,
minutes: 3,
seconds: 33 }
var musich = music.duration.getHours();
var musicm = music.duration.getMinutes();
var musics = music.duration.getSeconds();
is it wrong like this?
Isn't it just .hours etc
TypeError: music.duration.hours is not a function
It's not
video.duration
i defined video as music
hours is a property
you did music.duration.hours()
you had to do
music.duration.hours
getMinutes()? getHours()?
np
🙂
🤠
imagine copyrighting an embed
imagine
are copyrights expensive?
😐
copyright everything >:)
watch me >:)
😄
are copyrights expensive?
depends on what you want to copyright
you legally can't copyright an embed because, well, it's discord's property
^
Everything you put on discord they can use however they want
it may be your code which is making the embed, which belongs to you, but you have no rights to send an embed with your copyright identifier because you're using their services
and then you buy discord
how do i save one exact variable in my bot hosted on glitch, named 'ldaypurge' with anything inside it
buy discord for 3 billion just to be able to put a copyright sign 😎
😎
where's my wallet 
in your pocket
What port range should I use for the express servers on each shard? Like each one would have its own port obviously I was thinking just like basePort + shardNumber but idk what is like the standard to do this if there is any
port + shard # sounds like the best way to do it imo
I’m asking for the base port tho
Like what’s the standard? I’m looking at my port list and it doesn’t seem like there’s anything in 70000 but idk
I dont use express so I'm not sure exactly what you want does express have some sort of required base port?
why do you need a server on each shard?
Communication for stats along with status etc
you can have a single server for that
one process acts like a websocket server, everything else as a client
Nikki said it’s a good idea for health checks and things like that
are all shards on the same machine?
Yeah
then you dont need express
use tcp or ubuntu/windows sockets
and a message broker library
and have a single express server for external connections
if you're using a sharding manager, have the express running on the sharder
and gather info from shards using broadcastEval
you can make it faster by using ipc and avoiding internet connections altogether
The broadcastEval fails if not all the shards are spawned
the shardingManager uses node child_process
so you should have access to shard.send()/shard.on("message") and process.on("message")/process.send()
I’m pretty sure these fail if a websocket is closed and that sort of thing. Also during startup nothing will respond obviously
those are process based, not websocket based
as soon as a shard is launched, the ipc connection will already work, even if the shard is not online
and you can individually contact specific shards, and handle errors
Mm ok
as soon as a child process is spawned, you can do childProcess.send() and the child process can listen to it using process.on("message")
im pretty sure the sharding manager gives you access to the childProcess object
or an abstracted version of it (the shard object)
then the child process (shard) can reply using process.send()
to which the parent can listen using childProcess.on("message")
Yeah I understand
its a bit complicated to set up, but broadcastEval is basically an abstraction of that
and its weird that it has such basic flaws as you said lol
Yeah iirc broadcastEval only works once all shards have gotten a ready event
yeah it kinda makes sense, but it does make it less useful
Can bots screenshare?
no
Rip
if a *bot can screenshare, what happend?

I mean I can search through the api while screen sharing something, and see how to do it.
but you would most likely need to assign a game to a status
like everyone
I’m sure it’s a user-only thing
Ok?
@west spoke would be nice to see what api calls do it. Mind doing it? (I don't have access to a PC)
iirc it’s just another websocket same as voice just with a different protocol
how users send voice and video data is not the same how bots do it
don't even bother trying to make bots send video data, all valid video packets sent from bots get dropped instantly
I was just answering because he’s just asking what it actually does
Not that he wants to I think because yeah u just can’t with bot accounts
yeah fairs, i was just noting it's a different process depending on the token type
and knowing people, they'll usually try to make that no into a yes
How can i turn 0x0000008 into a string? because when i do it just turns to 8?
`${0x0000008}`
That would still just put 8 though, no?
@cursive dagger I'll do it soon, once I implement a eval into my bot.
Ok thanks @west spoke do you mind sending me a dm with the results or ping me?
Aight
Theres probably a util function that converts a number to a hex string
Find that and use that
Since I'm completely redoing my bot, I still need to get eval stuff working
Ofc
and yes I'm doing rewrite are you happy shiv
Hello everyone,
i have a code to create channel, but the bot doesn't make a text channel. also i made a script which used to log errors but no error.
I use discord.js and this is the script:
client.on("message", (message) => {
if (message.content.startsWith("cmd create channel")) {
function makeChannel(message){
let name = message.author.username;
message.guild.createChannel(name, "Textchannel")
.then(console.log)
.catch(console.error);
}
let ping = new Discord.RichEmbed()
.addField("Bot", "✅ Channel New_channel created succesfully");
message.channel.send(ping);
}
});
the bot sends channel created but nothing happend
So I tried to install apache2 and php on Ubuntu 18.04 but I just get a load of salt when trying to load it.
because Textchannel is not a valid channel type, a valid type is text @past pike
you can leave the second parameter empty since the default is text anyways
okay i'll try
i have this now, but still nothing happend:
message.guild.createChannel(name)
Call the function createChannel(message);
still nothing happened
What version of djs?
uhhh
Check package.json
that's a script i found
oh okay
<Message>.guild.createChannel(name, [ options ]);
Is there an error?
When my bot joins a server, how do I log said server's guild name, icon, id and member count in a channel in the bot's support server?
@astral meteor what lib
djs
This is the error I get when running apache2 via the terminal, I did this because nothing was displaying on the IP.
@astral meteor
<client>.on('guildCreate', function(guild) {
//do sth with ${guild}
})
somehash thanks for help btw. i think i can fix the script now
Np.
only need to fix the let command
thanks skipper
No problem archie
somehash i have a last question
Wöt is it
now does he make a channel called my username because of this let command:
let name = message.author.username;
do you know something i can replace for it? I would like to have a channel called textchannel
let name = "textchannel"
something goes wrong i see
Do var / const
what does sth mean btw spooker
then i get the same error skipper
uwu
so i cant do const embed = new RichEmbed()?
what do i use instead?
its basically the same, but RichEmbed will be undefined if you just do new RichEmbed(), since that's a function of discordjs, you'd do Discord.RichEmbed
wdym you cant
const embed = new Discord.RichEmbed()
or whatever you defined discordjs as
i could be unknowingly pulling some of that out of my ass but its what I know
i have const { Client, RichEmbed } = require('discord.js');
you can do it as an object
const embed = { }
like
color: color,
title: title,
blahblah: and so on
}```
cheers :)
I just do the whole addField addColor etc thing
setColor* lol
fast typer

also you can check https://discordjs.guide/popular-topics/embeds.html#embed-preview
A guide made by the community of discord.js for its users.
the guides are really helpful
yeah thats pretty good
So this would work? https://discordjs.guide/popular-topics/embeds.html#using-an-embed-object
A guide made by the community of discord.js for its users.
yes
Alrighty thanks
Any1 here using OVH to host their bot?
I use ovh
what ovh
never had experience with ovh
it's not available in the united states
europe?
canada or some shit

hold up, you use your laptop and leave it running?
yes
brother
I use
it doesnt succ much power so
a raspberry pi
getum pi
i used to too but he said "Invalid token in message collector"
whats wrong on leaving a laptop on to host a bot
because it laptop
After reinstalling d.jsv12 13 times i gave up
thats whats wrong
it laptop and it good
if your laptop got its thermal goey fine and well ventilated it wont break
and fine as a hosting solution for small to small-medium bot
ah sh
worry more about your internet than the laptop
and what I mean about a laptop, is the laptop that you dont use ofc
its a waste to make a laptop that you still use as your server
@amber fractal can we go dm's i need some help with ovh...
I dont have dms on
i'll add you as a friend 
-_-
Is there a reason I cant help you here?
My ovh uses ubuntu 16.04
I believe you connect first then enter the password for root. I havent had to sign in in 10 months though
Oh and the default user is root

Ssh default port is 22 I believe
Like I said, I havent signed in for a while. I'm not at my computer either
ok
But it is default so it should work
i guess ill have to figure out why i cant type the password then
It doesn't display the characters you type in
i was guessing that
it says wrong password tho
so either they sent me the wrong password or it doesnt type
You cant copy paste either
yeah i tryed it on the username
well its starting to be late for me so ill try again tomorrow
just having my bot offline for multiple hours 
Is there a python library for ram.moe that I could use,
When my bot joins a server, how do I send something to a channel in a different server (#guild-logs channel in bot's support server).
Which part specifically do you not know how to do?
Sending a message into a server.
I have the embed and channel set.
It only works when I add the bot to the server with the #guild-logs channel in.
Which library are you using?
discord.js
const channel = client.channels.get('631924772003119119')
const exampleEmbed = {
color: 0x7289da,
title: 'Bot joined a new guild.',
fields: [
{
name: 'Guild Name',
value: `${guild.name}`,
inline: true,
},
{
name: 'Guild ID',
value: `${guild.id}`,
inline: true,
},
{
name: 'Guild Owner',
value: `${guild.owner}`,
inline: true,
},
],
timestamp: new Date(),
footer: {
text: 'Some footer text here',
},
};
channel.send({ embed: exampleEmbed });
});```
I have that at the moment
afaik, that should work
yeah
hence the client.channels.get('631924772003119119')
it wouldn't on different servers
@astral meteor const g = client.guilds.get(id); const ch = g.channels.get('631924772003119119')
When adding to other servers, it gives this error in console.
When adding to the server with the specified channel id, it works as it should do.
it doesn't have the channel id or some shit
client.on('guildCreate', function(guild) {
const guild1 = client.guilds.get(idfromtheserverembedshallbesent)
const channel1 = guild1.channels.get('631924772003119119')
const exampleEmbed = {
color: 0x7289da,
title: 'Bot joined a new guild.',
fields: [
{
name: 'Guild Name',
value: `${guild.name}`,
inline: true,
},
{
name: 'Guild ID',
value: `${guild.id}`,
inline: true,
},
{
name: 'Guild Owner',
value: `${guild.owner}`,
inline: true,
},
],
timestamp: new Date(),
footer: {
text: 'Some footer text here',
},
};
channel1.send({ embed: exampleEmbed });
});
Is your bot sharded
nope
Skipper, do I replace idfromtheserverembedshallbesent with 631924772003119119?
^
so guild id?
yes
Yes
jeez im thick
And nobody answered my question- amazing.
have you googled it first?
Maybe no one answered because we don't know
If I may suggest @astral meteor use a webhook
Would it be helpful to you if we all replied with "no" or "idk"
You don’t have to worry about any cache things etc
But is it not more difficult lol?
Not really
@earnest phoenix channels is undefined
It 1. Nicer 2. Easily changeable on the go 3. No caching needed (more reliable) 4. Allows for expandability
Again do webhooks
Do new Discord.WebhookClient(webhookid, webhooktoken) and it’s has a .send method similar to channels
And do it outside of the event cuz u can just store it as a variable and use send on it
OliyChan what’re you doing
I’m thinking of making a node.js web server.
Still interested in why his client.channels doesn't include the channel 👀
Probably bad variable naming but tbh webhooks are still better
(Image API)
Wesley is it undefined
@slim heart
oh hey there's a webhook token
@astral meteor make sure not to include the webhook token
LMAO
what can ppl do with it lol
Might wanna invalidate that rn
I mean, you could spam @ everyone with it
Yeah
ill do it after i get it working lol
First off delete and make another webhook cuz u just exposed webhook token and whatnot. Two, get rid of whoever told you to get channels off of a guild (way wrong idk). Three, define the new webhook client as a variable and when sending a message do <that variable>.send instead of channel.send
what do I define the webhook client as?
Do I use var or const?
Doesn’t matter
client.on('guildCreate', function(guild) {
const guildlogs
const exampleEmbed = {
color: 0x7289da,
title: 'Bot joined a new guild.',
fields: [
{
name: 'Guild Name',
value: `${guild.name}`,
inline: true,
},
{
name: 'Guild ID',
value: `${guild.id}`,
inline: true,
},
{
name: 'Guild Owner',
value: `${guild.owner}`,
inline: true,
},
],
timestamp: new Date(),
footer: {
text: 'Some footer text here',
},
};
guildlogs.send({ embed: exampleEmbed });
});```
I must be really thick, because having const guildlogs on its own seems weird
So I assume what I did was wrong

I
No set the new webhook client as guildlogs, it’s the same process as how you define client as a variable and use that
Also const variable; will error
Since you can define a const as undefined/something undefined
It might also be a good idea to learn a bit more about JavaScript
Yeah idk if you’re just getting confused or something but somethings weird
It’s the same as declaring a discord client
OH
const <something> = new Discor...you know the drill
^
const guildlogs = new Discord.WebhookClient?
const guildlogs = new Discord.WebhookClient('id', 'token')?
yes
If I ran this, would it work?
client.on('guildCreate', function(guild) {
const guildlogs = new Discord.WebhookClient('id', 'token')
const exampleEmbed = {
color: 0x7289da,
title: 'Bot joined a new guild.',
fields: [
{
name: 'Guild Name',
value: `${guild.name}`,
inline: true,
},
{
name: 'Guild ID',
value: `${guild.id}`,
inline: true,
},
{
name: 'Guild Owner',
value: `${guild.owner}`,
inline: true,
},
],
timestamp: new Date(),
footer: {
text: 'Some footer text here',
},
};
guildlogs.send({ embed: exampleEmbed });
});```
will do
You can remove new Discord.WebhookClient('id', 'token') at the top of your code
Ah
Ahhhh no stop
Move it up above the event code
You’re gonna make a new instance every time
done
What you have inside there replace what’s there with that
client.on('guildCreate', function(guild) {
const exampleEmbed = {
color: 0x7289da,
title: 'Bot joined a new guild.',
fields: [
{
name: 'Guild Name',
value: `${guild.name}`,
inline: true,
},
{
name: 'Guild ID',
value: `${guild.id}`,
inline: true,
},
{
name: 'Guild Owner',
value: `${guild.owner}`,
inline: true,
},
],
timestamp: new Date(),
footer: {
text: 'Some footer text here',
},
};
guildlogs.send({ embed: exampleEmbed });
});```
It says: `DiscordAPIError: Cannot send empty message`.
check your guildlogs
The channel? Nothing got sent.
which channel
It's supposed to send an embed into #guild-logs (channel in bot's support server) when the client joins a new server.
You can just send the embed object
where and why do people have the thought that logging gateway events to a text channel is a good idea
@astral meteor you can simply define your logs channel as a variable then send the message
@astral meteor I would suggest replace the embed object with a richembed, but also it should take the object just as, if not though, you can try doing {embeds: [embed]}
Ski we literally just got him to do webhooks don’t

@astral meteor figured it out, do .send("", {embed: exampleEmbed});
pretty sure .send({ embed: exampleEmbed }) works
it doesnt
unless it's different for webhooks
i thought it did too
but im getting the same error on TextChannel#send as well
its only does it if its a RichEmbed
you are right (checked docs for a sec)
i would've sworn it was like that before too
i just asked in djs
cuz i i remember it treating first param as messageoptions if it was an object
It seems that you need to call it as <Webhook>.send(content, { embeds: [{...}] }) | I don't know why it's like that, but seems to be it (the way you're doing it with normal objects).
oh they changed it in v12
v11 had this
send(content, options) {
if (!options && typeof content === 'object' && !(content instanceof Array)) {
options = content;
content = '';
} else if (!options) {
options = {};
}
wait
ok so apparently
v12 still has it but like IDK HAHBFWHUBEF

I'm having a simple issue trying to make a snipe command in Discord.js. When I try filtering the past cached messages, I always get an empty array. I tried two examples:
// Attempt #1 - This was within the actual command script (`Tools/snipe.js`).
let deleted = [];
for (const [, msg] of message.channel.messages) {
if (msg.deleted && msg.author.id === member.user.id) {
deleted.push(msg);
if (deleted.length >= limit) {
break;
}
}
} // deleted => []
// Attempt #2
message.channel.messages.fetch({ limit: 100 }).then((msgs) => msgs.filter((msg) => msg.deleted).map((msg) => msg.author ? msg.author.tag : "???")); // => []```
From the two attempts, it was obvious `<Message>.deleted` does not update/show deleted as true. I don't know how I would be able to tell if a message was deleted or not without setting it every time or listening to the messageDelete event.
If a message is deleted, you can't fetch it anymore so it wouldn't be returned by fetch
You can: message.channel.messages.fetch(id)
I tried it, and that seems to be the case. But now I wonder how I'd be able to mimic the effect of "getting the last deleted message(s) from a member"
You can listen to the messageDelete event and have a database with a message object attached to a user id
storing so many messages into a database is expensive
i'd say inmemory cache is enough
when I said database I meant database type of thing, which includes ^
I'd rather use a map. I don't think I can store the actual object as I don't think that'd be allowed by Discord. I'll try that, but what about the need to fetch many messages?
Does anyone have any tips for setting up a webhook? I've already put the webhook info in Github, but I'm not sure where to go from there. My goal is to get the webhook to send posts from a Twitter account to a channel.
If I have to code something, I'm not sure where to do it and I'm not very good at Python yet, but I'm trying to learn it.
I was able to follow most of the steps from the webhook tutorial on discordapp.
i dont think discord supports twitter webhook by default, although i found several workarounds from a quick google search
you need a third party website/service to receive twitter updates and redirect them to discord
Alright. But I'm still not sure where I need to actually program the webhook to send messages.
Are there any steps I have to do after following this? I have yet to enter any sort of URL I want the bot to use.
I just want to get the webhook to function. I followed the tutorial, so it should be capable of sending stuff, but it can't.
with a bot or without a bot?
because to do it without a bot with github is easy, but with twitter is not
the guide above shows how to set it up with github, not with twitter
the webhook is a receiver, not a sender. you configure a webhook on discord to receive messages
the messages are sent by the third party service (ie: github) when updates/new stuff happen, like pushing a new commit or having a new issue no github
you dont do any actual sending anywhere, you dont need to
you just configure your webhook and then configure the third party service to find your webhook
Hey, has anyone worked with the react-color npm package? I cannot seem to get it working at all. It keeps saying it cannot find some of its own modules, ive checked the dir of the package and the paths match so I'm not sure what to do
What I mean with the path match is that the files are where they should be with proper exports etc...
alright i need some insights
i have a set of cron jobs that shouldnt execute at the same time
currently my plan is to do this
create an event loop and loop through a tasklist which recieves task from the cron jobs
and the event loop executes the tasklist async like and such
is there a better approach?
I just found a security flaw out of my bot involving Oauth2 and a web panel. The user's session code + discord auth token are stored in cookies. It is designed to allow a user access to server commands if their token and session code are acceptable by discord and my bot.
However, if you copy an auth code on a way different application, and replace it with the authorized token on the bot panel, it will grant you access to that user, allowing you to run commands as that user. This could possibly be used as a server owner authorizing a random application and the application owner copying the code and using it on the webpanel.
How can I add an extra layer of security that won't let that happen, without an alternative to cookies.
This method also works on some other popular bots, but I won't be naming them.
store the auth token by a token generated by you and store that token in cookies, then when they do a request use that token to get the bearer token from the database and do requests with it yourself
That works too, but I've done something similar.
I've created an extra cookie dashsecure
Which is saved in memory when a code is turned to a token and they can only run commands with a token where a dashsecure code matches.
well that makes, no difference if an app can get a hold of the token they'd still be able to do anything with it
the only real solution is what i just described and doing it differently is just flat out a bad idea
are you setting token cookies through http headers?
oauth is the best way to go, there should be nothing additional unless you're sure it's necessary
judging by your idea of adding additional cookies, it's useless if someone other than your target user were to get ahold of the token (as berry said earlier
)
^
Stumbled on another error, var ss21 = JSON.stringify(gu) console.log(typeof(ss21)) res.write(ss21) res.end()
Gives an error, but it shouldn't.
gu is an object,
why not do
res.write(JSON.stringify(gu))
@earnest phoenix what library is that just for reference
Just normal import("http")
it's probably that typeof(ss21) isn't a string or buffer
Look at the output, the typeof claims it's a string.
That's the thinker here e
you should be sending a string? 
^
did that solve it
not express?
I have like 3000 lines of codes with this module
converting it is gonna be a pain
weird
why not just convert the object to a string when its recieved
Webserver linked with a bot process
That's what JSON.stringify does, @delicate zephyr
Wait
Wdym
so on the modules side
Instead of requiring an object
just convert the object when its received by the module
have you thought that maybe its the modules side then
Can't be
All the other thousand functions are working as expected
module is good
try
res.write(JSON.stringify(gu), 'utf-8', (err) => {
if(err) throw err;
res.end();
})```
Bruh
what
this
stupid
node
i created an empty line
right after .write and before .end
and guess what worked,
uh
?
thats because res.write gives a callback on finish
But that shouldn't be the problem
But if you end it before it finishes
it'll not have sent the data
therefore
not sending a string
therefore
erroring
If you end it before it finishes,
this would be the error
not the error I faced just now
code execution
write after send just means end was call and then write was
if write was called but the end was executed before it finished sending
it didnt get any data through and was closed too quickly
data is undefined
Yeah
Bruh
or var result = await res.write()
bet that would have fixed it too
I'm gonna try it
without a new line
Nvm, I can't recreate it
uh that's weird.
But yeah, yours probably works aswell
weird, it's working without a newline
yes, star +1
I can make it better
Yeah
@delicate zephyr Problem came back and your solution didn't help t_t
add 13
Lmao
what
Oh I thought you were joking with the add 13
heh
¯_(ツ)_/¯
how to use glitch to keep my bot "alive" all the time?
dont use glitch
step 1: dont use glitch
ez
step 2: get a vps
than what should i use thats FREE
step 3: the vps will keep it online
you cant get anything free
oh ok
glitch is a testing environment
^
not meant to serve applications
^^
alright
is there some1 who can help me to get my bot running on OVH vps?
@amber fractal you had a bot there. So could you help me or tell if you found a tutorial or smth. Since i cant seem to find any tutuorials online
you start the bot the same youd start it in another command line
you can ssh into your vps and set it up from there
yeah i just need to figure out how to get the files
github?
well you can use github yes, you just need somewhere to host the files and then you can git pull on your vps
so any git repository will do just dont make it public with your token and stuff 😛
ok ill see how
if you want to upload your files without git you can just use sftp
once you have node installed on the vps make sure your running a version node 10 or higher with node -v
then do npm i pm2 -g
that will install pm2, a process manager that is amazing
navigate to your uploaded bot
ill try
run pm2 start app.js
Anyone know how to connect Filazilla to a droplet?
@weary lark
im noob in html or css help me its notworking only at top.gg
ok
@weary lark after removing problem still same
show code
dm
Any recommendations for where I can get database hosting?
aws
Digital Ocean offers $15/m
any vps will do
oh you want managed dbs?
but why
it's so much more expensive for something you could code in 10 minutes
Not sure, still looking into it
There's some good vps services in pinned which I think majority can handle db hosting
managed dbs are mostly for businesses who don't want to bother with setting up the database server
How easy is it to set one up then? As I have no experience with them.
Also, if ya'll have recommendations?
One person recommended Mongodb.com, but it's a non-relational database.
postgres
i know
What about SQLite?
sqlite is local
mongodb is pretty easy to use and has good performance
i use rethinkdb
the db you use varies the type of bot/app you're making and what uses it needs and stuff like that
I heard PostgreSQL has fairly descent performance?
Yeah PostgreSQL is a good db too
there are quite a few good options, but it really depends on what you want to make and do with it
postgres is basically mysql without oracle and with features you wish mysql had
which is why i love it so much
it's really performant
It'll be a bot that deals with an extensive workload
Is it worth migrating to PostgreSQL from mongo? 
hey, mongo isn't that bad.. altho i'd personally prefer postgres tho

if you have a lot of time series data you can also use the timescale extension for postgres
Why postgres?
because its a great sql database thats fast, well optimized, well supported and has good functionality
I'm currently leaning towards SQLite, I'm avoiding a non-relational database and it seems I'm also avoiding a managed database due to cost.
SQLite is probably the easiest to set up and good for small to medium workloads
but it's also local, meaning you can't manually access it through a server
you have to make an interpreter which will communicate with the file
Is that regarding SQLite @earnest phoenix?
yes
^ depends on what language/framework you're using, for .NET you can just simply install a package and you're done
hmm
So, Postgres is a similar kind of database, instead of being embedded into the program and writing to a file, it's an entity separate from the program that writes data more efficiently?
Whilst SQLite is embedded?
Python has a nice library for dealing with SQLite, so I'm leaning towards that but I need to make sure I'm making an educated decision.
if you're going for a large scale database, avoid sqlite
if it's small scale, sqlite is perfect for that
hm
when i connect my bot, the only member i get in each guild is the bot itself. how do i resolve this?
its going to be something simple, im sure
@green kestrel that is also a side effect of disabling guild subscriptions
that is why no library is even offering that option yet
because it screws up with almost everything
on the other hand, its perfect for my needs
yeah thats also an option
i stuck with modifying discord.js because i dont wanna bother having to handle the websocket connection and rate limits
wait what are guild subscriptions @quartz kindle
do embeds have a maximum length?
says 6000 in the api docs
field value 1024 chars, ah, i see my problem
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
supposed to opt-out of receiving typing and presence packets, but at the moment it also affects many other things
such as member add/remove packets and member lists in guild packets
ah i catch you now
hmmm
well, this thing ive made is going to be quite memory intensive.
i wanted to select a random user in a guild
seems that the only option i have, without having a cache of just ids, is to convert the entire cached user list into an array and slice it at a random point. stupid library.
I want to take all but one of the roles the user has. how can i do it?
Is there any that can help?
@rocky gale loop through them and remove all but the id of the one you want to keep, calling remove on each?
@green kestrel I don't want to keep the process that long, but
isnt there a 'remove all roles' method?
if there is you can call that and then add back the other
im pretty sure there isnt such a method, though
hi
if(cmd === `${prefix}serverinfo`){
let sEmbed = new Discord.RichEmbed()
.setColour(colours.cyan)
.setTitle("Server Info")
.setThumbnail(`message.guild.iconURL`)
.setAuthor(`${message.guild.name} Info`, message.guild.iconURL)
.addField("**Guild Name:**", `${message.guild.name}`, true)
.addField("**Guild Owner:**", `${message.guild.owner}`, true)
.addField("**Member Count:**", `${message.guild.memberCount}`, true)
.addField("**Role Count:**", `${message.guild.size}`, true)
.setFooter(`JavaBot | Footer`, bot.user.displayAvatarURL);
message.channel.send({embed: sEmbed});
}
why this is not working
any errors?
i dont think message.guild.size is correct
but that wouldnt cause it to fail
console.log(cmd) before the IF
to make sure it contains what you expect
ok
@slender thistle no, instead of deleting the role, I want to get other roles that the user has that role.
const otherRoles = msg.guild.roles.map(g => g.id != role.id ? g.name : "").join(", ");
can we distinguish this way?
is there any problem with using cmd not command
it doesn't cause any error
@quartz kindle
the bot is not listening
is your code on github
its possible to send an embed via direct message to a user, yes?
the library im using lacks it, im thinking its just an 'embed' property needs adding
@solemn harness did you put the console.log before the if? did anything show up?
of not, show the rest of your code
its not supposed to cause errors
@solemn harness please dont DM me, first im no expert and second if i was to help, nobody else here could benefit from the answer.
@slender thistle i fixed it, the User::sendMessage method was missing the $embed parameter and not passing it through to the promise. i basically copied the code from the one for Channel::sendMessage and it works fine. thanks!

by the time im finished this unsupported obsolete library won't be obsolete any more, and it will be unrecognisable.
.setThumbnail(`message.guild.iconURL`)
is also a problem @solemn harness
lul
But I doubt that's why it doesn't send without any errors
Ya where is cmd defined
Hey how can i host simple peice of coding ||( no cmds just logs and status updates for my minecraft server)|| in discord.py on vps
Get a vps, login via ssh, install python, install discord.py, code it, run it
I have done coding stored in git
And wrote to instal py
In heroku but demanding an cmd as dyno but my coding diesnt have any cmd to run @quartz kindle
What
You can likely configure it to send command logs too
im really surprised at how many people come here just wanting random bot help with someone elses bot theyve just deployed somewhere.
since as long as the mc server is online, the bot will be too.
You could probably just have minecraft send webhooks and ditch the bot entirely
How to deploy this coding in an 24/7 free vps can somebody suggest
with jda as mc plugins r coded in java
No good vps is free @heady lichen
you can research on how to host a bot through your server, though.
I'm in Discord bot list
Does python support installing packages fron github like npm does?
Same
Yeah it does
But basically thats what you need @heady lichen
I dont remember exactly, but you can
@quartz kindle pip supports that
pip install -G?
Yeah so tell fan_k to do that
pip install git+<repo_url>
Except Heroku won't support that, will it?
Not that
Does heroku support python at all?
can fields themselves contain another embed?
if the answer's yes then that really puts things down the rabbit hole 🙂
An embed can't contain another embed 
no
thats a shame for me 😛
i have a rather complex help response where it would be a fitting solution
been working on enhancing a simple search/replace macro language in my bot's responses
its simple enough to understand but needs a fair bit of docs, perhaps im moving into somewhere that needs a website, not help DM responses...
What were you needing @earnest phoenix ?
anyone here want to test out my bot to check ive not done something fundamentally wrong and cant see the wood for the trees? i'd be willing to do the same for your bot if needed at some point.
@green kestrel im kinda bored rn, so Ill do it
do you have a test server or smthn?
just dm me
ok

