#development
1 messages ยท Page 1596 of 1
well uhh
js code is processed and variables are exported
is it possible to get rid of browser properties in the vscode intellisense?
i still get autocomplete for window objects
and it's really confusing
set it in your config
i'd imagine json is almost like a simple json.parse, whereas js code is actually executed plus stuff has to be explicitly exported
I hate this too
but eh, probably no difference
import * as botConfig from './botConfig.json'```
this is normal, its because you are using a fat arrow that it looks weird
its the same as this
function blah(a) {}
same error
im pretty sure it doesnt do anything special for json
should be working
what's the config for that?
which could possibly mean requiring json is faster?
what was the -w flag again
watch

it has to be double dot
why do you even need to restart vsc
ts-node-dev
but with require, it didn't need
kekw
F1 > Reload Window
hmm im gonna check
what about this?
gotta be require
Argument of type '{ type: string; project_id: string; private_key_id: string; private_key: string; client_email: string; client_id: string; auth_uri: string; token_uri: string; auth_provider_x509_cert_url: string; client_x509_cert_url: string; }' is not assignable to parameter of type 'string | ServiceAccount'.
Type '{ type: string; project_id: string; private_key_id: string; private_key: string; client_email: string; client_id: string; auth_uri: string; token_uri: string; auth_provider_x509_cert_url: string; client_x509_cert_url: string; }' has no properties in common with type 'ServiceAccount'.
the code:
import serviceAccount from './serviceAccountKey.json';
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: 'nope.com',
});
const Goodbyechannel = guildMember.guild.channels.cache.get('678048512822476804')
Goodbyechannel.send(`<@${guildMember.nickname}> Just Left The Server `);
console.log(`MEMBER LEFT: A Member Has Left Dogey Army!`);
});```
How Do I Make It Not Null?
Idk What I Should Replace With guildMember
no
If the user isn't cached yes
@glacial pagoda
this is the escaped version
@glacial pagoda
this is what will show if cached
help here
const serviceAccount: Object = import('./serviceAccountKey.json');
it works with this I guess
bruh
@outer perch ```client.on('guildMemberRemove', (guildMember) => {
const Goodbyechannel = guildMember.guild.channels.cache.get('678048512822476804')
Goodbyechannel.send(`<@${guildMember.id}> Just Left The Server `);
console.log(`MEMBER LEFT: A Member Has Left Dogey Army!`);
});```
Got another error
What If I Take Out guildMember.?
from goodbye
since he's not in the guild anymore, u can't get the guild
const doesExist = {
text: `SELECT * FROM clanusers WHERE id = $1`,
values: [Array.from(addIds)[i]]
}
var doesExistData = pool.query(doesExist, (err) => {if(err) return console.log(err)})```
I keep getting undefined idk why I made sure everything is correct addIds is a set btw
So i Remove the guildmember right?
from const Goodbyechannel = guildMember.guild.channels.cache.get('678048512822476804')
wait
wait
Ok
you sure that channel id is correct 
yeah
Hardcoded id...
What
const Goodbyechannel = guildMember.guild.channels.cache.find(channelID => channelID.id === '678048512822476804')
try this
ok
shoudnt i take away guildMember from the statement then?
but guildMemberRemove only returns Member
discord.js won't trigger the event if the member isn't cached
you do have client defined dont you
yes
member.client if you don't have access to client
hi flaz 
yo
how can i run a dpy instance and flask in the same file?
or how can i use flask with dpy client?
why not
me?
yes
just setup the server and bot under one file
like in js
i'm sure that's possible in python too
What's the error?
Fixed
K
@everyone


does anyone know how to show when the command was ran just like you do in embeds with .setTimestamp*()
let [{ MessageEmbed }, { help, discordserver }] = [require(`discord.js`), require(`../config.json`)]
module.exports.run = async (bot, message, args) => {
if (message.author.id !== `523877466486472714`) return message.reply(`\`๐\` You don't have permissions to execute that command.`)
try {
await bot.guilds.cache.forEach(guild => {
let embed = new MessageEmbed()
.setColor(`0xC3824C`)
.setThumbnail(message.guild.iconURL({ format: `png`, dynamic: true, size: 2048 }))
.setAuthor(`Service Announcement`, bot.user.displayAvatarURL({ dynamic: true }))
.setDescription(args.join(` `))
.addField(`Need support? Let's join Shiro server yeahh`, `${discordserver}`)
.setImage(help)
.setFooter(`Service Announcement sent by ${message.author.tag}`)
.setTimestamp()
guild.channels.cache.filter(c => c.type === `text` && message.guild.me.hasPermission([`SEND_MESSAGES`, `EMBED_LINKS`, `VIEW_CHANNEL`,])).first().send(embed)
})
message.delete({ timeout: 1000 })
message.channel.send(`Message sent successfully to ${bot.guilds.cache.size} guilds`)
}
catch (e) {
console.log(e)
message.reply(`I cannot send the broadcast.`)
}
}```
on?
2021-02-17T02:16:51.353894+00:00 app[worker.1]: (node:4) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Access
2021-02-17T02:16:51.353895+00:00 app[worker.1]: at RequestHandler.execute (/app/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
2021-02-17T02:16:51.353896+00:00 app[worker.1]: at runMicrotasks (<anonymous>)
2021-02-17T02:16:51.353896+00:00 app[worker.1]: at processTicksAndRejections (internal/process/task_queues.js:93:5)
2021-02-17T02:16:51.353953+00:00 app[worker.1]: (node:4) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 35)
how to filter channel in right wait
discord.js
nono, i know that
on message content?
i meant in a normal message
yea
not in a embed
it won't be dynamic though
:/
alr
its odd that you need to send ISO strings but somehow d.js returns a timestamp int
but should work just the same
I finally figured out what I was doing wrong 
It's a way of saying, "If this Python file was run as the main root, do something"
Like if I do import that.py it'll run everything top to bottom
you can use it to prevent something from executing if you're importing the file
but the if clause is there it won't try running that block
alr
im trying to run a dpy bot in the same folder as flask
so i can use bot resources
but im having issues
like what happens is one works and the other doesnt
and they never "both" work
check if running on main, then continues to run
example
that's vague
ill try to give code?
@quartz kindle is it fine if i yoink that code you posted to start using that for my deep clones?
app = Flask(__name__)
botClient = commands.Bot(command_prefix = ".")
(a bunch of flask routes)
if __name__ == "__main__":
app.run()
botClient.run("token")```
then
from flaskapp import app
if __name__ == "__main__":
app.run()``` wsgi
but flask is
You don't have intents?
bruh.
so it wouldnt even need intents
here is a example
oh
When you call the run command
from discord.ext import commands
from discord import Intents
main = commands.Bot(command_prefix="yeet!", intents=Intents.all())
main.run("token")
@placid iron its not the dpy
why is flask blocking?
its the flask
You aren't going to have a good time trying to run 2 functions which both block the rest of the code at once
Luckily
i can use quart?
You can run the bot without blocking
(Don't use if you can) Run a Flask app and a discord.py bot in one program using threads. - webserver_and_bot.py
i found this
and i could use quart
I use aiohttp and never have once used flask or quart so I can't help
Yes?
Yes
Yeah, you would have to work out how to start then both too but sure
Oh also
Are flask routes sync
quart isnt "sync" per say
flask*
quart is flask but async
its faster
like 3x faster
but flask isnt sync
its slow
i guess you could say
Are the routes in flask defined as async or sync
sync
Okay
oh lol
How did you expect to do stuff with the bot and the API with await
๐คฆโโ๏ธ
i ddint
Gj
Like what
Ok
Yes
client.on('guildCreate', async message => {
var vc = new Discord.MessageEmbed()
.setDescription("This bot will help you and it be updated alot and we are trying to give 75 server so can u help us!!")
.setColor('RANDOM')
.setTitle(`Thank You for inviting me`)
.setImage("https://media1.tenor.com/images/d185187feba0e4daa627f344d07cfad7/tenor.gif?itemid=14465470")
message.channel.send(vc)
})
Why not working
tysm @placid iron
You tell us; what isn't working about it?
You may be missing the GUILD_CREATE intent (from observing your code).
It not sending the embed
@lucid prawn cuz guildcreate returns a guild not a message
guild.send() is not a function
and stop using var's
they are bad for your code
so is embed builder
Ok
embed builder's not that bad
@opal plank in ts, what should I do if I have something such as msg.guild_id that I KNOW is defined as I have intents but the typings say it might not? should I add a useless check and return, or do as Snowflake, or something similar?
i am afraid to tell you that you just declared war on erwin
embed builders suck
I have many wars pending
now Erwin will help me pog
lmao 
dont say embed builders are not bad around Erwin 
huh?
use !
I have intents meaning I only get guild messages
msg.guild_id!
well yeah
it's basically screaming at typescript YOU DUMBASS THIS IS OBVIOUSLY GOING TO BE DEFINED ARE YOU AN IDIOT
! works just to say its there
only use if you are 100% certain its there tho
thats an easy as fuck wya to make bugs
yea
yeah
waiting for the embed builder war with Erwin
but its better than your favorite as any
it's useful for express additional request properties
i'll bonk ya, dont think i wont punk
@opal plank
theres no war btw, its shit, one sided
but bonk me harder
sounds kinky, i'll pass
according to node, my process is using about 20mb of ram
but i can't find anything in the task manager

how to avoid getting bonked
it is tho
nah
define proof
too hot
10ms vs 300, its 30x less performant than simply sending an object directly to .send()
theres no argument to use it
also less footprint
no requires using cache
no importing or destructuring modules
just an ol' vanilla js object
less ram footprint, more performant, cleaner
gimme 1 reason why would anyone use embed builder apart from trying to trigger me like @zenith terrace
If all you're looking at is speed then sure plain objects is better, but embed builders are usually safer with validation and get the message out. Plus tbf you probably don't truly value performance when writing javascript
๐ 
wdym you dont value performance? you gonna write less performant code for no reason?
I'm pretty sure
Some do
at that point why not use ```ts
client.on('message', message => {
if(message.content.startsWith(prefix + 'help')) {}
});
client.on('message', message => {
if(message.content.startsWith(prefix + 'hi')) {}
});
client.on('message', message => {
if(message.content.startsWith(prefix + 'ping')) {}
});
at that point why not do this? it clearly works
ยฏ_(ใ)_/ยฏ
Fast
my point still stands
the other two are facts tho
but the other points are all facts
ยฏ_(ใ)_/ยฏ
Phones suck ngl
ew discord mobile
wdym you dont value performance? you gonna write less performant code for no reason?
I wouldn't say it's for no reason, but I'd rather use embed builder for safety + more ethical for some. I personally prefer classes when writing code that does the same stuff over raw objects.
it'll screech at you for adding properties it doesnt have
theres no safety with embed builders
Ts is poggers until you get a tsc failure
that's actually when it gets poggers
asking for a friend ofc
Iโve never had a circular dependency or anything like that ofc
check this lite
no adding extra shit on code
extra checks
more ifs
increasing complexity checking what should or should not be there
oh there is no validation, thought there was
make it a type and catch it before you even run the function
im telling you
embed builedrs are absolutely useless
In my opinion no
I don't think they're useless
i do, they just create an object for you
the ONLY thing you might argue in their favor is their easy to understand method names]
which just proves the point nobody reads the API docs
They are especially good for beginners
to see what a message request is like
and thats why d.js is bad
d.js is good for beggingers, but not only does it do that, i spoils devs already early on, to the point they struggle to move to something else cuz they had their asses wiped and powdered by d.js's poorly performance
because berrys lib
Agreed
Maybe I'm just too used to type-safe languages (other than TS) to not see the value in MessageEmbed
d.js has the types for you already
yes
Djs maintains a really poggers api types lib
itโs really good
That's not really what I meant
Java?
the one complain i hear about java and c# is the innability to have any like ts
makes a pain to typeguard api requests n shit
donโt they have var but itโs memory inefficient?
i think so
I never learned these big words
Using any imo is bad practice unless you absolutely need it
Observable<T>
you probably seen it quite a few times
Class Something<T> {
}
abstraction we use the abstract class for
though i dont quite think they are exatcly the same from java
It's roughly the same
What's the real difference between an interface and an abstract class 
asbtract class doesnt get initialised
by itself, at least
when another class extends it, then the new class is intialised
but you cant use an abstract class iirc
an interface describes an object and its properties, while an abstract class is just a class with unimplemented methods
Ty
why does this look like w3schools but blue
class something {
name: string;
adress: string;
cellphone: number;
}
class somethingElse {
name: string;
adress: string;
cellphone: number;
car: string
}
im getting the sabe vibes
imagine this scenario
So interfaces can't require methods be implemented?
How do you load files inside of a function? Is it a bad practice to use require?
i use dynamic imports since i use ts
require? dynamic import? I've always used require
Explain
you shouldnt import files inside functions, but you could
you can use both
import and require
it depends on where it's usee but I wouldn't call it a bae practice
they work almost the same
a command loader function
then you'd likely wanna use import
Then required shouls be good
how would I do that?
Yes
also depends if you're using import or require in your project
Import
All your commands should get loaded before your bot starts, so use require
import will import them as ts file
use import then
How do u do that?
```ts
code```
since you're using es6 import/export, use dynamic imports
how do you do a dynamic import?
Sec Iโll link
import('something')
.then(imported => {
const { default: defaultExport, someOtherExport } = imported;
// Do stuff
})
or use await like a champ
Current
Shhhh
for of
I just learned for of
Require would be better in the case of commands because it's sync and you don't risk one of your commands getting loaded after your bot strarts ul
class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}Head
}html```
but can't he just use await?
Bro
that's the whole point of async functions
My commands load after everything else
thats why you'd use sync for loops feud
so its blocking
oh, then you fine million
@novel hollow use the corresponding language
Iโm redoing the base because shit code
import jdk.javadoc.internal.doclets.formats.html..Head;
class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}Head
}html
im switching to detritus
Ah
detritus best lib
in spite of a lack of docs
Im still working on it
Yep
What are you even trying to do
i just realized the detritus support server icon is the missing unicode character
why
Bans a member from the server.
%help
Displays all the commands of the server.
%mute <@user>
Mutes a user in the server.
%unmute <@user>
Unmutes a user in the server.
%afk
Set's an AFK message for a user.
%warn <@user>
Warns a user.
%warnings <@user>
Displays all the past warnings of a user.
%clearwarnings <@user>
Clears all the warnings of a user.
%status
Changes the status of the bot.
%report <@user> <option reason>
Reports a user.
%suggest <suggestion>
Logs a suggestion to the server.
%invite
Generates the invite link for the bot.
%kick <@user>
Kicks a user from the server.
%say <message>
Broadcasts a message in the channel.
%addrole <@user> <role>
Adds a role to a User.
%removerole <@user> <role>
Removes a role from a User
%softban <@user> <reason>
Soft bans a user from the server.
%purge <no. of messages>
Deletes a number of messages in a channel.
%ping
Gets the ping of the server and bot```
Uh
Yeah but what are you trying to do
did you copy your whole help command
Currently trying to make a trading bot
@opal plank https://github.com/Million900o/terano-rose/blob/master/src/bot/commands/misc/ping.ts you donโt like how the embed builder looks?
I love how clean that looks ngl
YOUUU
lol
STAPH
Its hard making a Economy bot
No
why does context have an embed method 
yikes
jpbbitch
thats all im gonna say
yikes
ew mobile monospace
ikr
colors?
const reset = '\x1b[0m';
const func = (code: string) => (s: string) => code + s + reset;
const chalk = {
reset: func(reset),
bright: func('\x1b[1m'),
dim: func('\x1b[2m'),
underscore: func('\x1b[4m'),
blink: func('\x1b[5m'),
reverse: func('\x1b[7m'),
hidden: func('\x1b[8m'),
black: func('\x1b[30m'),
red: func('\x1b[31m'),
green: func('\x1b[32m'),
yellow: func('\x1b[33m'),
blue: func('\x1b[34m'),
magenta: func('\x1b[35m'),
cyan: func('\x1b[36m'),
white: func('\x1b[37m'),
bgBlack: func('\x1b[40m'),
bgRed: func('\x1b[41m'),
bgGreen: func('\x1b[42m'),
bgYellow: func('\x1b[43m'),
bgBlue: func('\x1b[44m'),
bgMagenta: func('\x1b[45m'),
bgCyan: func('\x1b[46m'),
bgWhite: func('\x1b[47m'),
};
yea
lemme grab logs
pls dont
i made my logger in 1
console.log
elegant solution
without the need for chalk
you're using raw color codes right?
me? yes
aight fine
@opal plank yo my code no work pls help
const embed = new discord.MessageEmbed()
.setDescription(`hi Erwin <3`)
.setField(`Erwin is`, `gonna be mad`)
message.channel.send(embed)```
pls no block Erwin ๐ฅบ
blocked

so uhh
i said i was going to use ClusterClient right?
That was PAIN
hmmm table could be an option tbh
what could i use redis for
everything cache related
I donโt use redos for anything
hmm aight
but why would i use redis instead of just memory cache
cuz then you have persistent cache after restarts
Persistence and multi process
true true
its like using a database thats a LOT faster than a database
well another one to my todo-list
its meant to be super efficient and fast
I just cache my dB
keep in mind its not object friendly
oh noes
you'll have to learn hashes
Stringinfy it
or hashes
should i use base64
Strings easier tho
i remember serializing base64 with java
I mean coding for suggestions is easy
class Embed {
constructor(embed) {
this.embed = embed
}
}
let messageEmbed = new Discord.MessageEmbed()
.setTitle("Erwin")
.setDescription(":)")
let embed = new Embed(messageEmbed)
message.channel.send(embed.embed)```
everyone blocked now
Im try to do giveaway/trading bot
LOL wait for sharding
Why me?
@novel hollow i dont accept random friend requests
gn embed builder lovers @opal plank @sudden geyser @zenith terrace
I thought it wasn't gonna work tbh
you can import it
wait actually yes mind
idk why you need it but
gnight other embed builder lover
should be under detritus-client
aight found it
@mellow kelp use discord-rose gn
Patreon is hard ๐ฆ
imagine recommending people an unfinished library that clearly says its not meant for production over a pure ts, fully functional and better than d.js library
and using deprecated --save
amazing
seriously i can't get over how useful is the fact that every file has declarations
gotta love typescript libs
can anyone say how to lock to lock all text channels?
IKR
dunno py, so not me
I mean discord.py
i know, and i said i dont know python
ohk
i know what you need to do, im familiar with discord api, but i cant tell you what to use in discord.py
/// it is running even when last_monthly_claimed == 0
if(last_monthly_claimed !== 0){
}```
i just moved from flask to quart
and my wsgi needs to be asgi
if __name__ == "__main__":
app.run()```
this is wgsi
how do i make it work for asgi? ping me pls
const ToTalSeconds = (client.uptime / 1000);
const Days = Math.floor(ToTalSeconds / 86400);
const Hours = Math.floor(ToTalSeconds / 3600);
const Minutes = Math.floor(ToTalSeconds / 60);
const Seconds = Math.floor(ToTalSeconds % 60);
const Uptime = `${Days} Days, ${Hours} Hours, ${Minutes} Minutes & ${Seconds} Seconds`;
const MemoryUsage = process.memoryUsage().heapUsed / 1024 / 1024;
const RamUsed = Math.round(process.cpuUsage().system) / 1024;
const RamUsage = Math.trunc(RamUsed);
const BotPlatform = process.platform;
const MemoryUsed = Math.trunc(MemoryUsage);
const Os = require('os');
const OsHostName = Os.hostname();
const SystemPing = Math.round(client.ws.ping);
const exampleEmbed = new Discord.MessageEmbed()
.setColor('#b700ff')
.setTitle("Bot's Live Status")
.addField(" \u200B ", "**Bot Uptime** : ` " + `${Uptime}` + " `")
.addField(" \u200B ", "** Bot's Hot Name** : ` " + OsHostName + " `")
.addField(" \u200B ", "**Bot Current Version** : ` " + "1.0" + " `")
.addField(" \u200B ", "**Global Bot Prefix** : ` " + "s!' + " `")
.addField(" \u200B ", "**CPU Usage** : ` " + **RamUsage** + "Mb `")
.addField(" \u200B ", "**Memory Usage** : ` " + MemoryUsed + "Mb `")
.addField(" \u200B ", "**Bot Platform** : ` " + BotPlatform + " `")
.addField(" \u200B ", "**System Ping** : ` " + SystemPing + " `")
.addField(" \u200B ", "**Channels** : ` " + `${client.channels.cache.size}` + " `")
.addField(" \u200B ", "**Servers** : ` " + `${client.guilds.cache.size}` + " `")
.addField(" \u200B ", "**Users** : ` " + `${client.users.cache.size}` + " `")
message.channel.send(exampleEmbed);
I get an error
SyntaxError: missing ) after argument list
You're probably missing a closing ) somewhere
nvm
it was a typo
How can I add total number of members
for each guild
to a variable
Loop trough each guild and get it's total number?
let guilds = client.guilds.cache
let i;
let bruh;
for(i=0; i<guilds.length; i++){
bruh + guilds[i].memberCount
}
I tried something like this
it keeps giving -
0
Do you even have intents?
mhm
I have the member's intent
privilged one
and all others
except the uh presence
Can anyone help me figure out what a font is from a picture
There are scanners on internet
Where you just put the image and it detects the font
Use that
I'm trying to make this Chess image show up in Discord but its not, does anyone know why? http://tribuntu.jumpingcrab.com:5000/channel/632465279040880670
I found this but have no idea wtf is does
https://i.imgur.com/XF6sFPU.png
Prob cuz this url so sketch that discord's embed tool doesn't wanna open it

I cant really find any loop to get all members lol
Tried but cannot find one that can accept the picture
Every scanner does
Just send your picture I'll use google for you
I know using google is hard sometimes
Trying to figure out the text at the very top of the website that says welcome to the official website for Echo
That's all we have
No we do not have it anymore
omg
Kek
that just looks like italic arial tbh
Might be that:
Monotype Baskerville eText Bold Italic
any alternatives to fetch_user? it takes long to fetch multiple users
Tracking the user data in a local database
@solemn latch if i had to add the user's name, what if they change it?
i have to fetch_user them during all events in order to keep track if they change their name?
Generally you would expire data over time and update it when you need it.
It won't be perfect but it won't be slow.
xd
I had this problem yesterday too
My bot dosen't show the custom status.
When I did console.log it showed this
The status still isn't showing
so any solution ?
this is output of my code
https://paste.gg/p/anonymous/c4a0f70ac8b34dedac536a7a3ff967d4
how can i get the content? (collected.content)
dataVariableName.collected.content
/poll "ะัะพ ะทะฐ ะฟะตัะตะฝะพั ะฑะฐะทั?" "ะะปัะบะฐััะฐั" "ะขะธัั"
huh ?
i tried and it didn't work
can you show the error ?
undefined
variable.collected.content is undefined
so content is undefined otherwise it would show Can't read value content of undefined
variable.collected is https://paste.gg/p/anonymous/bbe4cf361b2e4013a52dfe1d21fbb976
oh f it's a map
so ?
hol on
i tried variable.collected[0].content but it didn't work
Map.find(key => key == "811501787281752067")
Does the key not change in every message?
but it'll not be dynamic
client.user.setPresence({ activity: { name: 'client custom status', }, status: 'idle|dnd|online|invisible' });```
thanks
You're welcome
array = Array.from(map, ([name, value]) => ({ name, value }));
Use this to convert to an array and then do it
okay i'll try
array[0]
or simply array = Array.from(map) should do in your case @versed shoal
./start.sh ???
@lethal gulch did you chmod +X ./start.sh before doing that ?
no
are you on Linux ?
no
huh ?
Then where are you trying to run that ?
i tried as console.log(Array.from(variable)) and output is []
start.sh ne
ne yapmaya รงalฤฑลฤฑyorsun
web panel
does bash even run on Windows ?
tamam
Google translate : "They are talking Turkish"
yes
yes
he said "i fixed it"
array = Array.from(map, ([name, value]) => ({ name, value }));
Then you gotta use this
i tried as ``console.log(Array.from(response, ([name, value]) => ({ name, value })))` and it's still the same
<link rel "icon" href="../images/siteicon.png" type="image/x-icon" />```
where is the mistake
yanlฤฑลlฤฑkla enter bastฤฑm
1|server | Unable to connect to the Mongodb database. Error:MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/ error
:(
i dont know
Make sure your current IP address is on your Atlas cluster's IP whitelist.
I have never used MongoDB
@versed shoal it's done already
Is there a way to eval python code in js?
Throw Python code into a Python interpreter and use returned values
could get something going with exec
but be careful to properly sandbox and virtualise code execution context
unless you are sure that anything you run is safe
How can I use the awaitMessages function in Eris?
You need to listen to the new event listener and use the new message for your awaitMessages logic
dafaq bruh
You should check out the logic behind Discord.jsโ one and write your own abstraction to do it
partials

the message isn't cached
so it doesn't trigger the event
you can although use raw event and get that...
^_^
yeah that also works but I don't also share useful tips 
- is the prefix, it does not have many commands though
I want to implement a feature in my bot to allow server admins to set a "remind" like feature, for example, post a graph every week. I have seen many approaches to this, but i have been wondering what is the best, most effiecent approach?
luca prefix what
still -
ok
ok ฤฑ know
@opal plank you able to help with ts now?
its 8am for him, hes probably sleeping
for(let mention of message.mentions.users) {
message.content = message.content.replace(mention, mention.username)
}
thats smart
Hello!
hi!
I'm writing my question, AHH.
// The stuff...
data.money = 0;
data.bank = 0;
data.bankLimit = 1000;
if((args[0] + server.bank) > server.bankLimit) return message.channel.send("Nonono, too much!")
I am trying to make a limit on my economy commands where they cannot deposit coins more than the limit which is 1000.
So if someone deposits coins more than the bank limit then it returns, or something like that.
args[0] will be a string or a number
number.
what do you do to make it a number?
the standard args = message.content.slice(prefixLength).split(' ')
Ok.
args[0] should be a string if split from message.content
@quartz kindle is there a way for me to bind a single function to 2 different client.on()s?
well
I can do client.on('x', y)
Basically I had 500 coins in my money and I have 100 coins in my bank, if I deposit my coins and it equals more than the bankLimit then it returns..
and client.on('z', q)
thats likely becase strings can be added as strings but will compare value with numbers iirc
sure you can
Oh
I didn't do anything, I guess.
You mean parseInt?
parseInt("10") -> 10
Yes, used that.
"1000.111111" -> 1000
I'm testing again.
I'd say it's better to use the NumberConstructor to parse numbers
unless you're working with floats
If you pass it a float it returns a float so meh.
new Number();
Number(string);
parseInt works!
I guess one line of code solves that!
Thank you all!
uhm what
lol js const x = new Class(); x()
ok
what do you want to do
__call__ gang
im not sure anymore
๐
async def __call__(self):
print("extra flare")

data.money += reward;
data.beg = Date.now();
data.save().catch(err => console.log(err));
// The part here where I define the /100 chance and check if the user got the number "1", and if so then I would add to his data.money and .save(), but saving doesn't work twice! :(
Usually after this code, which is after the .save() part, I do an if statement to check if the user out of 100 chance got the number 1, then he would win a prize, but unfortunately, I can't .save() twice, so what can I do instead?
Do the check before saving?
if(user won the /100 chance money) {
give out the money for /100 chance
.save()
} else {
.save()
}
Like that? Yea?
data.money += reward;
data.beg = Date.now();
While this is not in the if statement but above it?
const entry1 = await member.guild.fetchAuditLogs().then(audit => audit.entries.first());
The bot can't fetch audit log
It doesn't have the permission to
"100" + 100 = 100100
if (hasWon) {
// Do something with the amount you're adding.
}
// save after the statement
When you read a documentation a little bit closer and you can shrunk your method to a simply method call 
Maybe u should read the docs 
Can I make it like equal to 1 - 50?
From 1 to 50?
The amount won?
I'm a little lost.
Example, I have a random chance which is out of 100, and if the random chance was equalling from 1 to 50, then it console log yes.
But I just need the part of from 1 to 50
n >= 1 && n <= 50?
Or just n <= 50
if(chance >= 1 && chance <= 50)
Like that?
if(chance >= 1 && =< 50)
Or like that.
Not this
first
the second one is not valid javascript
=< doesnt exists or?
If I want it between 10 and 30, then if(chance >= 10 && chance <= 30)
It's like doing if (x == y || z)
It's trying to do if (x == y || x == z)
idk
and if I want to make chance if equalling to multiple numbers, then if(chance === ["1", "2",])
no
f.
You might wanna read this, my friend. <#development message>
concat with &&
Throwing together characters when you haven't learned the language isn't programming, it's button mashing.
I can use indexOf, I guess.
But yes as he says, you have a much better time once you look at the language itself, before you try to build a bot
The includes() method determines whether an array
includes a certain value among its entries, returning true or
false as appropriate.
K
eh?
just ignore 
I require a good suggestion for what lib I should use to interface with a postgresql db. Coming from MySQL/Maria
lang: NodeJS
pg
Yeah just literally connect with the pg module, it's fine if you know SQL
I don't like some of the implementations of ORMs. I was looking at pg and postgres. I wanted to see if a module designed for mysql would work, but I decided against it since I know they're different standards of SQL
the syntax is similar but yet still different
I think sequelize is good
!halp
damn yall bot developers
well, this is the development channel for a large discord bots website, what did you expect?
Does pg not support prepared statements?
Ah. nvm. I see that it's prepared statement implementation is different from mysql's. Not using ?s to delimit prepared.
wdym this is a car racing server
So
I converted drive from MBR to GPT
And now
When i restart the pc
It doesnt boot
omg, I'm lost
sorry I'm not good at hardware
@cinder patio bot.commands doesn't exist, but I tried to extend the client, and said it's undefined when I try to set the command
show de code
you need to go into your bios and enable uefi mode
interface Cmd {
name: string;
aliases?: string[];
execute(bot: Client, message: Message, command: any, db: any, lang: any, language: string, prefix: string, args: string[], serverSettings: Object): void;
}
export class botClient extends Client {
commands: Collection<string, Cmd>;
}
const bot = new botClient();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.ts'));
if (commandFiles.length === 0) return;
for (const file of commandFiles) {
const props = require(`./commands/${file}`);
bot.commands.set(props.name, props);
}
Cannot read property 'set' of undefined
You only specify that botClient has the commands property, but you don't actually create it in the constructor
but, doesn't it also have what Client has?
it does, but it doesn't have the commands property
o_O
you need to create it in the constructor of the new class

