#development
1 messages · Page 1313 of 1
Flaze I'm only having problem because I'm trying to add a skip to my bot and i didnt copy and paste
@pale vessel
what is bil code
Do you know any code sharing server?
yes
will you?
will i what
You will send the invitation link
it a small server but ok
this convo gave me braincancer
ValueError: time data '2020-10-11 01:50:22.734231' does not match format '2020-10-11 01:51:22.734231'``` intresting...
const MongoClient = require('mongodb').MongoClient;
const uri = "mongodb+srv://cwicks:NO@cluster0000.knta7.gcp.mongodb.net/Cluster0000?retryWrites=true&w=majority";
const clientDB = new MongoClient(uri, { useNewUrlParser: true });
clientDB.connect(err => {
const collection = clientDB.db("test").collection("devices");
// perform actions on the collection object
clientDB.close();
})
const db = clientDB.db('db')
```This doesn't seem to work
MongoClient must be connected before....

do I have to use a case though
Can't I just change it and do a if statement for the reaction
Try logging inside your filter and seeing what's up
It was working yesterday
db.get() is not a thing in mongodb???
the docs are pretty well documented for mongo fyi
plus .find() should pretty much get anything you need
What is collection?
- Db inserts are likely to be asynchronous and if you want to ensure insert success, you should callback/promise
- I think you need to await reacting the initial checkmark as well, to prevent the collector from counting your bots reaction
also is there any reason why you cant use awaitReactions?
@blissful coral Step by step debugging, is the filter being called correctly, is the filter passing correctly, is the collect function being called at all, like, at all.
vote kick cmd will
yeah I know
await reactions will work just fine
set a limit of reactions needed
and a timeout
oh unless you want reaction feedback
so I replace .get with .insertOne
mongoose is much easier to use for mongodb databases imo
@blissful coral could I look at the complete code for your collector?
yeah let me pull up a bin
await mongoose.connect('mongodb://localhost/my_database', {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
useCreateIndex: true
});
Is the second para really req?
Currently faking discords.net's interfaces :^)
Note sure exactly what to test yet, but I'll be ready when I need to after I implement the fakes 
yeah that if(...)return {... is not correct
return ends a function
not an if statement
@mild flower
Update on my shit: All I am gonna say is FUCK INTENTS
why
o
const MongoClient = require('mongodb').MongoClient;
const assert = require('assert');
var mongoose = require('mongoose');
var mongoDB = 'mongodb+srv://NO:NO@database.knta7.gcp.mongodb.net/TESTDB?retryWrites=true&w=majority';
mongoose.connect(mongoDB, {useNewUrlParser: true, useUnifiedTopology: true});
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'MongoDB connection error:'));
```Where is data saved when I do this?
?
when i restart the bot, it goes back to the default prefix
welp
var mongoose = require('mongoose');
var mongoDB = 'mongodb+srv://no:no@database.knta7.gcp.mongodb.net/Database?retryWrites=true&w=majority';
mongoose.connect(mongoDB, {useNewUrlParser: true, useUnifiedTopology: true});
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'MongoDB connection error:'));
```hmmmm
In this video I go over how to have your command prefix be configurable per Discord server. I cover this using v12 of the Discord.JS JavaScript library.
PLEASE DO NOT LEARN DISCORD.JS WITHOUT LEARNING THE BASICS OF THE JAVASCRIPT LANGUAGE FIRST.
🖥️ Source code:
http://wornof...
@carmine summit learn from him
He using mongo to set prefix
var mongoose = require('mongoose'); var mongoDB = 'mongodb+srv://no:no@database.knta7.gcp.mongodb.net/Database?retryWrites=true&w=majority'; mongoose.connect(mongoDB, {useNewUrlParser: true, useUnifiedTopology: true}); var db = mongoose.connection; db.on('error', console.error.bind(console, 'MongoDB connection error:')); ```hmmmm
@carmine summit that code is 10000% wrong
the yt vid is sus
Do I need any special Intent to use this?
const game = member.presence.activities.find(activity => activity.type === 'PLAYING');
they don't know if you're checking one or one thousand
I don't need the PRESENCE_CHANE event
so of course
you don't receive presence data if you do not have that intent
@opaque seal if Discord removes one of those dumb limits chaos will happen
if(!channel.id === '764731044477665280') return message.channel.send('sorry but you can only do that command in my support server, in the channel: `"emojis-approval"`')
bruh use !==
remove ! on the front
ReferenceError: channel is not defined
well, define the channel
man ui sucks
takes so long
still gotta get a cdn aswell for the auto updater... yikes
I need some help
so I wanna make a feature in a bot for random num genarator
function getRandomIntInclusive(min, max){
max = Math.ceil(90);
min = Math.floor(1);
if (message.content === '-roll')
message.channel.send(getRandomIntInclusive)
this is what i got so far
@polar sigil that is so wrong
it is gibberish lul
It's also passing in variables, then assigning to them for some reason....
Even if you fix the syntax errors, the logic is all wrong
the yt vid is sus
@marble juniper lmao
we should vote it out
oof
You're rounding whole numbers 
Wtf lmao. This is one of those things where the more I look at it the worse it gets
Math.round(1)
is 1
study math
Math.floor(Math.round(Math.pow(1)))
read docs plez @polar sigil
Do you guys think this is a good way to make a tic tac toe game?
var data = {
row1: {
column1: null,
column2: null,
column3: null
},
row2: {
column1: null,
column2: null,
column3: null
},
row3: {
column1: null,
column2: null,
column3: null
}
}
canvas.addEventListener("click", (m) => {
// return if the place where the user clicked already has a counter placed or it is not a part of the board
// do stuff to 'data' if it is a legit click
});
function update() {
// redraw the canvas
}
Or just learn the language.
At least he didn't copy and paste anything for sure lmao
there many yt videos
you should make a boolean matrix
@earnest phoenix seems good to me
[][]
there many yt videos
@flint yew can you stop recommending YouTube tutorials they're outdated 99.99% of the time
you should make a boolean matrix
@compact oriole a what?
message.guild.verificationLevels turns undefined
2D array would work just fine
[][] this thing
@flint yew can you stop recommending YouTube tutorials they're outdated 99.99% of the time
@earnest phoenix lmao u sure
do i need add caches?
this
yt tutorials suck
then you can use it like x and y
so x = arr[2 (x)][1 (y)]
message.guild.verificationLevelsturns undefined
@pearl trail it'slevelor is itlevels?
idk ;-;
yt tutorials suck
@marble juniper yes but not all some are good and even in language they speak
try it and see
i'm write it with s
lemme test with my eval
@tame kestrel
okay,
why would it be with an s
Safe plz
Russian :/
:/
😐
Yup it's level not levels
hi


isn't it obvious that there shouldn't be an s?
how would a server have multiple verification levels
wait what
damn
lol where is the coloration
hm, rip grammar
@vale garden god use https://hasteb.in
lmao
hahahaha
i'm bad at grammar lol ;-;
const timer = Math.floor(Math.random() * 47 + 18);
const real = timer * 60000;
setInterval(() => {
let pkmns = ["https://i.pinimg.com/236x/80/6d/ea/806dea7c71b5c02affd2b051784a3647--haunter-pokemon-ghost-pokemon.jpg", "https://pokemon.gishan.cc/static/i/p/gengar.jpg", "https://qph.fs.quoracdn.net/main-qimg-d21cc854449a1b6142a1838e3cd78634.webp", "https://www.pngitem.com/pimgs/m/451-4516899_mega-ghost-type-pokemon-hd-png-download.png", "https://static.wixstatic.com/media/2e36a5_5617ecca59394c228c1eb33353d6816b~mv2.jpg/v1/fill/w_994,h_730,al_c,q_90/2e36a5_5617ecca59394c228c1eb33353d6816b~mv2.jpg", "https://static.fandomspot.com/images/02/4903/20-dusknoir-anime-pokemon.jpg", "https://www.ordinaryreviews.com/wp-content/uploads/2018/07/chandelure-e1531540398921-800x519.png", "https://www.ordinaryreviews.com/wp-content/uploads/2018/07/cofagrigus-e1531540503348-800x536.png"]
let pkmn = Math.floor(Math.random() * pkmns.length)
bot.channels.cache.get('630791036431499264').send(pkmns[pkmn])
const filter = m => m.content.includes(':pokeball:');
const collector = message.channel.createMessageCollector(filter, { time: 15000, max: 1})
collector.on('collect', m => {
db.add(`inv_${m.author.id}`, 1)
message.channel.send("The Ghost Pokémon has been captured!")
const filter2 = n => n.content.includes('points');
const collector2 = message.channel.createMessageCollector(filter2, { time: 15000, max: 1})
collector2.on('collect', n => {
let points = db.get(`inv_${m.author.id}`)
message.channel.send(`You have ${points} points!`)
})
collector2.on('end', collected => {
})
})
collector.on('end', collected => {
})
}, 10000)
uh
ffs
lamoooooooooooo
lol
@coral trellis
Great
@real shale fucking stop
lmfaoo
spam xd
@real shale is constantly sending memes/images here and flooding the chat
xaxaxaxaxaxaa
Keep this channel related to development
lol
i need help
so how do i end the previous collector after the next message has been sent
like the bot sends 2 images
and if i type the collecting message
Ty xig
collector.end()?
bruh
Made some changes
https://hastebin.com/tozexiyosa.js
the x and o variables are images
hey i need help with css
is there any way to set a background pic in the bot's long description using html ??
@open zodiac Using some style tags you can override classes that already exist in the bot pages.
@polar sigil that is so wrong
@earnest phoenix lol it wqsnt meant to be perfect or even code i just asked for reference
You're rounding whole numbers
@faint prism yes i need to round numbers this is mesnt for whole numbers
meant*
${bot.guilds.cache.size} for guild, what for members?
ty
anytime
I wanna see if a user has specific role in my server (Discord.js)
I checked if he is in my guild
But how can I check if he has the role
@delicate shore If you have the role id you can do <GuildMember>.roles.cache.has('ROLE ID GOES HERE');
https://discord.js.org/#/docs/main/stable/class/GuildMemberRoleManager?scrollTo=cache
Okie thanks
i have commit organization
Could I get some ideas how could I find username in a command that looks like this:
!reject User with space in name#0001 Rejection reason
Some regex perhaps? Joining arguments into a single string and then splitting them by #0001, I'm not sure how would I do that as I don't know what the number is.
The mention?
In this case, user is not mentioned, their username which may or may not contain spaces is written.
Use a separator and split() ? Like !reject user | reason instead ?
Just came up with this
let args = 'User with space in name#0001 Rejection reason';
let argsSplit = args.split('#');
let username = argsSplit[0];
let id = argsSplit[1].substring(0, 4); // Remove " Rejection reason"
let reason = argsSplit[1].substring(5); // Remove #0001 + space.
let user = username + '#' + id;
console.log(user); // "User with space in name#0001"
console.log(reason); // "Rejection reason"
Not the cleanest solution but works.
Any ideas on improving it tho?
Obviously I need to implement detection in case arguments are empty, etc.
You can use regex to get the name, and if the name has spaces you can use quotes around the name or something
Yes, check if the user is trying to run the command
You can use regex to get the name, and if the name has spaces you can use quotes around the name or something
@tame kestrel Quotes as well as a separator as @vestal swallow mentioned would work just fine, but you gotta make it as easier as possible for users.
Well, I'll do some tests with various usernames and let you know, hope it will work fine. Thanks for help!
Is there a way to reboot my bot with Python?
how do you get the last delted msg in a channel djs?
Is there a way to reboot my bot with Python?
@hasty mulch If you use a process manager like PM2 for Javascript, you could restart it with a shell command, which in Python could be executed withos.system('echo something'). Just be careful with those.
There's probably a better way tho.
how do you get the last delted msg in a channel djs?
@silver lintel The solution is just 1 Google search away, https://stackoverflow.com/questions/52504449/snipe-command-that-shows-last-deleted-message.
TLDR
bot.on('messageDelete', (message) => {
console.log(message);
});
@silver lintel @stoic girder How about we do stuff properly and NOT use json as dynamic databases?
just Map it and store it in memory with channel id
its legit 3 lines of code
can somebody explain to me why this is showing even though i did this?
none of that bs with json with reading and writing which will likely corrupt it at some point
Yeah agree. I don't use JSON my self for anything other than a config file, just showed an example.
How does the storing in "memory" work tho?
Whats faster, mongo, or postgres
snipes = new Map();
on.('delete') => sniper.set(channel, message)
thats it
@honest perch do you really need faster?
Yes
absolutely?
I want speeeeeeed
then use cassandra or something scalable like that
how do you delete if like no snipe cmd after an amount of time?
im dealing with tops 80k per 15 seconds, postgres has been handling it
@opal plank That will be gone if bot is restarted I assume. Not a problem tho as it's only snipes.
I'll try postgres then as I cba to set cassandra up
for persistent data
True, just asking.
actually, my bad, not OR, AND
I'm using SQlite myself, and now I'm sad I didn't choose Mongo from the beggining.
keep store to quick access and just keep dumping it on database
Will migrate at some point...
cof cof postgresSQL and Cassnadra cof cof
I want speeeeeeed
@honest perch
what library
Google works fine on any browser on any device but browsers which I cleared data for accounts.google.com (Brave and Cryptotab)
Anyone know why? I googled it and found there is already a thread for this on support.google.com saying that google is working on a fix but IT'S BEEN THERE FOR 6 MONTHS
PLEASE
Use Linux?
uh
what?
Linux sucks for me
Linux isn’t bad tho
It won't even turn on properly
Linux is probably one of the better operating systems (well, group of them)
and why are we chatting about OS' that's not the problem here
it could be
i'm gonna see if my browser is outdated
and update it
or i can just spam email google from my phone
Try popOS
❓❓❓w h a t❓❓❓
most of the time it's under about browser
I have a stable computer
WAIT CAN FIREBASE CLI MANAGE ANYTHING FIREBASE RELATED
I'M ALREADY LOGGED IN
hello guys im using a discord.js shard but my bot so restarting i how to fix this my problem?
please help me
I'm having a problem with the mysql library for nodejs (https://github.com/mysqljs/mysql)
I have this code: (the loggers are there because i was debugging)
function query(query, func) {
console.log('Query');
pool.getConnection((err, connection) => {
console.log('QueryGetConnection');
if(err) throw err;
connection.query(query, (err, data) => {
console.log('QueryFunction');
if(err) throw err;
func(data);
});
});
}
For some reason, after a while the function that i pass to pool.getConnection() no longer gets executed. Nothing at all happens: no errors either. The function just no longer executes. Does anyone know what the problem might be?
I think my problem also only starts appearing whenever the shard has to reconnect
Please give me feedback hehe P[lease note the elgato pictures are just for display, ill put my physical products in soon!
@heady heron we're not a place to ask feedback for your bot
why not ask for feedback on your own bot's support server
@heady heron rude
and we're not a server to ask feedback for weird shit anyways
if you want you can ask help with programming
yes, he's new, just like you
Stop both of you before i call a mod
guess, they're stopping xdd
Lol
-bots @heady heron
This user has no bots
Ye nope
Im working on one
oh nice
Well its done but not released yet
Nice
like elgato but itll be cheaper and easier
hehe
What language?
c#, but writing an api in so i can use js py to handle all sql events and data management. only doing the ui/ux in c#
@heady heron you're rude tbh
are PNG images supported in HTML favicons?
<link rel="icon" href="/assets/favicon.png" type="image/png">
in modern web browsers yes
but that ain't working
@heady heron c# is the worst language to do ui in lol
try clearing cache, code
@heady heron c# is the worst language to do ui in lol
@earnest phoenix unity.....
unity is a game engine
that uses c#
and has UIs
well
big brain time for unity
the scripting is done in c#, there's more magic behind it with mono
they are most likely using winforms/wpf/uwp
which all are so bad
why did they remove unity script
i spent my whole week's internet to download unity only to realise they remove it
can i make my bot join a guild through an invite link?
no
take a guess
no
smh this ain't working
at least
bots cant be in group dms
yes
is there any way to invite bots to group dms
@mild flower make them accept a user's friend request then add them to the group DM

lol
lol
lol
thats abuwse right there
w h a t
@earnest phoenix just put the favicon where your index is
<!DOCTYPE html>
<html>
<head>
<link rel="icon" href="/assets/favicon.png" type="image/png">
</head>
<body>
</body>
</html>
how da hell is this not working
@mild flower make them accept a user's friend request then add them to the group DM
big braieun
browsers look for a file named favicon
ok
updating my browser brb
wow my fucked up more than fuck mouse just deleted the file for no fucking reason
I just added this and it works (the PNG transparency doesn't work tho)
<link rel="shortcut icon" href="https://cdn.discordapp.com/icons/721707451375943740/646a516f8fefc98b8628d0bf9fa99e64.png" type="image/x-icon">
wait
there is no transparent stuff in the image
lmao
how do host on heroku
pins
k
why can't i serve js files from a folder in my public directory on firebase hosting?
this is my folder structure:
public
|_index.html
|_404.html
|_main.css
|_assets
|_<images videos and stuff>
|_js
|_top-nav.js
this is my HTML code that's referencing the js:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/main.css">
<link rel="shortcut icon" href="https://cdn.discordapp.com/icons/721707451375943740/646a516f8fefc98b8628d0bf9fa99e64.png" type="image/png-icon">
<script src="https://d3js.org/d3.v6.min.js"></script>
<script src="/js/top-nav.js"></script>
</head>
<body>
<div id="top-nav"></div>
</body>
</html>
||help me @misty sigil lol||
@mild flower you're missing the <>
no im not
whenever i add the <>
iT just tursn into :urmom: so i just removed it for that message
the brackets are in the code
you don't have access to the server of the emoji?
i do
id is correct
name is correct
its the first server the bot joined
everything should be correct
@mild flower show your code
if (!message.guild.me.hasPermission("SEND_MESSAGES")) return message.author.send('Please give me permissions to send messages.')
const Erate = new Discord.MessageEmbed()
.setTitle('Rate')
.setDescription('**Usage** : ``;rate (user)``')
.setColor("RED")
let rateduser = message.guild.members.cache.get(args[0]) || message.mentions.members.first() || message.member
if(!rateduser) return rateduser = message.channel.send('Please provide a valid user from this server to rate');
if(rateduser.id == 411548232133640203) return message.channel.send('I would rate you ``10/10`` :urmom:')
if(rateduser.id == 728176491514298478) return message.channel.send('Me? I don\'t know what to rate myself.')
let ratenumber = Math.floor(Math.random() * 11)
message.channel.send(`I would rate ${rateduser} a \`\`` + ratenumber + `/10\`\``).catch(err => {
message.channel.send('That username is too cringe to rate.')
})```
id must be string
ah damn it changed it
to :urmom:
its this in the code
discord just changes it whenever you type it
id must be string
@woeful pike even a blasted admin has to tell people to put snowflakes in strings
:urmom:
yeah see?
i don't have nitro so i can't do that
also ur not in thea guild that emoji is in
bots need to be in the server to do that but they don't need nitro
smh
Does anyone know how top.gg are pinging bots to find if they're online or not? Only way I could find to do it was by having another bot in the same server as the bot. Was wondering if it was possible to do via OAuth2
Does anyone know how top.gg are pinging bots to find if they're online or not? Only way I could find to do it was by having another bot in the same server as the bot. Was wondering if it was possible to do via OAuth2
@deft grotto They're implementing smth in the API libraries. I guess they'll regularly send pings to top.gg telling them "Hey this bot is still online!" and when the website doesn't get a ping it marks the bot as offline
@deft grotto <They invite the bots to check if they're online or not, or just fetch the bot user with ID and check presence>
@deft grotto <They invite the bots to check if they're online or not, or just fetch the bot user with ID and check presence>
@earnest phoenix fair, was hoping there'd be an OAuth2 solution but it'd appear not
can anyone help me export my discord bot project in a single .exe file
i need it to work across computers
@willow yoke Log what role returns
['role id']
@solemn jolt can u elaborate ur bot activity before?
can someone tell me how can i leave the bot photo round. I know how to make css, border-radius. But I can't leave the round photo
what is the id or class of this photo ...
Does anyone know how to log the the people who react in a message discord py?
Does anyone know how to log the the people who react in a message discord py?
@potent stirrup the the
@main hound try right clicking the photo and click inspect
(if you have a chromium based browser)
@potent stirrup the the
@earnest phoenix the user who reacted
@main hound the parent div element has the class bot-img
ok
How to make the bot active 24/7
with a vps
bruh
if (...) {...}
Does anyone knows how to create an image from a guild picture?
that is already an image, sir
in which library
d.js
K thx
Can someone send me a link or an example for something like a queue if a bot gets rate limited? Or something similar. I highly doubt that my bot will ever need this but I just want to add it early on so I don't need to later XD
chances are your library does it for you
if not, you'll have to modify your lib's source because ratelimit info is internal
Oh fair point
Didn't think of that
I use discord.js so I imagine that it would
Thanks
@drifting wedge wdym
1 sec
@livid lichen there are dozens of alternatives
Really? I guess I should have researched before coming here. I expected there to be none.
well considering the purpose of enmap is to store data, literally any database system out there (there are hundreds) could be considered an alternative
but if you're looking for something with a similar degree of ease of use and simplicity, check out quick.db maybe
its made for js
Perfect. Thanks!
it does more or less the same thing as enmap does, its a wrapper around the sqlite database
oh
whats the error you're getting?
How many errors should I show?
I have to edit it then because it has my name in a bunch
Oh okay
oh my god it has a lot of my name.

Just found out It's no longer supported and it's enmap not npm.

It's giving an error that it can't find bin.js
and python
rror: Cannot find module 'C:\Users\prebuild-install\bin.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:747:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
that was the first error
how can i slice off the first character of a var?
python
and how do i like check for the first character?
@livid lichen open powershell as administrator, and run npm install -g windows-build-tools
windows 
and wait until it ways "All Done" (should take around 10-20 mins)
and wait until it ways "All Done" (should take around 10-20 mins)
@quartz kindle remember the domain thing?
the amount of check marks are going down,,,
why opengraph sometimes make my image big and small
help me get the icon small
provide a smaller image in the og image meta tag
@livid lichen open powershell as administrator, and run
npm install -g windows-build-tools
@quartz kindle Still waiting for installer log file...
?eval
const foo = async () => {
let lowest = 0
await client.guilds.cache.forEach(g => {
if(g.members.cache.size > lowest) lowest = g.members.cache.size
})
message.channel.send(lowest)
}
foo()
That finds the guild with most users
it's stuck on Still waiting for installer log file...
just use sort and index the sorted array lol
@quartz kindle It's been stuck on Still waiting for installer log file... for 5 minuets now. Is it supposed to to that?
Help, i tried create small widget which show status, but when i paste code to website it becomes big widget
read the docs
thx
i don't know, does it?
coinsData.money += args[0]
why does the number not get added but rather the value put in args[0], get added to the end of the number?
Example:
5000 (before)
5000400 (after)

oh
because args is an array of strings
you need to parse the arg as a number
website icons should be in the .ico format
website icons should be in the .ico format
@quartz kindle they can be in png format too i think
for png you need to set it to type="image/png"
hi I am not able to figure out how to use the JOIN GUILD MEMBERS perm
can someone help?
what are you trying to do?
i am trying to auto join members with a bot for giveaways
while scouting the documentation i saw this
you need to use oauth2 for that
ye but i tried searching anymore is the code message.members.guild.join("id)?
there is no code for that
uh wdym?
it requires oauth2, libraries do not provide oauth2 features
ok then what do i use?
the user needs to "login with discord" in your website, and give you permission to make them join a guild, then your webserver needs to send discord a request
yes, oauth2 is everything that requires the user to login with discord
ah okay i saw a bot doing it, it probably is the webserver adding the users and the bot just sending a message
yes, a bot can be connected to a webserver
random usernames?
if thats what he means, then yes, fetch all members, then chose a random one
in discord.js its guild.members.fetch()
discord.js also gives you collection.random() i believe
hewlo guysss hovv can i make it owoify evewything?
@solemn leaf my bot already did that, but eh, you need to replace spefic text
@sand dune just uh
Get random member from guild, and send that member username
.replaceAll
text = text.replace("w", "vv").replace("love", "luv").replace("lol", "lul").replace("l", "w").replace("r", "w").replace("!", "!!!");
Haypetr/
.replaceAll() does exist, its a new thing
JavaScript now has first-class support for global substring replacement through the new String.prototype.replaceAll API.
Totomatee, you need to do .cache.random()
ES2021
collections do have a random, no?
ES2021
its not a lie
its just not released yet
it was added in v8 8.5
node.js 14.6+ is still on v8 8.4.3
should work on the broweser tho
You can use regex to replace all instances of a string anyways
You can use regex with replace
Does it replace all occurances of a string?
Ok
Is it possible to make Mobizen only record the phone sound and not the microphone. It records them both currently.
It used to be an option
But recording internal audio on android is currently against TOS iirc
So it has to be both for now
dear google,
fuck you for not allowing us to record only internal sound
sincerely,
ME
I'm just gonna plug my dad's earphone in my phone and record
The microphone doesn't work anyways
@faint prism yes i need to round numbers this is mesnt for whole numbers
@polar sigil ok, but you're telling your computer to round a whole number to a whole number.
You see why that doesn't make sense, right?
I still need to learn regex
@thin turret i don't because i don't manipulate strings 🙂
I'm just gonna plug my dad's earphone in my phone and record
The microphone doesn't work anyways
@earnest phoenix if you have an aux cable and a pc you can use audacity

I have no money to buy Among Us on pc 😭
L
get it cracked
L
@thin turret L?
fr though it's a unity game, super simple to crack
L as in Loss, another way to say rip
get it cracked
@earnest phoenixI know how but I pirate nothing other than marvel movies and Minecraft
"I took an L in basketball today"
"I took an L in basketball today"
@thin turret you sent the ball flying in one straight line then it suddenly took a ninety degree turn and started going in a straight line in that direction???
var mongoDB = 'mongodb+srv://no:no@database.knta7.gcp.mongodb.net/Database?retryWrites=true&w=majority';
mongoose.connect(mongoDB, {useNewUrlParser: true, useUnifiedTopology: true});
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'MongoDB connection error:'));```
hmmmm
==== JS stack trace =========================================
0: ExitFrame [pc: 0162A017]
Security context: 0x26740469 <JSObject>
1: new User(aka User) [3CA4B4AD] [C:\Users\dalia\Desktop\Adventure RPG\Adventure RPG\node_modules\discord.js\src\structures\User.js:~20] [pc=63B8296B](this=0x2d9002f5 <the_hole>,0x04e856ad <EventEmitter map = 169C5155>,0x22f12fc5 <Object map = 476B8C0D>)
2: ConstructFrame [pc: 015B8D22]
3: new GuildMember(aka GuildMember) [25300505] [C:\Users\dalia\Desktop...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0118BE3A v8::internal::Heap::PageFlagsAreConsistent+3050
2: 01182580 v8::internal::Heap::CollectGarbage+1200
PS C:\Users\dalia\Desktop\Adventure RPG\Adventure RPG>
Wtf
anyone know this
Not sure on that one

that seems like you're on your pc
waitt
Yep
dumb question
var mongoDB = 'mongodb+srv://no:no@database.knta7.gcp.mongodb.net/Database?retryWrites=true&w=majority'; mongoose.connect(mongoDB, {useNewUrlParser: true, useUnifiedTopology: true}); var db = mongoose.connection; db.on('error', console.error.bind(console, 'MongoDB connection error:'));``` hmmmm
Works fine till i restart the bot and loose all data
PyQt5
How does one change positions of objects on the dialog form relatively to the window itself? The tricky thing here is, I want to adjust object positions when the window is resized.
Oh shit. Microsoft bought npm? what?
js is even more of a meme now
Even made a massive tutorial
https://www.youtube.com/playlist?list=PLlrxD0HtieHhW0NCG7M536uHGOtJ95Ut2
Has like 50 some vids
One I install the lavalink.jar file, what do I do next? Can I start coding or do I need to move the lavalink file?
you plant a flower in the jar and water it everyday
How can I delete a document in mongodb?
How can I delete a document in mongodb?
@stable eagle <collection>.deleteOne("documentname"); iirc
@stable eagle mongoInstance.db(yee).collection(haw).deleteOne({"key": "value"})
Is there a forEach each character in a string?
since strings are iterable, you can turn the string into an array of characters with [...string] and use forEach on that
Typerror: custom.deleteOne is not a function
w h a t
I think the best way is to .split() it
@carmine summit https://tryitands.ee/
WDYM
You shouldn't use .split to iterate over a string imo.
You may end up iterating over some unexpected characters.
you get an array of characters, which you can use forEach on directly
Yeah, but how do I do it?
const string = 'abc';
[...string] // ['a', 'b', 'c']```
@quartz kindle why would you need a for loop to split up a string into an array of it's characters
he wanted to split in order to loop over them
why not just use <str>.split(/ +/g)?
i know it's slower, but if you're doing a discord bot
then you know the reason
we dunno
the original question was
Is there a forEach each character in a string?

the original question was
Is there a forEach each character in a string?
@quartz kindle bruh
forEach each
character
it's a function
that guy doesn't know how js works iirc
wat
lol
he wanted a string.forEach, like "abc".forEach(character => console.log(character)) // a b c
there is no string.forEach, but there is for(character of string)
there is not
what would you guys recommend doing for getting the voted users for your bot on top.gg
hasVoted method might not be optimal to execute every x seconds
adding the ids to a set was my idea
buy getVotes()
but then I don't know when to remove them exactly
webhooks
lol
https://prnt.sc/ux7po8
How can I add 1 row and 2 buttons
you can't add buttons
I added 1 but
and why not use description if you're not gonna add title for the field?
@elder ledge you cant add links in field name
webhooks
@quartz kindle can you explain to me how they work
yes
but can i also see when a user's vote expired
^
typically you use a database to store that info
then i cant set a timeout to delete their id from a set or something after 12h
and databases can self delete things that happened after 12 hours
or 6 hours, or 1 year or whatever
ok 1 last question
how do i automatically delete it after 12h from a databse
with mongoose
TypeError: on_message() missing 1 required positional argument: 'message'```
python
error for on message
@earnest phoenix im fairly certain you could just add a timeout on your code to delete it tbh
I would do it through the database
unless you bot keeps going down, it wont be an issue
Alright what the fuck is going on with your code 0Exe
otherwise you could run a query where timestamp + 12h < date.now every hour or so
What does your on_message event look like
@earnest phoenix https://docs.mongodb.com/manual/tutorial/expire-data/ plus ^
What does your on_message event look like
@slender thistle 1 sec
async def on_message(self, ctx, message):```
there
i do a lot
commands get a context object, on_message events don't
so... i give them xp, run a thing to give them coins
and i check for message content
lemme try
Hi
hello
I have my bot on heroku and it is literally 24/7 but my bot has just been rejected for the reason that it is offline for a long time, I do not understand why it happens I have other programming partners and they claim that the bot is 24/7 even I have seen my bot 24/7. I think it is an error and I ask for help, why does this happen? 3:
well it still was offline
so you have to add it to the queue again
time to wait 2+ months
🤔
doesnt heroku only provide service for 27 days out of a month or something
on the free plan
yea vps ftw
Hiya im having a bit of a problem. It says all servers are full also I cant make my own host.
Thanks for the help, I am something new in this 
what servers are full 🤔
of course the server might crash, but it will reboot
okaa
mods so fast
does on_message(message) only look at user messages and not bot messages?
Any message, if you want to remove bot messages just make sure it has a filter for bots
I don’t know what if statements are in python so
Ctx?
That’s not where the error is
the docs say message.guild exists
Because it does
His error is not right there
Unless he is sending a image
Which would make no sense either
Because it is still a message
either way 🤷♂️ somethings wrong thats not the message.guild.id part
img is?
well ita a cog
Py is so weird
yeah 🤷♂️

seems like it makes things harder tbh
guild_id = message.guild.id
AttributeError: 'img' object has no attribute 'guild' just ignore the img
can you show where you changed the class name?
^
just outa curiosity really
What class name did you change
?
client.add_cog(lvl(client))```
okay, but where did you change message to img
then the error is something else?
async def on_message(self, message):```
Has to be something else
I think a py dev will have to answer this, because im lost 









