#development
1 messages ยท Page 648 of 1
Create channel>on channel create> if ID of channel is the same as the channel stored, send message.
you cant set a timestamp
timestamp is the time the message was sent. Unless you alter api calls you cant change the message date
oh
uh
thanks
im pretty sure they're doing it on an embed
Ik
How count my bot vote please ?
I generate my bot api on discordbots.org
And after I donโt know what I do ๐ญ
Api calls would work.
I use them too much ffs
I never use api of my life. @west spoke
Restart
Someone can help me with my discordbots.org Bot API please
Dont need to send it here
@spice nymph #topgg-api
Already told them.
oh my fucking god
what
Did you seriously just take the code and not change it
?
you either have to define the variables or change them..
how

im noob : (
idk :/
ik
code isn't going to magically work and connect to the exact bot you want by copy pasting
lol
code is like a maze, it can be easy and it can be hard however if you try you will achieve
how can i make a bot do something after you clicked a reaction?
uh im not good at explaining lmao
#roadtodiscordpartner Mic in this one may be a bit quieter mainly because I did it at night. Today I show you how to await messages, and create a basic votin...
discord.js Only _/!_
Why would you want to create an invite for each guild?
That seems ultra-suspicious.
๐ค
Umm someone know the const of member? like a normal member
๐
Anyone here have a experience with bot music and trying to change the pitch?
๐บ๐๐๐๐๐.#0113
Why would u want to do that? @spice nymph
..
That is against Discord ToS @spice nymph @split hazel
I know
Then why would u do it
Just noticed, it also spams the API
@spice nymph i told you to not ask it again
And why would u give it even if it doesn't spam... it's against ToS end of story @split hazel
I didn't realise
why no one wanna help me 
No offense but even if it weren't a violation of ToS, you didn't think that making an invite link for each server and sending it to the bot owner would be a violation of someone's privacy?
That totally threw me off... anyways back to what I was here for...
why does this error show up... TypeORM + TypeScript on an Eris bot:
Code: https://gist.github.com/SinistreCyborg/aa76f6291df70d4a11b0d51fa2cfcdff
Someone knows how i can get the level from apex-api?
did you already get the data from api and just need to extract the level? or did you not connect to the api at all yet?
i connected all
let me give you an ss
wait i have to install lightshot
it's a long road
=)))
and where is the level you're looking for?
data->children->metadata->stats->metadata->metadata->->stats->metadata
yes
so you have to find the index of the item you want. you can use the find() function
no need to dm, just post here
ok
legend_7 means 7 legends actives
but wait to ss
this
The 0 is the one that i want
ah so its in another stats, outside of children
so data.stats[0]
if its always in index 0
if not, then you need to use data.stats.find()
its ok yes, but its not needed
you can just do data.stats[0].metadata[2].displayValue
assuming the address is correct
yeah, assuming its correct
ok
from your pictures above, it should simply be data.stats[0].displayValue
index.js:34
TypeError: Cannot read property '0' of undefined
bot = client.fetchUser('579317044915208202')
if (!bot.hasPermission('CREATE_INSTANT_INVITE') || !bot.hasPermission('VIEW_CHANNEL') || !bot.hasPermission('MANAGE_MESSAGES') || !bot.hasPermission('ATTACH_FILES') || !bot.hasPermission('ADD_REACTIONS') || !bot.hasPermission('SPEAK') || !bot.hasPermission('USE_EXTERNAL_EMOJIS') || !bot.hasPermission('CHANGE_NICKNAME') || !bot.hasPermission('SEND_MESSAGES') || !bot.hasPermission('EMBED_LINKS') || !bot.hasPermission('READ_MESSAGE_HISTORY') || !bot.hasPermission('CONNECT') || !bot.hasPermission('USE_VAD')) {
guild.leave
return
}
discord.js I'm trying to make a thing when the Discord bot doesn't have the correct permissions, it leaves the server, but it keeps saying .hasPermission is not a function. Can anyone help me?
number 1
fetchUser is a promise and will only work in .then or await
2 you mean <client>.guild.me
for bot
const fs = require('fs')
const talkedRecently = new Set();
const Discord = require('discord.js')
const client = new Discord.Client()
my const
don't ask to ask
put client insted of bot
ok
i already told you, replace bot with <client>.guild.me
then the hasPermission function will work
oof , i need help with apex-api
ok bot started running, let me see if it works
TypeError: Cannot read property 'me' of undefined new error
if (!client.guild.me.hasPermission('CREATE_INSTANT_INVITE') || !client.guild.me.hasPermission('VIEW_CHANNEL') || !client.guild.me.hasPermission('MANAGE_MESSAGES') || !client.guild.me.hasPermission('ATTACH_FILES') || !client.guild.me.hasPermission('ADD_REACTIONS') || !client.guild.me.hasPermission('SPEAK') || !client.guild.me.hasPermission('USE_EXTERNAL_EMOJIS') || !client.guild.me.hasPermission('CHANGE_NICKNAME') || !client.guild.me.hasPermission('SEND_MESSAGES') || !client.guild.me.hasPermission('EMBED_LINKS') || !client.guild.me.hasPermission('READ_MESSAGE_HISTORY') || !client.guild.me.hasPermission('CONNECT') || !client.guild.me.hasPermission('USE_VAD')) {
^
wtf
let me get it in a image
oh not client
i was wrong
message.guild.me
is what i meant, got it mixed up
lol
index.js:47
[[StableObjectId]]:1
message:"Cannot read property '2' of undefined"
stack:"TypeError: Cannot read property '2' of undefined\n at apex.user.then.data (e:\somestuff\index.js:36:26)\n at process._tickCallback (internal/process/next_tick.js:68:7)"
__proto__:Error {constructor: , name: "TypeError", message: "", โฆ}```
console.log(level);```
this means that stats is either not an array or doesn't exist
did you try logging stats into console?
because it's a method not a property
message.guild.leave you're probably looking for
alot of this stuff is in docs
and leave is also a function
no error, bot doesn't leave the server
and tim told me to put data.stats[0] and that either didn't work
from the pictures you sent me, that should work. do console.log(data.stats[0])
GG thx
alot of this is in docs, you should do a simple google search & docs search before asking here
yeah but if i put children
TypeError: Cannot read property 'stats' of undefined
i do console.log data
and in visual code i don't know who is after the first one.
so data.stats[0] works?
nope
what does it say?
then console.log(data)
what does console.log(data) show?
stats seems to be inside the children array, data.stats won't work on it's own
oh , i see data.stats = undefined
he wants this stats, unless im blind, that doesnt look like its inside the children array
oh i was talking about this
then its data.data.stats[0]
cuz it's data that i defined and the data from the core?
yes, the data you defined contains another data inside it
umm i want to create a register/login command if anyone knows how
and i want it to store in a json
lets not store anything to do with passwords in json
not with passwords
like username platform
i want it to store into an json to don't need to register again
or can be without?
Wait, is this for a website or?
or database
Yeah. Json files have a tendency to get corrupted when edited a lot. They're not really designed for it. Your way better using SQLite or another database...and i actually came here for help to set up SQLite lol
Why does this error show up... TypeORM + TypeScript on an Eris bot:
Code: https://gist.github.com/SinistreCyborg/aa76f6291df70d4a11b0d51fa2cfcdff
I'm not sure if we'd be able to provide much help with it... not a lot of devs here know that, including myself.
From what I remember it's a web server, right?
I would recommend SQLite, not because I understand it, but because a lot of people here know how to use SQLite so you're probably gonna get support with code a lot faster.
Hmm.... the whole reason we recommend SQLite for you was that it's the closest thing to JSON since it's file-based.
@wooden lance You're right
Plus most of us use some SQL database like Postgres, MySQL, etc, (unless ur a MongoDB pleb) so it would be similar enough for us to offer guidance
But ultimately no one is stopping u from using XAMPP if u absolutely can't use an SQL db
What language do u code in btw? @earnest phoenix
node.js
Oh yeah, then don't use XAMPP... it's more of a PHP thing rather than a JS thing
And now I'm gonna ask my question...
I was wondering, does anyone know how I can use SQLite to make my bot's automod configurable. I tried json files...they got corrupted lol. My bot uses discord.js on node, and the code I need help making configurable (like, being able to turn the feature on or off) is at https://pastebin.com/ym2yDKHc. Thank you in advance.
what do u use to talk to sqlite?
like do u use the "raw" sqlite lib, sequelize, keyv, etc
sequelize, i installed that.
I followed a guide on how to install it, but its quite useless after that tbh
Just to be clear, you already have sqlite, right?
Yes, i have installed it
If you're completely new to Sequelize, here's a crash course on how to use it with discord bots: https://discordjs.guide/sequelize
The guide uses it for a tag system (custom commands) but the logic is pretty much the same.
You define a model, sync the model, add/delete stuff when necessary, and fetch them to check if automod is on
That's actaully the website i read the guide on. I'm a little new to bot developing, and, it made no sense where it wanted me to put code.
All the sections have a greek letter at the front.
OH
That letter corresponds to where its comment is at the codeblock at the very top
np lol
I was just thinking they were just random gibberish, apparently not.
lol
lol
it's ok this command ? create table first(a int, b string)
I have a feeling I will come back confused and minus one bot
Okay
then if stuff breaks just switch back to the main one
K
it's ok this command ?
create table first(a int, b string)
to be like username , platform
oh no
it's a string , b string
?
?
there's no such thing as string in sqlite
Wth that's a different language in the bottom when you have message.reply
^
I just wanted help if he has already register
@earnest phoenix Just check if they're in db (registered) already
Hello. I've tried...
let ${message.guild.id}-antiswear = new db.table('antiswear-setting')
but it just throws back errors. Anyone got any advice on how I can do the above ^? I'm using discord.js on node. Please ping me if you respond. Thank you in advance.
But it needs to be linked to that server.
Not there it doesn't.
let antiswear = new db.table("antiswear-settings");
// later in code:
let swear = antiswear.get(`${message.guild.id}`) || {};
You can't do that. What database are you using @wooden lance
quick.db
quick.db
Then iirc you make a table and then you get the value based off of the key within the db

Okay
no need ot make 1 table per server
wait you are making a table per user?
wait why?
dont do that
are you aware that sql works slower the more table it has?
But, how do I do it then?
that made absolutely no sense to me
let settings = new db.table('settings')
settings.set(message.guild.id, JSON.stringify({ antiswear: true }))
let guildsettings = JSON.parse(settings.get(message.guild.id))
that will yield more performance and can even hold more than 50k guilds
@earnest phoenix you should have created it 
you're using sqlite? 
i see, then it should be a file called (something).sqlite
you need to make it iirc 
Iirc means..?
if i recall correctly
Oh
are you using a package?
what package are you using
oh okay 
in that case iirc you have to make a db file such as database.sqlite
Wait....how do I fetch this instead of setting this?
settings.set(message.guild.id, JSON.stringify({ antiswear: true }))
sometimes i feel i shouldn't have a bot when i ask these kinda questions.
and then you try to open it from main code file
@wooden lance settings.get(message.guild.id) i think
i dont use quick.db so i could be wrong ๐
lol
p sure its <db>.get() tho
I'll try
settings.get(message.guild.id, JSON.stringify({antiswear}))
? I have no clue.
I really have no clue lol
But, that means ill have to have multiple db per server if i have to put them all in other database and lol that took me 4 attempts to correctly spell database wtf am i doing it's 5am
no lol
Hmm, time to put my thonking hat on 
if you do
function(){
settings.set(message.guild.id, whatevertheiroptionishere)
}
then every time a guild invokes the command, it adds it to a row in the db
then when you need to see what the guild chose, just do like
settings.get(message.guild.id)
and so it'll check what that specific guild id noted in that db
yes, so it returns whether the guild wants to have antiswear/spam.
or whatever the option is
var db = new sqlite3.Database('registers');
it's ok to look like this?
or var db = new sqlite3.Database('./registers.sqlite');
But, my bot needs to know which value to look at @spare goblet, to decide if the feature is on, or off. my brain is obviously at -10% right now
I know
Okay so first of all there's
//setting whether the feature is on or off
settings.set(message.guild.id, thingystoredhere)
then there's the checking if antispam is on or off
settings.get(message.guild.id) // this returns the "thingystoredhere" from above
Iara
?
It's ok the first one
but then how does my bot know if it is on or off in this cause im a complete idot with this db stuff. ```javascript
for (x = 0; x < profanities.length; x++) {
let settings = new db.table('settings')
settings.get(message.guild.id)
if (message.content.toUpperCase() == profanities[x].toUpperCase()) {
message.delete()
message.channel.send(**Profanity Blocked:** A message by ${message.author} had known profanity words in it and was blocked.)
let log = message.guild.channels.find(`name`, "logs")
message.log.send(`**${message.author.username} sent a message with known profanity in it in ${message.channel} and was blocked.**`)
}
}
Omfg
What bit of it checks
๐ make it save true/false (as boolean) or make it save on/off (as string)
Put let table at top out of for loop
Lol
This obviously proves that ollie not do english
it's fine lmao 
lol ye
I was starting to feel like screaming cause we were just going in circles lol
And i will @spare goblet prob should of looked at that
have a good day 
you too
Iara
yes?
What's not working?
I'm p sure it's supposed to be like the name of db
and not liek that
this'll work right lol
for (x = 0; x < profanities.length; x++) {
let settings = new db.table('settings')
settings.get(message.guild.id)
if(true){ //does something
if (message.content.toUpperCase() == profanities[x].toUpperCase()) {
message.delete()
message.channel.send(`**Profanity Blocked:** A message by ${message.author} had known profanity words in it and was blocked.`)
let log = message.guild.channels.find(`name`, "logs")
message.log.send(`**${message.author.username} sent a message with known profanity in it in ${message.channel} and was blocked.**`)
}
}else return;
}
You should test it out
@wooden lance
As I don't know what the objs are
the db file is empty but says he have already created
Okay
WAit
?
Why did you just put if(true)
because you told me to
you need to check if(thethingyougrabfromdb == true)
omg i am an idot
@earnest phoenix can you screenshot the console
how is my bot even running
like the error that's coming up
tbh i feel like it's not new
it's like open
or something
that's sqlite litowee 
Im even worse at sqlite
You wouldn't think thats possible with what you've just seen, but it is
You already created the table 
^
Ik
^
the tables are already created so you don't need to recreate them

^ x2
so in your code you can basically take out the create blah blah
comment it out and it should work
im not gonna keep doing ^ just imagine i am
But i don't know if the username are inserted
Yes

if not you can just console.log your database and see what's in it
select * from table
Ok
how on earth do i make a default quickdb dont say, omg, why do i do this.
you just require it iirc?
like const db = require('quick.db')
then you set them one by one
i have already did const db = require('quick.db')
wait...
im a complete idot
it requires the value to be true to do it, it could be anything else
set it as boolean val
like e.g. if command usage is
?setantispam on/off
const setto = args[0].toLowerCase() === "on" ? true : false
or something
then make it set by setto
oaky
omg how does this autocorrect think okay should be oaky
im done
im goin to bed
Thank you for all your help @spare goblet
np
night
at apex.user.then.data (e:\somestuff\index.js:42:91)
at process._tickCallback (internal/process/next_tick.js:68:7)
warning.js:18
(node:7872) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
warning.js:18
(node:7872) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
var db = new sqlite3.Database('registers.sqlite');```
@spare goblet i know you can help me ๐
if(!row){
msg.reply("user not registered");
}else{
msg.reply("user registered");
}
})```
db.run() is not a function
and what should i use?
p sure its something like this in sqlite3:
db.each(`SELECT ....`, function(err, row) {
if(!row){
msg.reply(`not registered`)
}else{
//something else
}})```
hay i think p orably stumbled into someting realy werid i have a void thats ment to run random numbers but it keeps running the same string of random numberrs
@spare goblet can you help me i cant play my bot in my server
haydra
c# its working fine just it keeps throwing up the same numbers
hey friendo, you should go to their support server
i forgot how you show code on this
what kastel said 
const args = msg.content.split(/ +/g);
const username = args[1];
const platform = args[2];
const me = msg.author;
if(username)
{
if(platform)
{
console.log(`SELECT * FROM accounts`);
console.log(db);
const data = apex.user(username, platform).then (data => {
db.each(`SELECT * FROM accounts WHERE "discname" = "discname" AND "apexname" = "apexname"`), function(err, row) {
if(!row){
msg.reply("user not registered");
}else{
msg.reply("user registered");
}
}
})
}
}
}```
this command it's doing nothing
public int roleDice(string StatName)
{
int DiceSum = 0;
int[] diceRoles = new int[6];
Random rnd = new Random();
diceRoles[0] = rnd.Next(1, 20);
for (int i = 1; i < diceRoles.Length; i++)
{
diceRoles[i] = rnd.Next(1, 20);
while(diceRoles[i] == diceRoles[i-1])
{
diceRoles[i] = rnd.Next(1, 20);
}
DiceSum += diceRoles[i];
}
Array.Sort(diceRoles);
statText += StatName + ": "+DiceSum+"= "+ diceRoles[1] + "+ " + diceRoles[2] + "+ " + diceRoles[3] + "+ " + diceRoles[4] + "+" + diceRoles[5] + "\n";
DiceSum -= diceRoles[0];
return DiceSum;
}
why is this thing just giveing me the same number
is it console logging anything @earnest phoenix ?
console.log(SELECT * FROM accounts);
^ this doesnt do anything other than put this in log: "SELECT * FROM accounts" so i'm not sure what you're trying to do here
not sure why it's you need to name it const data and not sure what apex is
where?
it's from apex-api
why const data
why not just run the function 
I'm an idiot ๐
im more of an idot
is not inserting anything
const args = msg.content.split(/ +/g);
const username = args[1];
const platform = args[2];
const me = msg.author;
if(username)
{
if(platform)
{
console.log(`SELECT * FROM accounts`);
console.log(db);
db.each(`SELECT * FROM accounts WHERE "discname" = "discname" AND "apexname" = "apexname"`), function(err, row) {
if(!row){
msg.reply("user not registered");
}else{
db.each(`INSERT INTO accounts (discname, apexname) VALUES (?, ?)`, [msg.author.id, username])
msg.reply("user registered");
}
}
}
}
}```
@earnest phoenix db.prepare() to insert please, 
do you know what you're doing?
db.each(SELECT * FROM accounts WHERE "discname" = "discname" AND "apexname" = "apexname"), function(err, row) {
No
first of all if the column is called discname, you don't have to change it as a string
a little
it should be a variable

also here you're basicalliy selecting everything because you're checking for anything where discname = discname
and so it should be
db.each(SELECT * FROM accounts WHERE discname="itshouldbesomethingelseotherthandiscname" AND apexname="itshouldbesomethingelseotherthanapexname")
thirdly. why are you making it insert into db if the row already exists?
it would make it have mutliple rows/duplicate rows
Yes, I'm pretty aware of that
read my messages above thne
is discname supposed to be discord username?
shouldnt u do it by discordid
nvm
then replace it with msg.author.id
done
and did you check this also https://canary.discordapp.com/channels/264445053596991498/272764566411149314/596210221626425344
const args = msg.content.split(/ +/g);
const username = args[1];
const platform = args[2];
const me = msg.author;
if(username)
{
if(platform)
{
db.each(`SELECT * FROM accounts WHERE "discname" = "msg.author.id" AND "apexname" = "username"`), function(err, row) {
if(!row){
msg.reply("user not registered");
}else{
db.prepare(`INSERT INTO table accounts (discname, apexname) VALUES (msg.author.id, username)`)
msg.reply("user registered");
}
}
}
}
}```
._. you're making it a string rn
refer to https://canary.discordapp.com/channels/264445053596991498/272764566411149314/596210221626425344 please
you're making discname a string and making msg.author.id a string so its literally searching for msg.author.id
like literlaly "msg.author.id" and not the message's author's id
do you understand @earnest phoenix
if not i'll give an example 
``` db.each(SELECT * FROM accounts WHERE discname = "${msg.author.id}" AND apexname = "${username}"), function(err, row) {
do you understand now 
omg , yeah
you were searching it as a string
where would I go to fix the error?
@exotic tapir can you show us one line before this error?
it should be ^^^ pointing at the error and then you should find the code with that syntax error
just the line right before your image 
var db = new sqlite3.Database('./registers.sqlite');
the database is empty
god bless me
to make this work
I don't really know much about coding. But whenever I remove the "); it makes the lines above and below it show errors also
iara my friend , how are you doing ? ๐
@earnest phoenix Hey keep the chatting in #memes-and-media or #general but i'm fine thanks
i wanthelp
=))
var db = new sqlite3.Database('./registers.sqlite');
the database is empty
god bless me
to make this work
@earnest phoenix Try
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('./registers.db')
btw the db should be .db, sorry, apparently sqlite3 is different

what does your code look like, and are there any errors?
no errors
log stuff
const args = msg.content.split(/ +/g);
const username = args[1];
const platform = args[2];
const me = msg.author;
if(username)
{
db.each(`SELECT * FROM accounts WHERE "discname" = "${msg.author.id}" AND "apexname" = "${username}"`), function(err, row) {
if(!row){
msg.reply("user not registered");
}else{
db.prepare(`INSERT INTO table accounts (discname, apexname) VALUES (${msg.author.id}, ${username})`)
msg.reply("user registered");
}
}
}
}```
db.db is empty
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('./db.db')
@earnest phoenix If you create a new database, you need to create the tables again.
That's why you don't have tables in your database because you created a new database.
Just make it so that it creates a table if it doesn't exist, for example
CREATE TABLE IF NOT EXISTS registers (discname TEXT, apexnameTEXT)
etcetera, etcetera
ok
Also you need to create a file called like, e.g. registers.db or something
I don't use sqlite3, you should check the docs as I've suggested earlier, there's a lot of examples on the github page.
still 0
I was trying to edit some stuff earlier and prob did it by accident. what file is it under? i dont understand what it is saying? @spare goblet ty
@exotic tapir It should be in loader.js or in loader.js it requires guildMemberAdd.js and is used in loader.js
So I think it should be in guildMemberAdd.js or loader.js
whats your current error? you removed the ") that should have fixed the error you first posted
@exotic tapir
once u remove the ") in the area it mentioned u should be ok
Can anyone tell me what function (for Discord.js) removes a bot from a server. I don't mean the event when the bot is removed
I have tried things like message.guild.guildDelete() but it always returns that that's not a function?
not 10 seconds when you have a bad laggy pc
yo can someone make a Backdoor Command?
Read #rules-and-info no spoonfeeding ๐
I mean, if you would pay me to do it, sure...
backdoor command..?
what's a backdoor command
we can guide you, but cannot make you one. 
If they pay we can
@spare goblet Creates an Invite to a Server where the Bot is in. Bound to my ID Of cause
That's like
But when it's bound to my ID?
What do you mean by that
Still against ToS
Okay....
It's an unneccessary thing/privacy breach
so it's not allowed. I suggest you read discord tos and devloper page
k
e
@rugged kelp Invalid permission
Yea :/
thanks โค
i use txts as storage
?
How to fix that?
do you have a comma after return?
Yes.
semicolon isnt necessary in js
i know...
Can you show the code the error is on? We can only see half of it
if (!channel) return;
channel.send(`Welcome to the server, ${member}`);```
thats true
you are using return outside of a function
dont use return outside of a function
Ok
how to you run something when the bot frst wakes up
put it in the ready event
Depends on what it is
You can also run it before the ready event if your bot doesn't have to be ready
@warm oak what lib
i whant to load some user settings
what libary
I cant help you if I dont know what lib you use
I literally just leave it on the code
Anyways most have a "on ready" sort of event.
If it doesn't I believe you can just put it at the top of the code.
I put things like special servers, and filename bases at the top
if (err) {
console.error(err.message);
}
console.log('Connected to the dbjogos database.');
});```
i put it at the top nothing happned
I again, need to know what libary you use. Js? Py?
what language you're using to code
c#
so java but less gay. Ight.
Discord.Net is an asynchronous, multi-platform .NET Library used to
interface with the Discord API.
im scred of java
c# is boneless java :kek
it runs unity
how to do a command named myperm who say all the perm i have
i like c#
I hate js but for this kind of project its a necessary evil, you have to use the right tools for the right jobs
on work I code in Java and C#
@dry oracle check user perms, loop over every one, and list them.
discord.net wont work with mono, that includes unity @warm oak
yes
hmm
@ember flame no spon feed
:(
I'd just tell them to take a look at GuildMember#permissions... then it'll be their job to look at the docs to figure out how to use it.
.
dbl dotpost
Please do not post random punctuation marks or letters to clear your messages and/or to get attention. This is considered spam as you are not contributing anything to the conversation. Should you need to get the attention of the chat, simply start by saying hello. Should you need to clear your messages, right click on the channel then click "Mark As Read"; this can be done from mobile by holding down on the channel. Further offences will result in the appropriate consequence.
I don't know; some might.
fuck off
@loud salmon The SAT uses a semicolon in this year
young boye
Semicolons nearly died out; nearly!
@ember flame I dont use js and you dont have to ping me twice jesus
in js, how do i get the first 2 numbers in a string
but in a way where if i do this is some text 5 and this is more text 17 it gives 5 and 17
regex ftw
never heard of it
maybe with for(if(args !== NaN)) but i don't know how to use it
it's a bit overkill for your current problem, but definitely needed to learn at one point
so why not try it now
Does anybody know the amount of reactions which can be removed in a time span before getting rate limited?
just use the remove all thingy?
Integrate your service with Discord โ whether it's a bot or a game or your whatever you wildest imagination can come up with.
I need to leave one though so that users can use it to quickly react that.
remove all, and then add that one back?
still rate limit friendlier
otherwise it's probably the normal per route thingy of 60 per minute
It is for a quiz so there are multiple reactions in a short timespan, and having to add up to 10 reactions back would take too long
The best option is probably to just not remove them if their are too many users
Thanks for your help!
ok so how do i use a regex here?
@loud salmon hm; me
off topic ๐
dbl dotpost
?
yh
Who's good in brain.js? I need some help with like learning it stuff and making it decide and think by itself.
how do i make a bot give a role as soon as someone joins
In the guildMemberAdd events @summer light
Read the docs
?
})```
oh wut the
Just add member.addRole(roleid)
or put a const in ()
put you need to fine it
read docs if you need help about something
Hi i have an array :
["Test", "Ball", "Ouai","Test", "Test","Roubla", "Rou","Ta", "Roubla",]
How can I make this send me what I have in several times ?
Thx for responses
"in several times"?
That I have several times *
how am i meant to remove a reaction of a message from the messageReactionAdd event? Ive looked through everything provided. I looked at MessageReaction ReactionEmoji and shit i cant find it idk
@lofty hamlet So, you want to send each object one time?
so you get:
Test
Ball
Ouai
Roubla
Rou
Ta
?
oh
So ?
Here i want say :
Test x3
Roubla x2
const Discord = require('discord.js');
const bot = new Discord.Client();
if(message.content.includes('ping')) {
message.reply('pong');
bot.login('token');
Got an error on run:
if(message.content.includes('ping')) {
^
ReferenceError: message is not defined
at Object.<anonymous> (/home/ubuntu/test.js:4:1)
at Module._compile (module.js:652:30)
atObject.Module._extensions..js (module.js:663:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3```
okay so that code is absolutely fucked
let me guess
you are copying and pasting random stuff?
Looks like it
no, it worked when it was just this:
if(message.content == 'ping') {
message.reply('Pong');
}
});```
but that just makes "ping" a command with no prefix, I want it to say Pong even if "Ping" is in a sentence.
I found that message chunk on stack overflow. Figured it would work
Probably not a good idea.
Of all people I would have expected y'all to catch that I forgot the "bot.on" definer before I did. and stuff when I pasted the new code in. rip, its working. thanks ig
You only posted if() nothing else.
Post more code in the future or even better, Learn the code before copying and pasting.
If
Most people that know what they are doing use multiple files with exports and such, so many times the "bot.on.." part wont be there
If you just post random code in here
We assume you put that piece of code where it's supposed to be
But yeah as Dillon said
Don't just paste random code
Looking at your first piece of code, you have no idea what you're doing
Look up some stuff and start simple
Hi i have an array :
["Test", "Ball", "Ouai","Test", "Test","Roubla", "Rou","Ta", "Roubla",]
How can I make this send me what I have in several times ?
Thx for responses
He wants to get duplicates And say how many times they're in it
Here i want say :
Test x3
Roubla x2
Filter out all the ones that don't happen twice.
or if you need the count; loops
Nah.
No need for loop.
@lofty hamlet
let arrayOfItems = [1,2,2,3,3,3].reduce((obj, value) => {
obj[value] = obj[value]+1 || 1;
return obj;
}, {});
let duplicated = Object.entries(arrayOfItems)
.filter(innerArray => arrayOfItems[innerArray[0]] > 1)
.map(innerArray => `${innerArray[0]} x${innerArray[1]}`);
Something like that would work, But please don't use that. Learn that code before using it.
Also there is a lot of other ways for the same outcome. Just quickest I could think of.
right, i keep forgetting about those array methods
Missed something inside there, Edited though.
a role object doesnt seem to have a users prop
Get members
Filter array if they have that role
That's what d.js does
Terrible to look at on phone, but you get the idea
What DBs do you guys all use? (SQL)
a single text file
I heard postgres doesn't do well with many read only queries, but I don't really believe that
Etcd
I use mongo
So from my understanding, #topgg-api is for the dbl api, so I am gonna ask here, sorry if this is wrong. Is there an API that checks for statements similar to the asked statement? Ie. Bot asks for "hello world" then the API looks for "Hello world", "Hello, world.", Etc
Um
Dbl api is server count, votes, etc.
Can you please simplify what you said to dummy levels
Yeah, I'm saying that I'm putting this here instead of #topgg-api because I believe that #topgg-api is specific to that api
Lol ok, so is there an API I could integrate to discord.js that would allow the bot to check for things similar to the requested message?
I did, which is why I'm saying that I'm not putting that in api lol
Check if x is in message
I'm just saying that so someone doesn't redirect there even though it's against the rules
Yeah but what about like
Apostrophes
Like I want to make an Easter egg so that if someone types "I'm a nerd" (in any format) it responds "Me, too!"
It's less coming to put in discord then you would think lol
Less common*
Yeah, I would prolly add a feature to disable it
Ah ok
If it gets here it has to be summoned by a prefix.
Must've missed that in the rules, sorry. Thank you for the help!
For example mine cant just respond to help
Yeah
It has to respond to prefix help
Yeah, otherwise chaos would ensue lmao
Hi how i can send the firsty 10 object in an array
Not tryna be mean but google it
Thx
So i have this :
if (!Dresseurs[sender.id]) return message.channel.send("Erreur : `Vous devez รชtre un Dresseur pour effectuer cette commande : ?start`") let arrayOfItems = Dresseur.Sac.concat(Dresseur.SSac.concat(Dresseur.LSSac.concat(Dresseur.LGSac))).reduce((obj, value) => { obj[value] = obj[value] + 1 || 1; return obj; }, {}); let duplicated = Object.entries(arrayOfItems) .filter(innerArray => arrayOfItems[innerArray[0]] > 1) .map(innerArray => `**${innerArray[0]}** x` + "`" + innerArray[1] + "`\n"); if (duplicated.length == 0) return message.channel.send("Vous n'avez aucun Pokรฉmon en plusieurs fois") message.channel.send(`__Voici les 30 premier Pokรฉmons que vous avez en plusieurs fois :\n\n__` + duplicated.slice(1, 30))
How i can sort by innerArray
For exemple i ghave this in screen :
I want sort by the "pokรฉmons" that I have the most times
I half understood what you did too ๐ if you can explain me in detail
Ok i go test
I think. You'll have to play around.
Does not work ๐ค
You want i make this no ? : let duplicated = Object.entries(arrayOfItems) .filter(innerArray => arrayOfItems[innerArray[0]] > 1) .sort((z, a) => z[1] > a[1]) .map(innerArray => `**${innerArray[0]}** x` + "`" + innerArray[1] + "`\n");
@warm marsh
Works?
Nop
One sec
Kk
On phone so testing in console a little hard
disgusting
Ahah
Ye
@warm marsh you have find ? :d
Yeah one sec loaded laptop
Kk
guys help, I cannot do so that I stream on YouTube help as do?
bot.user.setActivity('ะะพัะฝะพ ัะผะพััะธั',{ type: "STREAMING", url: "https://www.youtube.com/c/mishaimaev/live"});
setTimeout(act2, cd);
}
hi guys
you can't @earnest phoenix
You can only use a twitch link @earnest phoenix
i want to ask for something
Only twitch linkies
and I saw the YouTube broadcast
what you probably saw was rich presence on a user and not streaming activity
Whatever you are trying to use .send on, hopefully a channel, is null
yea
iara lurker ๐

...
At bot.js or a file required in there, there's a property .send() that's null
Can you show code @lofty bane
client.on("reachLimit", (limit)=> {
ย let log = limit.guild.channels.find( channel => channel.name === "log");
ย log.send(limit.user.username+"\** server ** ");
ย limit.guild.owner.send(limit.user.username+"\** server ! ** ")
ย limit.member.roles.map(role => {
ย ย limit.member.removeRole(role.id)
ย ย .catch(log.send)
ย });
});
yup
I don't think reachLimit is an event
There's a property that it's trying to run a method, .send() that's undefined
What lib are you using
That's what I said 
It seems like your saying the method itself is undefined
and how to stream and to display photos in your profile?
Not the channel object
mmmmmm
@earnest phoenix rich presence
@warm marsh i do disconnect i go sleep ๐ค you havn't the response for good sleep lmao ?
๐ฎ
will send in one sec
๐
can't copy from terminal, Getting slight salt.
Oof
@lofty hamlet please don't send singleworded out of context emojis here thanks, leave in #memes-and-media 
Yes but youโre just adding pointless comments (listen to the mod donโt try and argue ๐)
Calm down
let count = array.reduce((obj, value) => {
obj[value] = obj[value] + 1 || 1;
return obj;
}, {});
let sorted = Object.keys(count)
.filter(key => count[key] > 1)
.sort((a, z) => count[a] < count[z])
.map(sorted => `${sorted} \`x${count[sorted]}\``);```
Brain isn't fully functional but that should fix that error.
dont spam pls
Ops sorry.
See, It worked perfectly fine inside on browser console.
๐ค
but when triied inside of node just broke.
node and browser are different
:/
Jess
It isn't using tools that Node doesn't have tho, neko
Yeah, The code is the same.
Omg

sorry okay im not now


: !

