#development
1 messages · Page 1781 of 1
py
Can I know
?
Read the fucking docs
wtf
I gave you a hint
ik that
Soooo
im using the rewrite
Me too
well...the link I sent shows the solution
yeah ty
All I see is the custom search API, which I don't think is the same as Google search's API
me need help with js dicts
how do i make them worky worky
like for instance how do i find a value with its key?
how do i get all of its keys:
google no help
object.key or object[key] to find the value associated with a key
Object.keys(object) for all keys in an object
In JavaScript, everything is an object.
yeah
Object.keys(MYDICT)
You can think of objects as a dictionary.
yw but thank Lite instead g
yeah
thanks both
i tried this stuff
it didnt work tho
lemme try it again
ty gamers
if i dont know the key, can i use [0]?
Yeah, you can do it like that
Are you trying to get a key 0
You mean Object.keys(dict)[0]?
it pretty much is
Because you don't get indexes of keys by themselves I believe
In Python starting from like 3.6 or 3.8 (I don't fucking remember) dicts are sorted
ordered, not sorted
I swear I see the inverse
JavaScript makes sense when it makes sense.
So never
imo python is only easier for IO stuff
I'm just used to Python's syntax 
id never use js but im only doing it cuz of stupid web dev
Try using tkinter to write a GUI 🙃
PyQt5 ty
O POG
its totally in the box lmfao
ah, yes, 25% pink 75% purple
give me other colors and id be happy to use the
its like a gradient
but id be happy to use other colors but i just dont have any lmfao
oh nothing it was manual
it was just like a base
its not actual data
there
new colors

because colorblind people
lmao
Don’t forget to add ring tones for “fully” blind people
And speech to command for armless people

There you go… a color blind version
nvm
@sinful belfry
ty
yw
well
hey, i need help, i'm doing a command that change a module to enable/disable, the command works as well but in when i try to disable that module, there's a problem:
Example:
Command On/Off
*active = true*
if(args[0] === 'off') {
active = false;
}
Database Changed that true (default) to false
Events
if(active === false) {
return message.channel.send('hei, it\'s disable!')
} else {
event stuff...
}
It sent event stuff, but the active in the database was *false*, why?
did you confirm that it's actually false
also
if you plan on having a lot of modules
you might want to consider using bit flags so you can store everything in one value
instead of a bunch of bools
i checked out now, it's false
Is it 'false' or is it actually false
Well something is not right then because if that is actually false then the if statement you send would not do 'event stuff'.
tbf you don't even need to do something === false
Console log the active variable here. You'll see its not false if that if statement does the event stuff. So something is going wrong where you define the active variable then.
ok
it's undefinied -_-
ooooh, i did an import error
i did an import mistake
i imported another schema
Fixed the issue now?
I figured out how to use dynamodb to solve my problem. just need to change the data structure a bit
yes
sqlite3, mysql, postgresql, mongodb, couchdb, some 100+ graphql databases, rethinkdb AGH
the first 3 alone would solve all the possible scenarios
skip mysql, that aint a db
bruh
you just offended me
as a proud mysql user
mysql has better performance than mongo will ever achieve
have you done a test
I have actually ages ago
mysql requires you to define types everywhere, mongo doesn't have a schema structure
mongo is basically a json database that doesn't corrupt as easily
all I get when I search comparisons is "eh they're the same / mongodb is slightly faster"
all non-relationals are basically json
i mean it all completely depends on the hardware and how you set the database up
both databases are good for their own purposes
and yes all test results are most likely bias due to a misconfiguration or complete bias
just to get some article clicks
No, benchmarking is just difficult in general.
the perfect benchmark would be done in 2 identical and isolated systems
That's also true
even the dust would have to be identical
How would I send the message to a user just using the user's UserId.
Discord.js 12.5.3
Is it possible to use Deno with plain JavaScript and no TypeScript.
yes but you may need to change some things
that is if you're used to nodejs
they have a special namespace for things and shit
fetch the user and use it normally
Hey guys, trying to install the aegis.cpp lib to do some cpp bot dev. However having issues buildingg the lib because of of the nlohmann json_fwd error, I have nlohmann build, make and isntalled correctly AFAIK so any clues on what it may be would be great.
I am dumb and found the cmake flag for it.
i have a kinda problem

i'm using
if(message.member.roles.cache.find(r => r.name === "Members")) {
but when i change the role name (Members) to anything else
there is some roles that the bot can't find
but i have the both roles

any help?
@lyric mountain?
Don't ping random members for help.
ok but can u help me instead of telling me that I can't ping other members to help me?
I wonder why? You are checking the role by name, so if you change the name it won't work? A mystery.
i'm changing the role name in the code
not in the server
i'm searching for another role
that i have on my server
console.log the entire list of roles before the if statement, to make sure your bot can see it first.
i will try that
why dont u grab by role id
so even if u change role ename you wont have to worry about changing in code
i tried that, got another problem
<form action="/app/register/" method="get">
<input type="text" pattern="[^\s]+" id="username" autocomplete="on" placeholder="Username" name="username" required="" value="">
</form>``` this sends a user to `app/register?username=theirusername
how can i get their username to show up as an alert?
get the url param
how u do that?
yeb
the bot didn't show like the half of the roles ...
caching prob
and how can i fix it ?
you cant?

I mean, you could fetch all the guild roles
but you have a limit on how frequently you can do it
and that effectively means adding a bunch of roles to memory

the major question is: why would you want to do such thing?
The bot can only see roles under the bot's own role?
I'm not sure if this is true or not, so you will need to check.
Can a role have the same id as another role in a different server? If so, how can I check if a user has a specific role by id in a specific server?
Also, I have an issue with my quote command where it will quote the message above the attended message, also if the specific message id has anything interfering with it such as a space after the id without saying anything after the space, or if something is in the middle, beginning, or end of the message id it just gives me a big old error.
Installing C++ libs is the only way to grow hairs on yo chest
Trim the ID and/or replace any whitespace with nothing
Code is.
laughs in go modules
im making a modal
how do i make it darken the page
like except for the modal
or blur the page?
yep
ty
ur a genius
but how do i make the modal not have it?
like if im adding the class to the body tag
how do i make the modal not get it?
wdym
Or use absolute position + z index
what div?
Then create a smaller box inside it to be the actual prompt
Im bad at explaining
so basically i create a invisible div that is full page size
then when u open the modal
the div becomes visible
and its dark?
Yep
Thats probably how most sites do it
mhm
how can i make the div the entire page
i forgot lmao
got it
tysm @lyric mountain
Yw
also @lyric mountain any ideas on how to make the modal close if i click off it?
Add an onClick event to the dark div
Even if you don't want to darken, just have an invisible div below it
That way you can listen to "off clicks"
hi
I did
This is my code
var server_owner = client.users.cache.find(user => user.id === `${commandrunner}`)
server_owner.send(botaddedEmbed)```
Owner is not guaranteed to be cached
You need to fetch it
Just beware of ratelimits
I wrote the code it works on the replit moved the content to the git hub, saved it, started Heroku and after writing the command here is the error pops up here is the code:
let config = require('./index.json');
if (message.author.bot) return;
if (message.channel.type == "dm") return;
if (message.content.endsWith("p!botinfo")) {
var embed = new Discord.MessageEmbed()
.setTimestamp()
.setAuthor("Информация о боте")
.setDescription(`Это только бета-тест этой команды`)
.setColor("#1E90FF")
.setTimestamp()
.addField("• ОЗУ использовано", `${(process.memoryUsage().heapUsed / (1000 * 1000)).toFixed(2)} MB`)
.addField("• Серверов:", `${client.guilds.cache.size}`)
.addField("• Ваш пинг:", `${Date.now() - message.createdTimestamp}`)
.addField("• Префикс:", "m!")
.addField("• Discord.js:", "12.5.3")
.addField("• Версия бота:", `${config.version}`, true)
.addField("• Название бота:", "Flame")
.addField("Ссылки", `[Пригласить](${config.invite})\n [Дискорд](${config.supportserver})`, true)
.addField("Разработчики", `Люцифер Денница#8566\n spring#1337\n Ilya#7545\n Nubovik#4541`, true)
.addField("Команды бота", "`m!help`", true)
.addField("Статистика команд", "`В процессе реализации.`", true)
.addField("Префикс", "`m!`", true)
message.channel.send(embed)
}
});```
Can you highlight and point out my mistake?
And how do I send it to you properly?
"dangling }" lmao
I don't know how to do it.
Can you highlight and point out my mistake?
Once fetched, do I cache it then?
It's automatically cached.
You can always use fetch(). If it's not in cache, it'll fetch it. Otherwise, it'll use the cache.
Okay
Okay, so I fetched it now but I don't know how to get the id of the user now
How did you fetch without the id?
wait, not id
I mean, I don't know how to send the message
Just like you'd do for any other user
I just get this error server_owner.send is not a function
You need to open the private channel before
I tried, says its not a function
Wait, let me try something
Show how you're doing it
Yep, got it now. Thank you. Figured out I did something wrong with fetch.
ty
@lyric mountain ur genius brain helped me make this
in reality the colors are darker
but whatever
Oh, nice
Cool color scheme tbh
Still cool
just i want the bot to give the message author a role
and its not doing that
when i use
Cannot read property 'add' of undefined
thats what i get

read the error
require('dotenv').config();
const { Client } = require('discord.js');
const client = new Client();
const PREFIX = "~";
client.on('ready', () => {
console.log(${client.user.tag} has logged in.);
});
client.on('message', (message) => {
if (message.author.bot) return;
if (message.content.startsWith(PREFIX)) {
const [CMD_NAME, ...args] = message.content
.trim()
.substring(PREFIX.length)
.split(/\s+/);
if (CMD_NAME === 'kick') {
if (!message.member.hasPermission('KICK_MEMBERS'))
return message.reply('You do not have permissions to use that command!');
if (args.length === 0)
return message.reply('Please provide and ID');
const member = message.guild.members.fetch(args[0]);
if (member) {
member
.kick()
.then((member) => message.channel.send(${member} was kicked.))
.catch((err) => message.channel.send('I can not kick that user :('));
} else {
message.channel.send('That member was not found');
}
}
}
});
client.login(process.env.TOKEN)
What did i do wrong here
thank you for not saying whats wrong and just posting code !
First of all
It's not .substring it's .slice
and its permissions.has
if(!args[0]) return ....
member.send should be before
await member.kick()
const member = message.mentions.members.first()
await member.ban()
Yes
For unban you would have to fetch all bans
what line is this on
Not that
Use a database
If user is in blacklist then just return before processing anything
Ohh
Shit sorry
Yea
You get user. I'd into your dB
And check to see if the message author id === to the one in db
If it is then return the promise
Sure as long as it stored data , and the bot can use it after it reboots
which line is member.send should be before
await member.kick()
member.send('you got whacked')
await member.kick()
i know that but which line of code does this go on
Which line
like the line of code which line
the message to be sent to the user must be before you kick them
I still need help with this
signal: killed stop/kills the running process. I guess its something with repl.it
also, refrain for sending the same thing over and over again. It seems annoying.
Can someone help me? I'll give you an example
app.get('/exemple/token', (req, res) => {})
How can I receive the "token"?
Place a : before token to turn it into a parameter, and then you can get it via req.params.token
Okay, thanks, I've been wanting to know this for a long time.
Can you answer another question for me? how can I transfer information in real time with an API? can i pass with websocket?
Where do you want to transfer the information to? The client?
Make the client make an HTTP request to the server to get the data it needs, you can also have a websocket, but websockets are usually used for data that needs to be updated or changes very frequently
actually i just want to create an event inside an sdk lib, but i don't know how to create APIs, i'm starting now and i need to do checks and send this to an event, i don't know if i need to keep updating or resend that data need in API
what data are you sending?
Exemple:
const mylib= require('mylibsdk')
mylib.on('eventexemple',(data) => {
console.log(data)
})
Okay but give an example of the data that you're sending
I will send commands from my bot, saving data, checks to adms, etc.
Hmm in that case I'd go with a websocket
server count
commands as in, you will send when a person uses a command?
Ok
no, it's for my bot's command list on the site.
Hmm then I'd go with HTTP requests, though honestly it doesn't matter that much
Ok
@ripe prairie scam^
what are the benefits does axios gives over fetch?
I think its whatever you prefer. As far as I know you can pretty much do the same things. I use node-fetch myself.
fetch is the kid who tells a joke first
axios just tells it louder
I use axios
😂
and ?
I'm all for fetch
like was there any errors or something ?
and you're asking for help about it
Help about what ?
That thing should work fine
Check if id is in DB
if id in DB
//No you can't do it
if not
//Execute command
y? is there any reason?
Also do u hv worked with nextjs?
I want to use the api of it. What would u recommend to use
Like this ?
const banned = [
'696969696969696969'
]
//Client on message
if(banned.indexOf(message.author.id) === -1){
return message.channel.send('Go home loser')
}
//The Command handler
//End of on message
do that yourself
I won't spoonfeed you
never worked with nextjs
axios is bloated
it's literally 4kb gzipped lmfao
you guys love throwing the term bloat around don't u
I wasn't talking about the size of it. Axios has features which I don't need like interceptions and instances, so I stick to node-fetch, which is also nicely compatible with the native fetch function
how can i fetch a link from a message?
Ex:
" Hei what's up? join server with this link <link> "
How can i fetch the <link> ?
when someone says "I won't do that for you"
s/he literally means "I won't help you"
So I already told you I won't help you
cya
can someone help me
Your answer is regex
Match if your content includes a link and return it using regex
is there any way to make discord.js types global? so I would not need to import them, just like types from a .d.ts file
Why while I'm trying to install something with the terminal command 'npm install xyz' it gives me error?
npm : Termine 'npm' non riconosciuto come nome di cmdlet, funzione, programma eseguibile o file script. Controllare l'ortografia del nome o verificare che il
percorso sia incluso e corretto, quindi riprovare.
In riga:1 car:1
- npm install discord.js
-
+ CategoryInfo : ObjectNotFound: (npm:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
could some body send the regex of " https://www.discord.gg/ "?
i never used regex before
have you installed npm?
on ur pc
yes
maybe is the other one
because there were 2 different
bcs I've recently changed Personal Computer
are you using the terminal of ur coding program?
ok, did you used the terminal of it
if yes, it's because you have to install npm extension on your program
ok
ehm, wdym?
go dm
^
The balance in this code gets updated :
new_bal = data["balance"] - price
users.update_one(data, {"$set": {"balance": new_bal}})
data1 = users.find_one({"_id": user_id})
users.update_one(data1, {"$set": {"level": new_lvl}})
While here it does not :
new_bal = data["balance"] - price
users.update_one(data, {"$set": {"balance": new_bal}})
data1 = users.find_one({"_id": user_id})
users.update_one(data1, {"$set": {"employees": ems}})
I don't get any errors and when I tried to add a print function under the second one that prints "updated bal" it prints, while it does not update. I also made it return after it updates the bal, it passes it and does not update it. While also the employees get updated.
can someone help me
Google will provide the regex by searching it
You have to do a little research yourself, too instead of letting anyone else do the job for you
on VSC if you have the proper plugins when you start typing VSC automatically imports the required types at the beginning of the file
I just started learning regex like 3 days ago so there might be problems
/(?:http|https\:\/\/)?(?:www\.)?(discord\.gg\/)/
@near stratus What is your learning source?
I found a post on medium
I started learning with it now I'm trying something from FreeCodeCamp
I've always seen regex as something I will never understand
I use this tool sometimes to build some regex things: https://regexr.com/
UnhandledPromiseRejectionWarning: Error: Error: Cannot find module '@discordjs/opus'
What is this
hello, i have this string 8:::::test and i want it to only say test in js, does someone know?
Is the length of the string always the same?
probably not
You could use regex for this, then
how
idk what is going on
npm ERR! /usr/bin/git ls-remote -h -t ssh://git@github.com/discordjs/opus.git
module.exports = async (client, message, args) => {
function timeout(msgToDelete, time) {
if (!message) throw new ReferenceError('firedragon, "message" is not defined')
if (typeof time !== "number") throw new SyntaxError('firedragon, typeof "time" must be number')
if (!message.guild.me.hasPermission('MANAGE_MESSAGES')) return console.log(`firedagon error: Discord Client need "MANAGE_MESSAGES"`)
msgToDelete.react('🗑')
const filter = (reaction, user) => {
return reaction.emoji.name === '🗑' && user.id === message.author.id;
};
msgToDelete.awaitReactions(filter, { max: 1, time: time, errors: ['time'] })
.then(collected => {
msgToDelete.delete()
})
.catch(err => {
msgToDelete.reactions.removeAll()
});
}
}```
```js
const { chatbot, timeout } = require('firedragon')
const { Client, Message, MessageEmbed } = require('discord.js');
module.exports = {
name: 'chatbot',
aliases: [''],
description: '',
usage: '',
/**
* @param {Client} client
* @param {Message} message
* @param {String[]} args
*/
run: async (client, message, args) => {
const messageToDelete = await message.channel.send("Hello There 👋");
timeout(message, messageToDelete, 5000);
chatbot(client, message, args.slice(0).join(" "));
}
}```
I am making a package
so when a person sends a message it should react to the message
and when i click it, it should delete
no err
pls
do we also hv input fields in future?
do u know the test length?
how do i clean the url, someone send me the command
what does not work?
when i give mute command
bot gives a message @(member) muted
but that member does not get mute
so it doesnt give the role?
yaa
did you made sure that the role gets picked up by the code?
if you want to make it more reliable i would fetch by id not by name
wait you already does this, just having the name as backup
one sec
mutee.roles.set([muterole.id]).then(() => { why did you pass in an array?
also why did you set it inside a catch?
db.set(`muteeid_${message.guild.id}_${mutee.id}`, userRoles)
mutee.roles.set(muterole.id).then(() => {
mutee.send(`**Hello, You Have Been Muted In ${message.guild.name} for - ${reason || "No Reason"}`).catch((e) => console.log(e)
})
``` with this you will properly handle the error if setting the role fails -edit there is no need to wrap a catch block around it if you already void the error
wait it can be made better
pls learn how to use codeblocks
also what did you want?
your catch block will probably never fire bcs you void the error it could catch
also why did you try to use an Array for the roles set?
lol and why did you remove now all messages?
you didn't install opus
clean the url?
and inb4, no one will spoonfeed you the command
Clear link from videos, images, things like that
could you show me an example?
How do i read a fs stream?
I'm currently trying to code my discordjs bot to dm a specific user. The code right now is
const user = client.users.fetch('someUserId')
user.send('test')
but I get a TypeError and when I console.log(user) it returns Promise {<pending>}
either await it or handle inside a .then()
sorry i have no clue what awaiting something means
let abc = await <some Promise>
promises are something that will happen but haven't yet
oh
i see
so would the code be like
const user = await client.users.fetch('someUserId')
user.send('test')
yw
and also do i just put .catch() at the end or do i have to put somemthing inside the catch
do you know how arrow functions work?
yeah it's like
() => {
something
}
i think
cursor.execute("UPDATE users SET money = '?' WHERE tag = '?'", (row[2] + plusmoney, ctx.author.id))
Incorrect number of bindings supplied. The current statement uses 0, and there are 2 supplied.
How could i solve that?
you quoted the params
ty
Hmms
||We are no strangers to love you know the rules and so do I..... GET RICKROLLED WHOEVER READ THIS LMFAO||
are you 9
are buttons available for discord.py yet?
are you really 8?
lol
Yeah im 8 lmao
move on thanks
lmao, was he really not trolling?
lol
well gave them a chance if that was a joke
i was sure he was trolling lmfao jesus
his website says hes been a dev for 2 years
wow
being a dev with 6 is cool lol
ok t
idk if this works well
ty
will they be a part of the official docs?
Doubt
One thing is having a popular library maintained by a team of proficient developers with a stable library
the other is some random module which quite literally states that it's under-development
ya
I mean, it could get a shoutout. Just probably not in its current state
As a separate unofficial package iirc
ok
unless they added them in v13
aye
like i said
this is the erorr
its just dont work with the message.author idk why
anyhelp guys ?
there's no "roles.add"
not only that, but you didn't show what roles even is
i did
didnt
ok now read it :)
Its a help command not working on my main bot but i tried on my other bot that working what could be problem
You're trying to send a message with no content.
You’re trying to send an empty message
When i click reactions im getting this error
But i tried on another bot
That was working
Check in your source code for your reaction to a button click
^^
And see where you're trying to send/edit a message.
Send the code here if you can’t figure out what’s wrong
Ok wait a sec
Also, for interest, why do you have 4.4k mentions/notifications?
how to setup a join message?
Are you developing a bot or using one?
invite tracker
You may want to see if the bot has a support server to assist you.
okay
Here
The first argument of .send/.edit doesn't take an embed.
The second argument does.
So what should i do i dont know so much
{ embed: myEmbed }
You could try passing an empty string as the first argument then your message embed (e.g. message.channel.send("", ...) where ... is your embed).
This is what I usually use, but I think his method works as well
The first argument could be an object
Hi there, I need some help at developing one command for my bot...
So my bot looks for the members that have a certain role and it divides the amount by 2... The problem is that I don't want the amount of people that have the role to contain decimal digits, so if the amount has decimals (example: 6**.5**), I would like the bot to add +0.5 to the total amount so that it's no longer decimal.
Aka round the number?
yes lol
Round up, down, or to a certain degree?
Round up
Math.floor and Math.ceil are gonna be your best friends here
Math.ceil for up
If you want to get rid of the decimal use Math.trunc
Thanks, I'll look into it
var { verificationCode, username } = req.body
return res.redirect('/account', { verificationCode, username })```
how can i do this correctly?
What's wrong?
i want to pass verificationCode and username to account
bc account is return res.render('account/mainaccount', { username: username})
i need to pass the username into that file
ok so ive been having this problem for like 4 days now
so basicallt
i have a list of all my bot's prefixes
i want to get the top 10 most used ones
so like the list has one element for each guild
so there are repeated ones
and idk how to sort it, and put it like organized
I wouldn't say that doing a simple guessing game in Rust is something I'd like to be proud of, but it's the small things that matter
I have fixed it, thank you a lot! 
Rust projects are interesting
anyone have any ideas?
Your question is a bit difficult for me to understand. Do you have an array like prefixes as an array of strings, guilds as an array of guilds and want to, somehow, sort the prefixes array by most used?
Is there more to the guilds array? Like a prefix property?
ok well i can get the prefixes in any form i want
i have a db with all the prefixes
so i can get them however needed
How do you want to sort them
Where do you store that
Are you using an SQL database?
aw fuck
I don't have experience with MongoDB
it doesnt matter
the problem has nothing to do with mongo
i have the prefixes
right
Where do you have the numbers of times each prefix is used?
i dont
thats the thing
i have all the prefixes
for instance i can make an array of all the prefixes so like ["!", ">", "-", "!"]
That's a problem in your case. Unless you cache that somehow
how so?
Ideally you want a dictionary attached to either the guild or your bot object with the prefix as a key and times it was used as the value
var intervall = setInterval (function () {
client.guilds.cache.forEach(guild => {
let checkif = db.fetch(`voiceactivity_${guild.id}`)
if(checkif === true) {
let voicegain = db.fetch(`voicegain_${guild.id}`)
const voiceChannels = guild.channels.cache.filter(c => c.type === 'voice');
let idUser = [];
for (const [id, voiceChannel] of voiceChannels){
voiceChannel.members.forEach(member => {
idUser.push(member.user.id)
});
let membercount = idUser.length;
for (var i = 0; i < membercount; i++) {
let member = client.users.cache.get(idUser[i]);
let verif = db.fetch(`balance_${guild.id}_${member.id}`)
if(verif === null) return
if(member.bot) return;
console.log(member.id + member.tag + ` ${voicegain}`)
db.add(`balance_${guild.id}_${member.id}`, voicegain)
let lchannel = db.fetch(`lchannel_${guild.id}`)
if(lchannel === null) return;
let asend = guild.channels.cache.get(lchannel)
if(asend){
const color = db.fetch(`embedcolor_${guild.id}_${member.id}`)
asend.send({embed:{ description: `${member} vient de gagner \`${voicegain} coins\``, color: color, author: { name:`⏰ 15 minutes de vocal` }, footer: { text: `🕙 ${getNow().time}` } }})
}
}}
}
})
}, 90000);```
Why its spamming x5 messages ?
This should add a sum of money to the voice person every 15 minutes
That interval runs every 10 seconds
Yes
u prob didnt stop the bot when u restarted it
ok so now i have a list of all the prefixes
so i need to basically get how many each one is used
which can be used with couunt
and a forloop
but tthen i need to sort it
>>> l
[10, 24, 3, 15, 2, 21, 22, 13, 26, 5, 16, 27, 19, 29, 25, 4, 18, 1, 1, 1, 14, 17, 23, 8, 28, 11, 6, 20, 7, 12, 1, 9]
>>> sorted(l, key=lambda x: l.count(x), reverse=True)
[1, 1, 1, 1, 10, 24, 3, 15, 2, 21, 22, 13, 26, 5, 16, 27, 19, 29, 25, 4, 18, 14, 17, 23, 8, 28, 11, 6, 20, 7, 12, 9]
I mean...
wdym

var intervall = setInterval (function () {
client.guilds.cache.forEach(guild => {
let checkif = db.fetch(`voiceactivity_${guild.id}`)
if(checkif === true) {
let voicegain = db.fetch(`voicegain_${guild.id}`)
const voiceChannels = guild.channels.cache.filter(c => c.type === 'voice');
let idUser = [];
for (const [id, voiceChannel] of voiceChannels){
voiceChannel.members.forEach(member => {
idUser.push(member.user.id)
});
let membercount = idUser.length;
for (var i = 0; i < membercount; i++) {
let member = client.users.cache.get(idUser[i]);
let verif = db.fetch(`balance_${guild.id}_${member.id}`)
if(verif === null) return
if(member.bot) return;
console.log(member.id + member.tag + ` ${voicegain}`)
db.add(`balance_${guild.id}_${member.id}`, voicegain)
let lchannel = db.fetch(`lchannel_${guild.id}`)
if(lchannel === null) return;
let asend = guild.channels.cache.get(lchannel)
if(asend){
const color = db.fetch(`embedcolor_${guild.id}_${member.id}`)
asend.send({embed:{ description: `${member} vient de gagner \`${voicegain} coins\``, color: color, author: { name:`⏰ 15 minutes de vocal` }, footer: { text: `🕙 ${getNow().time}` } }})
}
}}
}
})
}, 90000);```
Why its spamming x5 messages ?
This should add a sum of money to the voice person every 15 minutes

@sudden geyser You're more or less familiar with Rust, right?
Yes.
Let's say I want to do something like stdin().read(), meaning the program will only exit once the user actually presses any key (I presume?). What's the best approach about this?
io::stdin().read_line(...) will only proceed when the user enters a newline character (aka enter).
Hm. Maybe exiting on Enter does sound like a better idea.
Still, I would have to create an empty buffer to read into, right?
io::stdin().read_line(&mut String::new());
Would this be appropriate?
No, because it'll write to the mutable buffer. You'd need to store it as a variable then pass a mutable reference.
let mut input = String::new();
io::stdin().read_line(&mut input)
.expect("Oh, no!");
println!("Content: {}", input);
Rust is really nice, especially for a system's level language.
The async stuff has been done really well too.
I've only been hearing good news about Rust so that's why I decided to give it a try. Their guide is quite simple, even though my tired ass can't really comprehend much of it
Yeah, the memory management / borrow checking takes a bit of getting used to.
Rust is even nice to use as a high-level programming language.
Listener is fine
dict, DataDict, depending on which version you have
DataDict, then. Isn't it a subclass of DataDict? I'm not familiar with this library's design.
DataDict simply saying you can access keys via attrs and keys
It's a subclass of dict, yeah
The topggpy docs should be mentioning what inherits what
@junior musk stink
ty
@sudden geyser Starting to work on a functional-programming inspired helper library for the droff discord library. https://tim-smart.github.io/droff/droff-helpers/
Early days, so will be a bunch of stuff missing. But you might be interested.
Documentation for droff-helpers
helpp
currying is cool but sadly typescript kinda dies when it has to pass generics between curried functions
Yeah, it depends where you define the generic type in the chain.
big sad
if you have a function that returns a generic function that generic gets set to the default value it's so frustrating I couldn't set up a cool middleware system I was working on because of that
const partiallyCurriedFunction = withSomething(whatever)
// if `withSomething` returns Func<T = Something> it's set to Func<Something>
Ah yep. You would have to somehow move the generic:
const withSomething = (thing: any) => <T = Something>(...) => ...;
oh I wonder if that's what was limiting me
ah, could be
// Unfortunately this doesn't wokr due to typescript's type inference limitations with generic values
export function makeMiddleware<T extends BaseContext, K>(
middlewareHandler: MiddlewareHandler<T, K>
) {
return (f: Middleware<T & K>): Middleware<T> => async (req, res, ctx) => {
try {
const data = await middlewareHandler(req, res, ctx);
return f(req, res, { ...ctx, ...data });
} catch (handlerOrErr) {
if (typeof handlerOrErr === "function") {
return handlerOrErr();
}
throw handlerOrErr;
}
};
}
You could move the generics kinda like this:
type Middleware<T> = (req: any, res: any, ctx: any) => Promise<T>;
type MiddlewareHandler = <T, K>(req: any, res: any, ctx: K) => Promise<T>;
export function makeMiddleware(middlewareHandler: MiddlewareHandler) {
return <T, K>(f: Middleware<T & K>): Middleware<T> =>
async (req, res, ctx) => {
try {
const data = await middlewareHandler<T, K>(req, res, ctx);
return f(req, res, { ...ctx, ...data });
} catch (handlerOrErr) {
if (typeof handlerOrErr === "function") {
return handlerOrErr();
}
throw handlerOrErr;
}
};
}
Nice.
Does the WebhookManager check that the secret matches when a request is recieved?
guys how I install ffmpeg on a vps?
same way you would install it anywhere else
either install it in your dockerfile or just {package_manager} install ffmpeg
idk if ffmpeg works this way
(it does)
I have to upload the fffmpeg files? right?
no
and in console this

apt-get install ffmpeg, yum install ffmpeg, pacman install ffmpeg
r u sure? I'm talking about a virtual cloud service
what else would you be talking about
idk
No match for argument: ffmpeg
Error: Unable to find a match: ffmpeg
did you update first
going to provide an example for apt
apt-get update
apt-get install ffmpeg```
just like any other package man
[root@NOVABOT novabotdrop]# apt-get install ffmpeg
-bash: apt-get: command not found
[root@NOVABOT novabotdrop]# apt-get install ffmpeg
-bash: apt-get: command not found
[root@NOVABOT novabotdrop]# yum install ffmpeg
Last metadata expiration check: 2:24:43 ago on Mon 14 Jun 2021 10:13:00 PM UTC.
No match for argument: ffmpeg
Error: Unable to find a match: ffmpeg
[root@NOVABOT novabotdrop]# apt-get update
-bash: apt-get: command not found
[root@NOVABOT novabotdrop]# apt-get install ffmpeg
-bash: apt-get: command not found
[root@NOVABOT novabotdrop]#
...

just install it like ANY OTHER PACKAGE
im providing an example as if you are using debian or a fork
but how can I install it like any other package if I put ffmbeg as path variable on my pc
@prime mist I haven't used Node.js in a while and I'm having a few issues installing the repository.
- I'm installing with
npm install git+https://github.com/tim-smart/droff.git. Is yarn required? (I see it's mentioned in the readme) - If I do install with npm, it fails.
npm ERR! npm ERR! code 2
...
npm ERR! npm ERR! command sh -c rm -rf dist && tsc
npm ERR! npm ERR! src/mod.ts(1,24): error TS2307: Cannot find module 'droff' or its corresponding type declarations.
npm ERR! npm ERR! src/mod.ts(2,32): error TS2307: Cannot find module 'droff/dist/types' or its corresponding type declarations.
npm ERR! npm ERR! src/mod.ts(56,12): error TS7006: Parameter 'o' implicitly has an 'any' type.
npm ERR! npm ERR! src/mod.ts(78,11): error TS2698: Spread types may only be created from object types.
npm ERR! npm ERR! src/mod.ts(79,32): error TS2571: Object is of type 'unknown'.
because its different under windows?
Also, is TypeScript required? I have it installed on my system, but I'm not using it in the project.
but I need centOS commands?
I fixed my issue, somehow.
Yeah you will need to use the npm package, as the repo doesn't include the compiled javascript.
in js now, how do i order an array by how many times each value shows up
so like [4, 5, 6, 4, 5, 4] becomes [4, 4, 4, 5, 5, 6]
You could use a .sort() and count the number of occurrences a number appears in the array each time, but this is slow (O(N^2) I believe). Instead, you could create an object that stores the number of frequencies for each element and sort by that property.
Tutorialsport has an example on this.
const arr = [1, 1, 2, 2, 2, 3];
const sort = (arr) => {
const map = {};
for (const number of arr) {
map[number] = (map[number] || 0) + 1;
};
return arr.sort((a, b) => map[b] - map[a]);
};
sort(arr);
console.log(arr); // => [2, 2, 2, 1, 1, 3]
Usually your answers are one Google search away (this was the second result for "JS order array by frequency")
How can i do this in my server like how do i set this up
jack of all trades
Are you developing a bot or using some existing bot
ohhh ok
e.g. carl
Ok, do you know how to use twitch/youtube/tiktok/whatever service you want to listen to's API?
Like, how to fetch data or use a websocket for it?
yeah
Do you know how to use a database?
yeah
client.guild.fetch fetches a guild right 
That's it then, merge all 3 knowledges together
also does this make it so the guild is in the bots cache
Create a bot, connect to the service's API and store users who click the reaction (with collector) in the database
speak english
Whenever the websocket fire a "new video" event just DM the users
plz
After you fetch it you'll have it cached for a while
You do need
i just do it via id 
wait wdym notifications
my bad 
Ok I have a question
I code on replit just because using a WSGI server to host my bot is easy
i code on replit too lol
And I code in python why does client.run(Token) or client.login("Token") not work
Using a wsgi server...on replit?
If anyone can help me I'd really appreciate it
That's the thing I dont get any errors
The console just goes blank and my bot is not online
Then it's not even running
I hit run tho I am confused with it
It's impossible to have an empty console if the code is running
Ok let me give further detail I kinda left you on like a cliffhanger
So when I run it I get the installing dependencies and installing discord.py and libraries the my console goes blank and the repl is still running
thats not possible
add a print note when the bot is ready
so you know it is running or not
That's not the issue
I have I will screenshot the sample code real quick
Just to help you out dont try to snatch the token it's in my development server and it is an old token
If it was indentation issues it would give me an error code
Not required of course, but highly recommended 🙂 I think vscode should give you auto-completions regardless, but you will miss out on the type safety.
I might quickly see what the experience is like for javascript...
If someone will join a VC in Dms or in this server I can screen share the console
I mean it's indented right but it doesn't run because it's indented into the command
So it only runs when the command is run
Also, I have just made some breaking changes to the droff API. You have to explicitly subscribe to the side-effects for the client to run. client.effects$.subscribe()
I have tried running the command as well it just doesnt work and I have spent hours trying to figure it out
Examples have been updated: https://github.com/tim-smart/droff#usage
@deep mantle if you'll call me in DMs you dont have to talk I'll screen share the whole thing and show you
I hope so, don't underestimate token grabs
Even if it's a dev token
I wouldn't be asking if I hadn't googled it
I googled it and came across this very example
And I didn't understand it
And I tried it and it didn't seem to work
Thanks tho
Even if someone token grabbed it it wouldnt matter this bot is just for testing code and that's it I'm not actually using it for anything
As I said
That's why the bot is called Testbot422.py
Don't underestimate it
The bot's still linked to your account
It just takes a malicious code to get you flagged for api abuse
Or worse
But my code is not malicious it is test code
And it doesnt even work
someone else can use ur token
But whoever gets ur token can take full control of the bot
yes
It doesn't matter what your code is
tbh
It matters WHO will use the token
Reset that one asap
I already did
Woops didnt mean to reply to that one
Anyway, could you show the console?
Yes if you'll call me in DMs I'll screen share the whole process and you dont have to talk
Yes
Nah, I prefer screenshots
Replit removed the creation of .env files
Did it?
I'm pretty sure replit still have a way to create private files
maybe i'll use glitch
And get banned
you can't even create a private project...
you can make a private project
As in key file
if u pay
not possible
rip
You can make a private environmental variable
It's not easy but possible
u can use heroku and they have free env files
I know
You can but on heroku I have found that you can code in python
Then why don't use it?
Cant
oh wow
what "can't"
i use discord.js
What-
oh-
instead of .py
i use discord.py
oh
I dont because it is just test code so I dont really have to worry about it
i have no experience with .py at all
well discord.py
You can still deploy a python application to heroku...
Can we just get back on topic then?
And I have a program someone made for me that auto regenerates my token every 30 minutes
Replit, glitch and heroku all have pros and cons
Why?
There's no reason to start comparing wood to log to stump
Truer words were never spoken
glitch loads slowly
but glitch stays always on now
If you just keep your token secure, there is no reason to change it every 30 minutes
Replit is complicated
then why use replit 
I have it change like that for extra security because it's better to be safe than sorry
Glitch OPENLY COUNTERS bot hosting
.....
They explicitly stated that they don't want bots there
wow, im gonna break their rules 🙂
terminated from roblox twice so not suprised
Now, can we get back to topic?
You say that, but then you post your bot token in a public discord server. Just keep your token private from everyone and you won’t have any problems.
Yep but remember it's only illegal if you get caught
oh nvm
i no want court
Sigh, I'm out
It is test bot and I have already regenerated the token
hmm
wait what 
It is in one server which is my test server
Okay, that’s good and all, but there’s no need to regenerate your token that often, especially if it causes problems
its still illegal no matter what but lets go back to the topic
what is the topic?
Shhh it makes sense if you dont think about it
Just as a note, but you can only identify only so much before you get ratelimited
@young rune if you can call in DMs and help me that would be great
And cloudflare bans ain't no joke also
how about in 1 hour?
doing hw
Sure cant call after about 12 tho
what timezone u in
GMT its 9:27 for me rn
oh
You
Dang
Wait is 10:28 for you?
am
Am!
ues
8 hours ahead boi!
WHHHHHYYYYYYYY
@tender raft ur in 6/14/21 right
No I'm in 7/59/6593



