#development
1 messages · Page 618 of 1
One message removed from a suspended account.
One message removed from a suspended account.
also if its + 0 why are you even adding 0
Hi i need help again with discord.js bot script
module.exports.run = async (bot, message, args) => {
var con = mysql.createConnection({
host: "localhost",
user: "****",
password: "*********",
database: "******"
});
con.query("SELECT user FROM Staff", function (err, result, fields) {
const users = JSON.stringify(result)
console.log(JSON.stringify(result))
let userr = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]);
if(!message.author === (`${users}`)) {
if (err) throw err;
console.log(err);
if (!userr) return message.channel.send("Usage: -givepremium <server id>")
CODE
} else {
message.channel.send(`Sorry but you are not staff!`);
}
})
}
Error:
I got Sorry but you are not staff! as reply but i am added in db
BTW: last person that help me give me script but its not working for me
One message removed from a suspended account.
because you didnt define the array in that one line you copy pasted
me @mossy vine ?
oh i think i see the issue
One message removed from a suspended account.
if(!message.author === (`${users}`)
users is define
users is a list of users, right?
yes
aaand the message.author object isnt that list of users
you need to check if the users includes the message author
its not includint its checking in db if user is mod
you arent checking that
okay let me explain
message.author might look like this
id: "123456789",
username: "someguy",
discriminator: "1234"```
and your users object might look like
["someguy", "someotherguy", "yetanotherguy"]
no matter how you look at it, those 2 arent equal
you are comparing an apple to a basket of fruit
the basket may include the apple, but they arent the same thing, which is exactly what the command says
i got 2 one on my script i convert the 1 one by JSON.stringify
yeah you obviously dont understand
but what should i do to that work
i literally explained
@mossy vine in your code is a mistake
i even came up with a very nice metaphor just for you
@quiet topaz my code is the mistake
You wrote
if(!message.author === (`${users}`)
But you forgotten a )
wait why is there the ( before the `
Yes, that i mean
but look i got this as out put
[{"id":1,"user":"572527691949932556","type":1,"date":1556908550,"administrator":"572527691949932556"},{"id":2,"user":"559041831569063936","type":1,"date":1556908550,"administrator":"572527691949932556"},{"id":3,"user":"572527691949932556","type":1,"date":1556908550,"administrator":"572527691949932556"}]
Then what should i do convert back to sql version?
@mossy vine
@quiet topaz thats not my code i just copypasted it from him
@earnest phoenix no clue, never used sql
Ah, ok but it a mistake anyway
:/ shit i am playing with this aroun a 1/2 weeks and none work
ok progress
´´´previous problem: bot.registry.registerGroup('simple', 'simple'); "simple" was big letter instead of small
NEW PROBLEM:const bot = new discord.client();
^
ReferenceError: discord is not defined
at Object.<anonymous> (C:\Users\Liam\Desktop\MYBOT\index.js:2:13)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)´´´
Did you define discord or did you define Discord
discord
Big i mean
small
dpy
almost
You must know what library you use...
But i think i are using js
Yes it mustve defined
ehm what that mean?
const discord = require ('discord.js')
You must define it, or use 'commando' istead of 'discord'
You need to declare discord.js too
const Commando = require('discord-js-commando');
const discord = require('discord.js');
const bot = new Commando.Client();
Yes
no ; at the end?
you should do it
ok i did that now i get
(function (exports, require, module, __filename, __dirname) { constant Commando = require('discord-js-commando');
^^^^^^^^
SyntaxError: Unexpected identifier
at new Script (vm.js:80:7)
at createScript (vm.js:274:10)
at Object.runInThisContext (vm.js:326:10)
at Module._compile (internal/modules/cjs/loader.js:664:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
Do 'discord.js' instead of 'discord-js-commando'
no
its not
huz i get same thing
You did 'const' not 'constant' right?
He edited
this is what i get now
internal/modules/cjs/loader.js:584
throw err;
^
Error: Cannot find module 'discord-js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\Liam\Desktop\MYBOT\index.js:1:80)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
oh boooooy
'discord.js' not 'discors-js'
installing commando should do that
i did what you said
const bot = new Commando.client();
^
TypeError: Commando.client is not a constructor
at Object.<anonymous> (C:\Users\Liam\Desktop\MYBOT\index.js:2:13)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
How did you declare discord.js?
declare?
const bot = new Commando.Client();
oh new things
bot.registry.registeerCommandsIn(__dirname + '/commands');
^
TypeError: bot.registry.registeerCommandsIn is not a function
at Object.<anonymous> (C:\Users\Liam\Desktop\MYBOT\index.js:7:14)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
nvm
const Commando = require('discord.js')
const bot = new Commando.Client();
Yes, first time i helped a person
just because of that i will give you and creeper early access to it
now i got new question
Ask
class CoinFlipCommand extends commando.Command
{
constructor(client)
{
super(client,{
name: 'flip',
group: 'simple',
memberName: 'flip',
description: 'flips a coin, landing on either Crown or Heads'
});
}
async run(message, args)
{
var chance = Math.floor(Math.random() * 2);
if(chance == 0)
{
message.reply('Your coin landed on Crown!');
}
else
{
message.reply('Your coin landed on Heads!');
}
}
}
module.exports = CoinFlipCommand;```
does this look right?
I am not the best at js, but i could work
i followed a guy making tutorials on youtube and that was the next tutorial
to make
please no var 
Why?
var isn't block scope
Block scope?
yes
What is block scope?
so know i tried the command and in the terminal this came up
block scope variables means they can only be used in the block of code they have been defined in
if(msg.content === 'HI')
^
ReferenceError: msg is not defined
at CommandoClient.bot.on (C:\Users\Liam\Desktop\MYBOT\index.js:15:2)
at CommandoClient.emit (events.js:194:15)
at MessageCreateHandler.handle (C:\Users\Liam\Desktop\MYBOT\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\Liam\Desktop\MYBOT\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (C:\Users\Liam\Desktop\MYBOT\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\Liam\Desktop\MYBOT\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\Liam\Desktop\MYBOT\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:189:13)
at Receiver.receiverOnMessage (C:\Users\Liam\Desktop\MYBOT\node_modules\ws\lib\websocket.js:789:20)
at Receiver.emit (events.js:189:13)
Did you decrare message as msg?
@ancient prawn do you know javascript?
Using let / const also allows you to give a clear signal if that variable will be changed or not
While var is just var
ehm it was like 2 days ago i started with any coding at all
Ok, you are a beginer
ye
One message removed from a suspended account.
?
One message removed from a suspended account.
- dont call me Cy
- most likely because it isnt compatible with your command handler, the main code is there, you just need to edit it a bit
One message removed from a suspended account.
yay now my bot can do flips
One message removed from a suspended account.
@ancient prawn i didn't realize that you were new, my fault
np
first try to learn to code javascript
then you can go here https://discord.js.org/#/
after doing
msg.channel.createWebhook("name");```
how would i get the webhooks id & token? (d.js)
i did what it said in the docs but its being weird
instead of blindly creating a webhook, how about you bind it into a variable? that way that variable will be an instance of a discord webhook object
i did that and deleted it
i should go with my first insticnt on these things
thank you
i create a webhook in my channel and then i write the id and the token?
yes
thanks
@earnest phoenix canary webhooks do work fyi https://puu.sh/DtCIo/84fce4b35d.png
One message removed from a suspended account.
Hey, I have one question right. Is there a limit on how many voice channels a bot can be in because my bot crashes as soon as its in 22 voice channels with the same error each time!
no, your vps is probably too weak to handle it
so i am trying to get my bot to join VC but its not able to
this comes up
(node:12944) DeprecationWarning: Collection#filterArray: use Collection#filter instead
pretty self explanatory
@ancient prawn do you use commando with discord.js?
yes
it's a known issue with stable commando you can ignore it
Use a function
@inner jewel its not for me as i am new
it's in commando source
.find("username", "bobby") -> .find(u => u.username == "bobby")
Well when it's updated it literally wont exist
it's literally commando source he can't change it
But @earnest phoenix, its printing this error on 22 servers.
if(this.queue[id].length > 0) { TypeError: Cannot read property 'length' of undefined
Is this vps related?
clearly not
your object in the queue doesnt exist
But the part me and my other dev dont understand is we dont even have a queue
Its nothing that is queue related
can you provide the full stacktrace
commando sux
this is my code
´´´
const commando = require('discord.js-commando');
class JoinChannelCommand extends commando.Command
{
constructor(client)
{
super(client,{
name: 'join',
group: 'music',
memberName: 'join',
description: 'The bot will join the channel youre in'
});
}
async run(message, args)
{
if(message.member.voicechannel)
{
if(!message.guild.voiceConnection)
{
message.member.voiceChannel.join()
.then(connection =>{
message.reply('Success i joined you Sir!');
})
}
}
else
{
message.reply('Sorry i have failed you Sir 😭');
}
}
}
module.exports = JoinChannelCommand;
´´´
class JoinChannelCommand extends commando.Command
{
constructor(client)
{
super(client,{
name: 'join',
group: 'music',
memberName: 'join',
description: 'The bot will join the channel youre in'
});
}
async run(message, args)
{
if(message.member.voicechannel)
{
if(!message.guild.voiceConnection)
{
message.member.voiceChannel.join()
.then(connection =>{
message.reply('Success i joined you Sir!');
})
}
}
else
{
message.reply('Sorry i have failed you Sir :sob:');
}
}
}
module.exports = JoinChannelCommand;```
there you go
Anyone know how I'd add a role to a member using the role's ID?
role = discord.utils.get(member.guild.roles, id='ROLE ID HERE')
await member.add_roles(role)
Does not seem to work.
(Discord.py Rewrite branch)
const Discord = require("discord.js");
const perp = require("../personal-profiles.json");
const fs = require("fs");
let defName = "N/A";
let defGender = "N/A";
if(!perp[message.author.id]) {
perp[message.author.id] = {
Name: "",
Age: 0,
Gender: "",
};
}
perp[message.author.id] = {
Name: perp[message.author.id].perp + defName,
Gender: perp[message.author.id].perp + defGender
};
fs.writeFile("../personal-profiles.json", JSON.stringify(perp), (err) => {
if(err) {
console.log(err);
} else if (!err) {
message.channel.send("Account created successfully! Use `r!help pers` for help on completing your account!");
}
});
it doesnt write to the file
im using a command handler btw
and the command responds with the message too
so the command itself IS running
I wouldn't use json as a database
lmao
im just testing
using json as a databae is what's wrong
If u need to write to a file use like SQLite or something
then don't test with json
Don’t use SQLite tho
why is it so hard to get an answer ffs
what's the point of testing if you won't be able to apply that knowledge in prod
...?
yes
json is horrible for databases
i understand
i dont have money
to buy a database
wat
You can use SQLite
Use mongo
You don't. Need to buy a databae
yes
or i would be using it
Database*
You don’t buy a database
...?
Lmao
do your research before making an argument thanks 🙏
You'd buy a host, but you dont need one
i know there are free databases
You can have a database on a google spreadsheet
Lmao I like how the poor guy asked an innocent question and everyone lashes out
Idk about that tho
They're all free dude @broken elm
Lmao
Like sql or mongo or any other db
A great one for beginners would be SQLite, which is file-based, just like JSON (which isn't a database).
this is literally the one reason i hesitate asking questions in servers like these
innocent question
gets lashed at
literally we are trying to help u
Ikr I don't like how ppl lash out either
I mean some legitimately try to help but others like that cry person doesn't
i asked a simple question
We're trying to tell you how to improve
literally do you want to waste 15 hours for stack overflow
bro just use quickdb or something
im not using thsi forever
your acting like my bot will be large enough to where i would need to worry about json being bad
why you shouldn't and can't use json as a database:
- you're writing to a file. it isn't and doesn't support async, you can't do two operations on the same file at the same or close to the same time.
- it's a file, it's size will buff up to very huge sizes in a very shot timespan
- it's lacking with data types
- it has strict formatting rules, mess up one character and your ""database"" is invalidated
and you can't use it as a database
Then why r u using it..
the only paid databases are the fancy ones like ravendb, and even those have a free version
if you want to do local databases you can use sqlite
oh no no no no
but you can't use json as a database, there's no fix to it
Dna every server out there would tell you the same thing
Called?
the answer to your question is not to use json. you're using filestreams, which, quoting; you're writing to a file. it isn't and doesn't support async, you can't do two operations on the same file at the same or close to the same time.
that would actually help me with the issue im having rather than lead me in a different direction then what i asked
well
thanks
If we helped you... we would be directing you to a hole
sorry for bein a cucc
I used json for an economy section its bad and very long to manage
you can't make it work, no matter how hard you try you will always have issues if you use regular files as databases
My excuse of not learning sql is that I am lazy
I use Google Sheets for my database :dab:
ikr
I said that before lmao
actually notepad is
discord text channels best database
I recently watched a video on it
.txt all the way
@earnest phoenix actually, 2-3 years ago someone wrote a library that does just that
I store all my data in my phones text messages. It uses a service to text my phone which I respond with the correct things that would come from a database
I store it all in sound waves inside a jar
c but longerToday at 11:08 PM
@cry actually, 2-3 years ago someone wrote a library that does just that```
what, discord channels or?
I store all my data in a roblox decal
oh i-
Yeah, you were joking
imagine the latency on that
Some madlad did it way before you
My data is stored inside of my TV remote
I recently started storing my bot's data in my tablets cardboard box
hire slaves to write data on a piece of paper and retrieve it on request
Nah but seriously tho, anyone know how I'd give a role via ID? using rewrite branch
I tried id instead of name but it would have an aneurism
well issue is
i dont mean tags but
name of it
cause i looked around
and i found no way accessing it
That doesn't exist either
Like do u need to know the selector u wanna change or the property?
found
k
@opaque eagle
@west spoke
div.name{
background-color:black;
}
It's just a example
<div style="name">text</div>
.content doesnt exist.
It's in <style>
hmm
@topaz sphinx css section#bot-details-page { background-color: /* color here */ }
Now to make my own py module to simplify discord async
If u wanna change the background color what's what u do
bot details page -> wrapper-page -> container is-widescreen -> container is-widescreen -> longdescription -> content
div.longdescription {
background-color: /* color here */;
}```
seems like it doesnt access it
Try the edit
still not
Add !important
Show CSS, show page
It works if you do div.content and !important
how u combine those two
div.content {
background-color: springgreen !important;
}```
1 se
(You can use any color u want, that's what I used)
np lmao
is there any Xcode rich presence?
Not that I know of, but you can easily make an xcode RPC client.
It's a library
nice, i'll try, thanks
Ik... I was suggesting that they make their own
emoji.url
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
He's exporting the object, it's happening else where in his code obviously
One message removed from a suspended account.
One message removed from a suspended account.
Oh you're the same person who asked the question lol, just look wherever you handle the help objects
One message removed from a suspended account.
Which I would assume is in a help command
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
@sage bobcat make sure you are using .run where the code is being run
One message removed from a suspended account.
One message removed from a suspended account.
ie client.on("message", async =>{})
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
do you not have any logic determining what file should run
One message removed from a suspended account.
you get a message
One message removed from a suspended account.
it goes into the on.("message")
it determines it to be this command
It runs this command
One message removed from a suspended account.
is that how your code goes?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
🤔
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Where is that
One message removed from a suspended account.
do you have a central/main file
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
For some reason I keep getting this weird error... sh /usr/src/app/dist/commands/ping.js:5 class default_1 extends __1.Command { ^ TypeError: Class extends value undefined is not a constructor or null
One message removed from a suspended account.
One message removed from a suspended account.
@opaque eagle __1.Command does not exist
One message removed from a suspended account.
console.log commandfile and see if it logs when you run the ban command
@opaque eagle have you tried console.log-ing it?
right before creation
One message removed from a suspended account.
One message removed from a suspended account.
no
It says undefined
After let commandfile = ... put console.log(commandfile)
but it's defined :(
See if it prints out anything when you run the ban command @sage bobcat
One message removed from a suspended account.
@opaque eagle obviously not mi amigo
One message removed from a suspended account.
Dude u have to believe me... I can show my code
I normally don't ask help for such dumb errors... but I've tried everything...
One message removed from a suspended account.
Where are you defining it @opaque eagle ?
/ if you could post the code you use to do so
One message removed from a suspended account.
[Deleted message]
@sage bobcat that's not what I told you to do. I recommend getting your beforementioned friend to help as this is not working out
/ if anyone else here wants to step in
This is ping.ts, where the error comes from, which I didn't commit yet```ts
import { Command, Penelope } from "..";
export default class extends Command {
}```
One message removed from a suspended account.
One message removed from a suspended account.
why are you doing __1. Then
One message removed from a suspended account.
One message removed from a suspended account.
That's the TypeScript compiler @night imp
Aight
One message removed from a suspended account.
I don't use typescript hopefully someone else knows
Just confirm that your path is right ig
k
One message removed from a suspended account.
okay, you need a )
One message removed from a suspended account.
One message removed from a suspended account.
Ok den it isn't finding the command file
A simple question, how do I request my bot to be in #265156361791209475 ?
You make useless loggers and send it to bot hell
like a welcome message
I do not think my bot does have the permissions to talk there.
not in these channels
yeah, I mean bot-hell
it can
I can see that it can read messages, but not text
oh
What was the way to display the bot's avatar url again?
client.user.avatarURL?

It took me forever to figure out I defined my bot as conn lmao
hi
@steel heath 

Why are people brutal force attacking my bot?
😢
I never wanted to programm banning people
now i have to -.-
What are best methods to ratelimit requests?
welcome to the real world....
What are best methods to ratelimit requests?
depends on what time frame you want to limit by
like cooldown 5 seconds your lib probably has a built in thing for it
cooldown 24 hours then a db is prefered
const settings = client.getSettings(guild.id);
if (settings.randomEvents !== "true") return;
axios({
method: "get",
url: "https://api.memeload.us/v1/random"
})
.then(function(response) {
console.log(response.data.image);
});
var embed = new Discord.RichEmbed()
.setAuthor("Meme-time")
.setColor(client.config.botColor)
.setFooter(welcomeMessage);
guild.channels.find(c => c.name === settings.eventChannel).send(embed).catch(console.error);
}
(function loop() {
var rand = Math.round(Math.random() * (200000 - 500)) + 500;
setTimeout(function() {
task();
loop();
}, rand);
}());```
what do you think about:
ayy how can i check in every server if there is guild
If i make a veriable for each user, and i add +1 to this each time a user uses a bot
and i have a background task, reducing all these variables each 4 seconds
and then a check, if this variables comes over lets say 60, a user gets on banned list for a day?
If there is guild? What does that even mean
Guilds are servers in the api
im now using mysql
and its working fine
although
im trying to collect names by getting args[0]
but in the table its a number
im pretty sure it just counted the number of letters in the string
the name column is varchar btw
it seems like its not updating at all when i use the UPDATE thingy
What
make sure you use prepared statements on userinput or I will attack ur sql
Hi i need help again with discord.js bot script
module.exports.run = async (bot, message, args) => {
var con = mysql.createConnection({
host: "localhost",
user: "****",
password: "*********",
database: "******"
});
con.query("SELECT user FROM Staff", function (err, result, fields) {
const users = JSON.stringify(result)
console.log(JSON.stringify(result))
let userr = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]);
if(!message.author === (`${users}`)) {
if (err) throw err;
console.log(err);
if (!userr) return message.channel.send("Usage: -givepremium <server id>")
CODE
} else {
message.channel.send(`Sorry but you are not staff!`);
}
})
}
Error:
I got Sorry but you are not staff! as reply but i am added in db
If you know anwser ping me
Still the same question i answered yesterday..
I even wrote a damn beautiful metaphor smh
@mossy vine i know but i dont get it what you mean
do research on it then
@earnest phoenix i did a loot past a week
ok
research is not googling HOW TO DO X HELP?? and going to the first youtube video. research is searching a specific term, reading up docs about it
@earnest phoenix i did that
you don't have to ping me on every message
and clearly not enough
OMG do u guys remember that one question I kept asking about the constructor doesn’t exist thing? Fixed it!!! Someone in the Discord API server helped
hi can someone give me an example of iframe tag to use in the bot's detailed description ?
async function replyWithInvite(message) {
let invite = await message.channel.createInvite({
maxAge: 10 * 60 * 1000
maxUses: 1
}, `Requested with command by ${message.author.tag}`).catch(console.log);
message.reply(invite ? `Here's your invite: ${invite}` : "There has been an error during the creation of the invite.");
}
break;```
Unexpected identifier
Try to see small text below cool
what line are you getting it on
2nd
^
Why?
object = {
propety: something,
anotherPropety: somethingElse
}```
Ohh
👀
"why"
I thought you talking about *
what
How can I make a prefix + say command? Can someone help me? (discord.js)
what is the issue here? what have you set up already?
hey
I need a part in a string starting from the 2048th character of string to the 4096th
how can I do that?
@dawn kindle bruv
That's easy
Just strip the command name
And have it reply with the rest
@vague chasm <String>.substring(2047, 4095)
I had tried that
but
still error
embed.description: Must be 2048 or fewer in length.
oh wait I found my mistake
lmfao
Hey, do you know any bot host $1/month.?
no
sad
One message removed from a suspended account.
The closest to that is www.hostmyservers.fr
^
Check pins, it's 2.49 france currency
idk what they use in france
Hey, do you know any bot host $1/month.?```
just a note, there's no such thing as ""bot"" hosts
no euro is for europe
boy
also france uses euros and francs
not the switz ones
every country in europe uses euros and then there's their own currency
"every"
almost
better
oh
@dawn kindle take message.content and send it after slicing the prefix
¯_(ツ)_/¯
or use args.join(“ “)
and send what ever
@earnest phoenix you code in javascript ?
@empty owl oh thanks alot! Worked perfectly.
np
here :
const discord = require ("discord.js");
module.exports.run = async (bot, message, args) => {
let user =
try {
if (!user.voiceChannel) {
return message.channel.send('**❌ Vous devez être dans un salon vocal pour pouvoir exécuter cette commande.**')
} else {
if (user.voiceChannel.joinable) {
user.voiceChannel.join().then(async (connection) => message.channel.send(`Sécurité anti-ddos activée.\n\nJ'ai rejoind le salon vocal : \`${connection.channel.name}\``))
}
else {
return message.channel.send(`**❌ Je n\'ai pas les permissions d\'accéder au salon vocal ${user.voiceChannel.name}.`)
}
}
} catch (e) {
console.log(e);
return message.channel.send('**❌ Le système ne peut pas être exécuté. Veuillez ressayer ultérieurement.**')
}
}
module.exports.help = {
name:"antiddos-on"
}
How can I define user?
message.author ?
message.author
He tells me every time You must be in a voice channel while I'm in a voice channel
^
ok
message.member should work
yes
ok
So I set user by message.member
Okay thank you very much
Works! Thank you
Are you guys also experiencing BFA attacks on your bots?
excuse me what
Brutal force attack
no
Intentionally sending extreme amount of commands in order to crash him
here's your lord and saviour; command cooldowns
sounds like ddos
I have around 2000 commands per second ... Lol
please use command cooldowns
Yes i upgraded bot with cooldowns
I am just wondering, if you guys experiencing this too
best anti-ddos - limit each command to one use per day globally
rate limit the people fast or you will be having problems
spamming commands which dont have a cooldown is not a ddos
it's the fault of the bot dev for being dumb
Is it allowed to add users ids and server ids on permanent ban?
i'm wondering if it's even possible to ddos a bot's vps
surely it is, but purely from discord
i'd be impressed
Can those people report me for a bot not working?
but 2000 commands per second, in how many guilds the bot is even in?
no lol, it's your bot, you decide what the bot does
dbl doesn't care if your bot stops working if that's what you're thinking
Okay thank you :)
I was afraid i might be breaking some rules if i ban users from using it
hm so if the bot takes unsecure links from users (e.g image manipulation commands via urls) you could make the bot visit an iplogger, even then the host would have to be really bad for it to be easily ddosable, otherwise i dont believe you can get the ip
Naah, my ip is luckly not available :)
It isnt ddos, just BFA with commands
They programmed spamming coands
It is happening now for 18h already -.-
I wonder why would someone do this ...
ddosing a well built bot would be very difficult to do as shards are there to take the hits
One message removed from a suspended account.
One message removed from a suspended account.
soo im testing out several dbs and apparently channel.send() isnt a function https://btw.i-use-ar.ch/i/c9qb.png
One message removed from a suspended account.
what
One message removed from a suspended account.
it's a.. textchannel
it is
so when i get the doc and try to do doc.logChannel.send() it says .send() isnt a function
nvm fixed it
lmao
if event.user.bot_account then return nil end
@sage bobcat should work if i looked at the module correctly
@west spoke javacord can do that, want me to check their sources for the raw api call?
maybe you can lookup the py api for its location then
I would've helped, if you wouldn't have said async
:v
isn't async like... super outdated?
It is
20 seconds worth of searching
I googled it but all I was finding was rewrite
@ruby dust working with embeds hasn't changed
you literally google discord.py async docs, click on the first link, scroll to data classes and click on embed
Again I was finding rewrite
client.guilds.forEach(guild => {
const settings = client.getSettings(guild.id);
console.log(settings)
callback(settings[0]);
}); // Close foreach
}
function RunGuilds() {
getAllGuilds(function(err,data) {
console.log(data)
if (data.randomEvents !== "true") return;
axios({
method: "get",
url: "https://api.memeload.us/v1/random"
})
.then(function(response) {
console.log(response.data.image);
var embed = new Discord.RichEmbed()
.setAuthor("Meme-time")
.setColor(client.config.botColor)
.setFooter(welcomeMessage);
guild.channels.find(c => c.name === settings.eventChannel).send(embed).catch(console.error);
});
});
}
(function loop() {
var rand = Math.round(Math.random() * (20000 - 500)) + 500;
setTimeout(function() {
RunGuilds();
loop();
}, rand);
}());```
i cant mangae to log data of all guilds help
@modest remnant yes you can
It is, but it's also not smart
You’ll have to have it hosted online tho
And editing bots from mobile is a much more painful experience than on computer
Well you’ll need to set up the bot in the applications settings of discordapp.com
Then you’ll need to choose an online platform to host it from
Then you’ll need a tutorial of some sort to show how to make the bot, but you’ll have to do it on mobile instead of on pc (like in the videos)
Which online platform is bet to host bot
I’d ask someone else about that. I use glitch.com but I wouldn’t recommended using it to host ur bot
@grizzled spruce okay
Lmao glitch.com
@grizzled spruce depending on the phone, if its android, pydroid works v well
I used that to host the early stages of my bot
But since started using a laptop
I see
So... Where did I fuck up?
Nah
It ignores edits
Okay well I moved self.friends to the actual update and shit works now so idk
logging messages
still, yikes asf
It's no issue to remove it, tbh the entire reason I even had it print was to make sure my bot wad ignoring other bots and I never bothered to remove it lmao
Meh, I'll pull it now while I'm editing the main file
Done
@fiery stream you need guild names, right?
bruh
What?..
nothing lol
Okay 😂
Why the status of my bot has not changed since ??? on online? (ID: 552187061847719943)
The bot has been on DBL for a long time)
I'll tell you now, I'm just looking for him.
I have a suspicion that he still does not)
does anyone has an music source code?
@simple silo what lang?
@pliant needle doesn't matter.
i can translate it.
but i tried tons of and no ones works
i have youtube search
works like a music player?
i have a custom but
im waiting to approuve my bot
me too
3 days waiting
Ok, come DM
@here does someone has an music command source code?
why not? i want to help him :)
here @simple silo ```JS
var MusicJS = require(music-discord-javascript);
var musicHandler = new MusicJS();
musicHandler.play(youtubeURL); // u need to put ur youtube url here
module.exports = new Command("play", () => {
musicHandler.play(youtubeURL);
});
and that's how u make it a command :)
I'm confused
He’s using some crappy third-party framework to make a music bot since apparently it’s “too hard”
someone here?
@ruby dust yes thats ken, he was promoted to whitename lmao
nice
No one is going to spoonfeed you code for those commands
don't ping all mods for no reason kthx
]]faq 10 --clean
idk
that indentation + no ; 
anyway
From what I can see, the issue is literally right next to the error message
Why does ts give me that error?js const { getPromiseDetails } = process.binding("util");``````sh Property 'binding' does not exist on type 'Process'.
who has an music source code ?
Google it @simple silo
i found just shitty things
Good for you just use them
not workng
by the time you spent looking for the code you could've written it
i don t know to code
great, then don't code and use public bots
please learn how to code before you code a bot @simple silo
Or learn by doing.
I learned to code a bot as I coded the bot
product of that is having a bot with messy and unoptimized code
Well I used a tutorial
even worse
But then you have the fun of optimizing the code later on.
I used tutorials to learn the basics and learned everything else from the docs
but you don't know how to, because instead of learning the language first like a sane person, you learned as you went and only learned terms that are requried from the library
You're out of your command template sir
You have to build things on a specific template you can't just put codes in a new file and hope it'll work
Check your other commands and try to find the difference
let baseAmt = Math.floor(Math.random() * 18) + 1;
console.log(`${coinAmt} ; ${baseAmt}`);
if(coinAmt === baseAmt){
yen[message.author.id] = {
yen: yen[message.author.id].yen + coinAmt
};
fs.writeFile("./yen.json", JSON.stringify(yen), (err) => {
if (err) console.log(err)
});
let creditembed = new Discord.RichEmbed()
.setAuthor(message.author.username)
.setColor("#008B00")
.addField("Yen", `${coinAmt} Yen added!`);
message.channel.send(creditembed).then(message => {message.delete(10000)});
};
How would I disable this for this server?
it's there a way to get minecraft server stats ?
api
use an api, there are thousands or ping the server directly yourself
^
Discord api is so slow nor?
Yeah @static matrix
Yeah, it's not working for me too sh DiscordHTTPError: 500 INTERNAL SERVER ERROR on GET /api/v7/oauth2/applications/@me
if nobody answered you yet, its prob because process.binding() is deprecated
It's taking me a bit to login to my own user
Same
😤
Any idea where I could start with building a smart convo bot?
@empty owl what is a convo bot
ooh
Like having a convo with a person
idk
but it’s not a person
you can make a bot answer to certain words
ah
I see
@empty owl use natural language processing
There is a API service that does that
Anyone know where I can find a rainbow bot???
Yes
That would be API abuse
???
So no. As it's considered API abuse which is a bannable offense
Wtf is api abuse
Where the API is spamed/abused for no reason @ionic latch
So there is no rainbow bot
No
@stray wasp you may be thinking of cleverbot
but ur own nlp is better cuz u don't have to spam the api
Clever bot costs now iirc
🤣
😂
cleverbot's overpriced
cleverbot isn't an AI, it's advertised as one but it isn't one
It's a very shallow ai
Should be given way more neutral depth
It seems like currently it only goes 2-3 deep
throw err; // Unhandled 'error' event
^
Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object])
at VoiceConnection.emit (events.js:178:17)
at VoiceWebSocket.ws.on.err (C:\Users\chillkey123123123213\Desktop\ChillBot\discord-bot\node_modules\discord.js\src\client\voice\VoiceConnection.js:363:32)
at VoiceWebSocket.emit (events.js:189:13)
at VoiceWebSocket.onError (C:\Users\chillkey123123123213\Desktop\ChillBot\discord-bot\node_modules\discord.js\src\client\voice\VoiceWebSocket.js:156:10)
at WebSocket.onError (C:\Users\chillkey123123123213\Desktop\ChillBot\discord-bot\node_modules\ws\lib\event-target.js:128:16)
at WebSocket.emit (events.js:189:13)
at _receiver.cleanup (C:\Users\chillkey123123123213\Desktop\ChillBot\discord-bot\node_modules\ws\lib\websocket.js:211:14)
at Receiver.cleanup (C:\Users\chillkey123123123213\Desktop\ChillBot\discord-bot\node_modules\ws\lib\receiver.js:557:13)
at WebSocket.finalize (C:\Users\chillkey123123123213\Desktop\ChillBot\discord-bot\node_modules\ws\lib\websocket.js:206:20)
at TLSSocket.emit (events.js:189:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
C:\Users\chillkey123123123213\Desktop\ChillBot\discord-bot>pause
Press any key to continue . . .
``` i get this
how do i make a discord invite link with the perms that my bot requires and admin lmao
wait nevermind, i just added 8 to the number i got
Yep, 8 is for ADMIN
Yep hehe
but you have to put it after the &permissions=0
and replace 0
if i remember well
yeah i know lmao
ty for your concern though
ah i'll soon update my bot page on this website, i think its outdated a bit now
sameeee

I see
I use discord.js
I should have switched to eris from discord.js





