#development
1 messages · Page 737 of 1
It's pretty reasonable
no it fucking is not
Depends on what other tasks are taking up reasorces
cpp walks in looking for an ide
I mean hey the python IDE exists that uses like 50MB ram for python
So if you rlly want lightweight
Use python
python doesnt need an ide
or write in notepad for lightest weight
Close enough
not at all
Idk if jetbrains have a cpp IDE
Oof
i asked for an ide for java stop recommending me to use python because you use it
i personally use intellij

do intellij
You might have to bite the bullet
Like 500MB is pretty reasonable even on 4GB
That or get more ram xD which on a MacBook is merrrr
yikes
yes its very bad
F
but for games which i play the core 2 duo helps its case instead of a hecking celeron
How df do you get by on 2GB ram
my computer has 2 gb too
anything that uses more than 200-300mb besides a game is unreasonable
to me anyway
2gb in 2019
how do yall live without having a breakdown
you see
i just minecraft
which is still a fucking terribly unoptimized game by itself because java
but
minecraft & crash because the code is so bad and unoptimized 😎
my friend has 4gb and a pentium
they get like 100fps
on optifine
on the surface
i get 30-40
the celeron pc is worse i get like 20-30
csgo works on this macbook but not on the other pc
i play light and indie games most of the time
or games with minimal settings
i never have more than 4 apps running
thats how
I don't understand why I get this error, can someone help me?
(node:22) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'split' of undefined
let spamdischannels;
let delspammessage;
let supsafe;
let affectbots;
configbd.query(`SELECT * FROM config WHERE id = ${message.guild.id}`, (err, rows) => {
if (rows.length < 1) {
configbd.query(`INSERT INTO config (id) VALUES ('${message.guild.id}')`)
spamdischannels = "relleno";
delspammessage = 1;
supsafe = 0;
affectbots = 1;
}
else {
spamdischannels = rows[0].spamdisabledchannels;
delspammessage = rows[0].spamdelmsg;
supsafe = rows[0].supsafe;
affectbots = rows[0].affectbots;
}
})
//Retenciones
let channelarray = spamdischannels.split(",")
if (channelarray.includes(message.channel.id)) return;
whatever ur trying to split is undefined
Array#split doesn't exist (if channelarray is an Array)
A callback is triggered "later". In the callback where you query from your database, the new stuff you set would have not been set in time. So, in reality, you're trying to split undefined. You could move your code within the callback, use promises or set default values.
@sudden geyser thanks, I put all the code inside and it already works
good work
How could I use Carl bot reaction role to work with my embedded message?
Ask in the bot support server; not this one.
@sudden geyser what’s the link

Either wrong env var or you didn't install dblpy
what is a dbltoken
Your bot's token generated by DBL for authentication use on https://top.gg/
how wud i get it
or on your bot's Edit page
so the api key @slender thistle
Yes
Did you read the example
what example
Specifically https://github.com/DiscordBotList/DBL-Python-Library
A simple API wrapper for discordbots.org written in Python - DiscordBotList/DBL-Python-Library
Well did you provide your Client/Bot instance to the DBLClient
under argument bot
i am so cunfused
You need to pass a botkwarg to DBLClient
the value of that kwarg must be either your Bot/Client
What's the difference between them
Is bottoken your bot's Discord token
DBL and Discord tokens are different
ik i put the api key i whar it ses dbl and discord whar it ses bot
Where are you trying to create DBLClient
in the code
Do you have bot variable accessible at the time of creating an instance of DBLClient
is the dblclient the api key
What
bottoken = "bottoken"
bot = DBLClient(token=dbltoken)
bot = discord.Client()
@bot.event
async def on_guild_join(server):
await client.post_stats(jsonObject={
"server_count": len(bot.servers)
})
@bot.event
async def on_guild_leave(server):
await client.post_stats(jsonObject={
"server_count": len(bot.servers)
})```
that is what i have
Why are you naming your discord.Client a bot and DBlClient a client
Why are you using bot.servers
Why are you accessing a variable that does not yet exist (DBlClient needs a bot, you are only declaring it one line below)
bottoken = "bottoken"
bot = DBLClient(token=dbltoken)
bot = discord.Client()
@bot.event
async def on_guild_join(server):
await client.post_stats(jsonObject={
"server_count": len(bot.servers)
})
@bot.event
async def on_guild_leave(server):
await client.post_stats(jsonObject={
"server_count": len(bot.servers)
})```
so that
Do you know how variables work in Python
no
Welp
You won't get far at this rate
Do you mind looking at your code and telling me how you would use DBLClient and discord.Client at the same time
without them interfering with each other
what shivu is trying to say is, append bot in the DBLClient's constructor
i.e bot=bot
I don't know how to make myself clear without literally spoonfeeding
so it is not bot.event
that's not were talking about...
What do you think I meant by DBLClient arguments
so it is bot.bot
?????
idk
Do you know what function arguments are
yes i am sorry i am done with this i am so tirerd
What are possible reasons my bot is not registering any new commands I make?
How would I make it, so a bot would change the nickname of everyone except bot users
Check if your user object in whatever language or library has a property that tells if the user's a bot or not.
for example: Discord.js can be found with <User>.bot
@ember atlas, could you explain how you're registering them and what language/library?
ok
@earnest phoenix filter them out
how
Np
did you read faq
@earnest phoenix it says ask for additional help. not to start here
oh
so I own a rasberry pi 2, anyone know of some cool things I can do on it? Related to games, bots etc
I don't have the slightest idea
👏 pi 👏 hole 👏
what does that even mean
Does anyone know how to make my bot stay online 24/7
@raw kayak did you read #502193464054644737?
leave prompt open
@formal vine https://pi-hole.net/
Ph sorry
I kinda read what it said but can you explain exactly what it is
lmfao
i'm confused
hello
i have a problem
the token of the first application was enterd
and i want to change the bot by the new bot
@modest maple iwant them to change the id of the bot
Would anyone be able to assist me with a code that adds up the amount of times that someone has typed in a command, and then they are able to see and use that information themselves.
@merry tundra your Bot ID would change with your new bot application
If you want to add a new bot to DBL / change the bot to a different one you'll need to go back through the approval process
@normal epoch
This user has no bots
@earnest phoenix wich libary do u using?
Whats wrong with my configuration?
port: 2333
address: 0.0.0.0
lavalink:
server:
password: "secret"
sources:
youtube: true
bandcamp: true
soundcloud: true
twitch: true
vimeo: true
mixer: true
http: true
local: false
bufferDurationMs: 400
youtubePlaylistLoadLimit: 1000 # Number of pages at 100 each
youtubeSearchEnabled: true
soundcloudSearchEnabled: true
gc-warnings: true
metrics:
prometheus:
enabled: false
endpoint: /metrics
sentry:
dsn: ""
# tags:
# some_key: some_value
# another_key: another_value
logging:
file:
max-history: 30
max-size: 1GB
path: ./logs/
level:
root: INFO
lavalink: INFO```
my (vps) os is linux
it doesnt give any errors, it just dont play it
(lavalink related)
(and yes the jar is running on the vps as a sudo, i tried it without sudo too but same result)
The console should always report errors for lavalink
I dont get any errors but i do get warnings :
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (jar:file:/home/ubuntu/LavalinkFolder/Lavalink.jar!/BOOT-INF/lib/spring-core-5.0.6.RELEASE.jar!/) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release```
see if there are any newer lavalink builds
this is the most recent build https://ci.fredboat.com/viewLog.html?buildId=7536&buildTypeId=Lavalink_Build&tab=artifacts
try to use that
Has someone a idea how to implement Spotify to a JS music Bot?
yeah soundcloud is allowed
go to DBL
go to edit on your bot
copy the Url in Markdown
and change SVG to PNG
ok thanks 
ok i did
gg
Would discord.js or discord.py be better for bot dev? I currently use discord.py because I know python but I was wondering if there would be any advantage to using discord.js
nope
ur better off using a programming language you are experienced with
rather than switching to a language you dont know well
any performance benefits of using one over the other?
not really
Is one updated more than the other?
nope
Ok thanks so much!
np
mfw
node is good for real time apps and that includes discord bots
but if you're already good at python
¯\_(ツ)_/¯
both python and node are bloated interpreters, so they are equally okay-ish (not good not bad)
which in modern day computing is not a big deal anyway
anyone here has experience with vert.x and/or es4x?
if I were going to change my bots status, what folder should I put the code in.
the actual folder where all of the command code and stuff is in or what
file*
yes
thanks
@formal vine uh probably your ready event
guys my glitch disk space finishing so fast what's i need do?
its not the code
its the package problem
discord.js
just client.user.setPresence() is getting problem
because i use glitch
@earnest phoenix wdym
@manic light if u use sqlite db on glitch it fills up pretty fast please move it to vps or somewhere if u wnat to save your bot
SuperHero when i have this comamnd in index.js client.user.setPresence() it says cannot read user of undefined
i m using json and yes i need to use vps but im scared about lost my data
and glitch have rewind
jsons are not stable
i have so many users
@earnest phoenix d.js version? your client name (like const bot = new Discord.Client())?
you cant but u need to or ur json files will rip always
or just make like users/userid.json
ez fix
xd
XD
discord.js: 11.5.1
const client = new Discord.Client()
Where you are doing this? on external file or main file?
attachments using disk space from glitch ?
index.js
is it ur main file
yes
im using background for profiles .s
and it is on client.once('ready', () => {
//here?
})
client.user.setActivity('Hello', {type: 1}) //1 listening, 2 watching, 0 playing, 3 streaming if i remeber right
client.user.setStatus('idle')
make it to
i dont use that
client.once('ready', () => {}
use it it will fix it
if this doesnt fix it
client.once('ready', () => {}
you dont need to declare client again if yits on main file and ready event doesnt have message property
make it to that what i send.
Ready event is:
client.on(ce)("ready", () => {})
Message event is:
client.on("message", async message => {})
oh
so why the console.log(Mudando o status para: ${presence + " " + mudador.name}...) works normal?
??
look at the screenshot
theres a console.log
saying what presence my bot will put
why is this works normal
Ahhh
make it like let statuses = [
"playing",
"other playing"
]
let games = [
"game",
"other game"
]
status
is ur ready event still this client.on('ready', (client, message) => {})??
becuase i need client to modify the presence
delete client and message there firstly....
If its main file YOU DO NOT need to redeclare CLIENT
bruv
client.on("message") is on main file
🤦♂️
Ready event is:
client.on("ready", () => {})
Message event is:
client.on("message", async message => {})
Make those into THESE
done
now it should work then
worked!
const emoteargs = args.join(' ')
if (!emoteargs) return message.channel.send('Provide an emote!')
const emote = client.emojis.get(emoteargs) || client.emojis.get(e => e.name.toLowerCase().startsWith(emoteargs.toLowerCase()))
if (!emote) return message.channel.send('Invalid Emoji!')
Anyone know what is wrong with this? For some reason, it shows invalid emoji when I try the emoji name, and works fine with ID
if (!emoteargs) return message.channel.send('Provide an emote!')
const emote = client.emojis.get(emoteargs) ||client.emojis.get(emoteargs).id || client.emojis.get(e => e.name.toLowerCase().startsWith(emoteargs.toLowerCase()))
if (!emote) return message.channel.send('Invalid Emoji!')
@ember atlas
ya same thing
?
client.emojis.get(id) || client.emojis.find(e => e.name === name)
mfw spoonfeed
does anyone know a linter that will pick this up
(async()=>{
console.log("Hang starts");
await new Promise((resolve)=>{
// Linter error here for no resolve
})
console.log("Promise drops")
})()
as far as ive found eslint nor jshint have it
*for vs code
Do you have eslint configured to check for functions not returning anything (I think it's a rule)
so would need the style of return resolve("idk") with that rule?
can someone trouble shoot this https://gyazo.com/1c1b9653dcc4ede2ae4a210d54e0df5d primarily around line 141
whats with line 141?
everything was working before I added that link Chevron
you have unclosed () somewhere
line**
ha right didnt check the right side sorry sec
I have no idea where though lol
we dont either without the full code lol
copy your code, paste it into the left side of
it will auto format on the right side when its working
until then you should see your error
It says 153:1 is that the ink I should be lookigng at or what
line*
idk why I can't type line
can you screenshot the browser tab?
@sudden geyser https://discordapp.com/channels/264445053596991498/272764566411149314/650090298126368778
is that what you mean?
@formal vine tbh too much that we cant see there, can you create a pastebin?
with the code in it?
hatebin
if its possible
id have this fixed in vscode in no time
or a repo link if its on github
Sure, doing it now
So I pasted it in and pressed save, and now what lol I don't see a copy link option
link changes in the addreess bar
oh
seems broken atm
Yea I think it is
you have one } too much after your client.user.setActivity('with your head', { type: 'PLAYING', url: 'https://www.youtube.com/hierogg', });
^
Fixed it! Thanks lol, I'm confused though, that was working just fine before lol
that part*
Wait now when I try and run it in cmd it doesn't say error or anything., It just doesn't go online
just saying: You shouldn't update your bot's status for every sent message
am I doing that? I legitimatley don't know
is it in the .on('message') or .on('ready')
where that line of code to edit the presence is at
Hypothetically, would you make fun of me if I had no clue what that meant?
Phew, well I have no clue what that means.
what I'm saying is:
where is you are editing the bot's presence at
like which event are you emitting from
i.e ready or message
message i believe
^
do it under ready
move that to the ready event
Okay, I think I have it fixed. But the reason it's messing up is because I'm trying to add a third command. I just need to write code like the whole !ping pong thing Except obviously replace the !ping with my own command and ping with my own response.
How do I submit my bot into the website?
-faq 1 @earnest phoenix
@earnest phoenix
For some reason my bot is crashing without leaving any sort of crash log.
Are there specific issues that can cause a bot to crash without leaving a crash log?
How do I handle them properly?
I'm used to getting crash logs and appropriately fixing the bug after knowing what's going on. I don't know what's changed to cause a lack of logs.
i dont know
What does that mean
Ok
learn js before trying to make a bot
My issue was I was using console.error(); instead of console.error;.
so something like bot.on("error", console.error())?
More like whenever a message was sent I had .catch(console.error());.
It never caused any issues until now because none of the things that used it caused crashes.
can you override a previously sent embed with a regular string response, removing the embed, whilst editing?
yes
??
simply overwriting it with sentMsg.edit('foo') doesnt remove the embed
well yes
you are editing the content
not the embed
refer to the docs
the edit method takes in an options object
the docs dont mention deleting an embed by overwriting it with text
wew, one way to be a dick
????
if it was common sense, i wouldnt ask
if you have a drawing and want to write text without the drawing on the same paper you would have to erase the drawing first, no? (assuming you can't flip the paper)
that is, my guy, common sense
and you could just as easily looked at the docs
how so, again, the docs dont mention it, I started using discordjs less than 5 hrs ago 🤷
that's why i told you to use common sense
not every single use case has to be documented
i told you to see the docs to see what the edit method takes
aka to see what the options object offers
optional
d.js is literally oop but ok
Every time I try putting a code in so my bot has a status the code has an error
what is the error and what lib are you using
TypeError: Cannot read property 'setStatus' of null
at /home/runner/index.js:28:14
at Script.runInContext (vm.js:133:20)
at Object.<anonymous> (/run_dir/interp.js:156:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)Server started
Thats what it says
what's your code
upload at https://paste.mod.gg or some other non blinding text service
could honestly just get the snippit where it's running
hard to read on mobile
ah i see
it also reduces the clutter in chat ig
Would you like me to dm the link?
I would put it inside the ready event
^
ensures user is actually there
the client is not really populated until ready is fired
what do you mean
inside the ready event
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});```
Ok
is there a way to check when all shards have spawned?
manager.spawn().then(code) executes code after the first shard has spawned
Isn't somthing like on_shard_ready()
throw err;
^
Error: Cannot find module 'express'
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)
Jump Toat Object.<anonymous> (/app/server.js:6:15)
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)
hi my hastebin I get this error in the log of my site. the site is not running because of this error. I don't know how to fix this problem please help!
no, I already loaded the express module into the file.
did you install the dependencies
can you help me if I throw you the file, please?
I am literally telling you the solution
I don't know, so I don't know how to do it.
yes, I installed the express module there.
If yes, use the command npm install if not, use the command npm install express. If you are hosting your bot in glitch, use the command enable-pnpm
it's not a bot, it's a hastebin site, it's an html project.
Ok
Tim how do you know so much
It feels like you know the answer to literally every question lmao

Im good at insta-googling
I see you’ve mastered the art of google-fu
@quartz kindle dude, I'm sorry I couldn't do it. please come and do it.

😢
I couldn't try.I couldn't. I'm a failure.
No @quartz kindle
hey guys how shall i make a rich embed
i had forgot cause i had left coding for few moths
Discord.js v11.5.1: new Discord.RichEmbed().setColor('#something')...
Discord.js v12: new Discord.MessageEmbed().setColor('#something')...
@earnest phoenix are you using discord.js
if(message.content === prefix + 'help') {
const embed = new RichEmbed()
.setTitle('**Voici la liste de mes commandes**')
.setAuthor('Vitas®', 'https://i.imgur.com/pNldz9u.jpg')
.setColor('#679ec5')
.setDescription('**Mon Préfix est `!7`**')
.addField('**Commande de modération**', '`ban` `kick`')
.addField('**Commande utilitaire**', '`ping` `info` `serverinfo`')
.addField('**Commande Fun**', '`caresse`')
message.channel.send(embed);
}
});```
@earnest phoenix
thanks man
But u can put a lot of features
Here is the main guide
yes shouldve posted that first
Yep sorry ^^'
For making an embed you have to put .setColorand .setTitle at least
i dont get why people need rich embeds when you can just use the embed message arg
i guess its easier
.addField('title' , 'description')
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

ı was ıu uub
Maybe less useful when simply using the discord.js one, but I made my own class for embeds (as eris doesn't have any) which I consider quite useful because it allows me to set defaults and such
If you're simply creating a "raw" embed object each time, it would be less flexible
ReferenceError: MessageEmbed is not defined
at Client.client.on.message (C:\Users\mythri.sathyan\Desktop\ra\folder\my bots\apptest\bot.js:30:21)
at Client.emit (events.js:203:15)
at MessageCreateHandler.handle (C:\Users\mythri.sathyan\Desktop\ra\folder\my bots\apptest\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\mythri.sathyan\Desktop\ra\folder\my bots\apptest\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (C:\Users\mythri.sathyan\Desktop\ra\folder\my bots\apptest\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\mythri.sathyan\Desktop\ra\folder\my bots\apptest\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users********\Desktop\ra\folder\my bots\apptest\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:198:13)
at Receiver.receiverOnMessage (C:\Users******\Desktop\ra\folder\my bots\apptest\node_modules\ws\lib\websocket.js:789:20)
at Receiver.emit (events.js:198:13)
why does it show me this error
d
because the embed is not defined
legit when you get an error read the first line
f
i did
._.
just found it out
i hadnt created the embed variable
error continues so i decided to delete everything madman
Why this wont work? js const dbl = require('dblapi.js'); dbl.getVotes().then(votes => { if (votes.find(vote => vote.id == message.author.id)) message.channel.send('You have been voten!'); else message.channel.send('What? You have not voted me today, pleas evote here: https://top.gg/bot/.'); });
error: TypeError: dbl.getVotes is not a function
oh yeah lets move into api
who can send me "server stats" code please i so need :'|
@restive furnace #topgg-api
like what, I could not understand
Explain me what .py classes do and why is one used here
v
please
@earnest phoenix what did you make your bot with?
did you actually code any of that urself
learn how to use JS
this so hard
i use ready command
Makes no sense to my poopy head
well you should've familiarized yourself with js before trying to make a whole project in the language
^
not just C+P code
as for @earnest phoenix watch some tutorials about classes and the basics of python
):
But, i, learnt, them with sites
you clearly dont know the basics if you dont know what a class is
Where is W3 schools site
what
who can help me ?
LEARN JS THEN COME BACK TO US
weve told you this already]
you have no idea what your code is doing cuz its just copy and pasted
and we're not gonna spoon feed you
i don't have free time
or baby sit your through learning the basics os JS
then don't make a bot lmao, you must not have time to make a bot too
i don't have free time
Ohh so classes redirect you to stuff or what
functions and classes are used to break up code and so it can be called again
makes no sense to me
say we have a function called find(User)
we use it as a function / subrutine
because we need it lots of time in the main code
and to save us writing out the same code
over and over again
we just call the subrutine again
can't i like assign the name and age on 2 variables
what
or add
your missing the point
Python - Functions - A function is a block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and
user1 = ['Ralph', '15']
print('Hi my name is, ' + user1[0] + " and i'm " + user1[1] + ' years of age!')```
you are completly missing the point
iuhhhhhhhhhh
its not about making stuff into one string etc...
like i said
read up on the basics
I'm so dumb
and watch tutorials
welcome to the basics of every programming language ever
Welcome to headache
its rlly not that bad
watch all of them
Screams in agony
You don't learn programming by taking 5 minutes to read what X lang can do
^
i mean he was warned
to learn the basics
and then got told what the 'basics' included
like OOP
ok, quick question
i made my bot in a way that it searches inside a folder for .js files, how do i make my bot search for both .js files in that folder and .js files inside another folder on the same directory as the same files?
ex
|__command1.js
|__command2.js
|__music
|____play.js
|____stop.js```
thanks
that's why python is better for beginners

How i can make this working const attachment = new Discord.MessageAttachment('../test.png'); its giving cannot read id of undefined on that line.
(it saves on local: but dont send it)
which version of d.js are you using
11.5.1
then you have to use Attachment
MessageAttachment is for entities returned from the api
kk
https://gist.github.com/SinistreCyborg/d742485d364d4c0bae534e660c6fdc1c (node:11200) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 messageCreate listeners added to [CustomClient]. Use emitter.setMaxListeners() to increase limit
Lmfao
Why do I have 11 listeners?
I remove them in my code
but apparently they don't get removed
Look at <Client>._events and see what you're listening to.
Client._events: [Object: null prototype] { debug: [Function (anonymous)], error: [Function (anonymous)], guildBanAdd: [Function (anonymous)], guildBanRemove: [Function (anonymous)], guildCreate: [Function (anonymous)], guildMemberAdd: [Function (anonymous)], guildMemberRemove: [Function (anonymous)], messageCreate: [Array], messageDelete: [Function (anonymous)], messageDeleteBulk: [Function (anonymous)], messageUpdate: [Function (anonymous)], ready: [Function (anonymous)], warn: [Function (anonymous)] }
For example, I'm pretty sure this will create two separate instances so it won't be able to remove it: this.client.removeListener("messageCreate", e => this.listener(e));
Client._events.messageCreate: [ [Function (anonymous)], [Function (anonymous)], [Function (anonymous)], [Function (anonymous)], [Function (anonymous)], [Function (anonymous)], [Function (anonymous)], [Function (anonymous)], [Function (anonymous)], [Function (anonymous)], [Function (anonymous)], warned: true ]
oh
what can i do to make them the same function
You could do a dummy like this.fn = (e) => {...} and do this.removeListener("messageCreate", this.fn) and it should be able to work.
but that's my guess from running into this same issue before
Do u guys know how some ppl have just a plain .eslintrc file? no .js, no .json, just .eslintrc... how does that work?
Its eslinter config file
hello i'm brazilian wanted to know how to make a discord bot
If i wanted to check in a guild member add event if a certain member joined a circle guild to add a role how would i do that?
@slender thistle is sending files with D.py still send_file or did they change it in rewrite?
ty ty
i need server stats code
this isnt the place to be spoonfed code
@earnest phoenix we cannot and will not spoonfeed you code for "server stats," asking again will result in a mute
client.on('guildMemberAdd', member => {
let channel = message.guild.channels.find(channel => channel.name === "welcome");
let memberavatar = member.user.avatarURL
if (!channel) return;
const embed = new Discord.RichEmbed()
.setColor('#00ffff')
.setThumbnail(memberavatar)
.addField('\:wave: / Welcome!', `${member}`)
.addField('\:fox: / Here you go. A role for your stay', `New`)
.setFooter(`Message sent by Aang`)
.setTimestamp()
channel.sendEmbed(embed);
var role = member.guild.find(role => role.name == 'New');
member.addRole(role)
});
For some reason this code won't work. I have a friend join the server while the bot is online and has the right perms and role hierarchy. and it does nothing..no Error in console log, no message being sent to the welcome channel and no role being given to the new member. I am pulling my hair out trying to get this to work.
any help?
seems like role and channel are undefined and can't be found by cache
how would I go about fixing that?
I have, same thing.
get will return undefined if it's not in the cache
I think the channel and/or role isn't being added by the cache for some reason
I don't get undefined errors is the thing
seems like role and channel are undefined and can't be found by cache
roles and channels will always be cached
learn how to debug
step through your code and see where it stops working
well they are trying to use a message object to find a channel but there is no message param in that event
https://hastebin.com/qecuvahoji.js
I use this and it works fine but I get console errors
That's not even his issue
@jaunty stump You're using message in a guildMemberAdd event
they changed that, see the link above
here the errors that I get with the code in the link I posted
(node:16660) DeprecationWarning: Collection#find: pass a function instead
(node:16660) DeprecationWarning: TextChannel#sendEmbed: use TextChannel#send instead
(node:16660) DeprecationWarning: Collection#find: pass a function instead
So I used the other stuff in the original code I posted
also that's a warning not an error
^
back to the code I posted earlier that doesn't throw that shit at me in console log.
It still doesn't want to work no matter how much I "Fix" it
you got told two times what the issue is
Sorry, I didn't see it with you and your corrections to the way I say things. I will look back through the chat to try and find it again
const spawn = require('child_process').spawn
let child = spawn(msg.content.split(" ").slice(1).join(" ")) // Spawn <command>
child.stdout.on('data', function(c) {
msg.channel.send(c)
})
child.stderr.on( 'data', data => {
msg.channel.send('ERR: ' + data);
})```
So I have this code above where if the user types `>sh <command>` it executes the command. However, I am having some issues. For any command, Windows, and Linux, I always get the issue of `spawn <command> ENOENT`. Anyone have some advice?
client.on('guildMemberAdd', member => {
let channel = member.guild.channels.find(channel => channel.name === "welcome");
let memberavatar = member.user.avatarURL
if (!channel) return;
const embed = new Discord.RichEmbed()
.setColor('#00ffff')
.setThumbnail(memberavatar)
.addField('\:wave: / Welcome!', `${member}`)
.addField('\:fox: / Here you go. A role for your stay', `New`)
.setFooter(`Message sent by Aang`)
.setTimestamp()
channel.sendEmbed(embed);
var role = member.guild.find(role => role.name == 'New');
member.addRole(role)
});
changed the code and still nothing
console.log("GOT HERE ${maybe some value here idk}")
lol
i mean writing to console does it
but it's just not as effective when compared to actual debugging tools like breakpoints, inspecting a variable etc
if im being honest ive never actually used a real debugger
I give up with asking for help here
All I wanted was a fix and and not told next to meaningless stuff.
I am not an "Expert" and know everything. maybe some code written for me to look at and learn would have helped but nope. I get told things I don't even quite understand or how to implement
Sorry for asking
You can't expect people to spoonfeed either
guys i'm making a music bot and it's all good on it but there's a problem , when i left click on it and click disconnect , it keep working but not in the channel
is there's an event for the disconnect ?
your issue is that you expect to be spoonfed and make other people think for you, instead of us doing that we encourage you to use your own brain and learn how to do research for yourself and debug for yourself, @jaunty stump
@rocky rover in which library
discord.js
what doesn't work
the point is , when i type /leave it leaves and clears the queue
but when i disconnect it manually
it leaves but doesn't join untill the queue ends
that's a problem with your code
Can you show me an example?
it's literally just an event subscription
on("disconnect", func)
try listening to the error event aswell
some libraries error out instead of firing the disconnect event
@jaunty stump well here's some things you might want to put into consideration in your code:
- User#avatarURL can be undefined meaning if the person has no set avatar if will returned undefined, it shouldn't effect much but it's something to account for (to fix this refer to User#defaultAvatarURL)
- Channel#sendEmbed is deprecated as the warnings said, Channel#send(embed) should work fine
- role can be undefined, check if it exists first, also
role.name == 'New'is case sensitive
also you gave little details of what isn't working
like is not adding the role? or does it not even send the embed? you have to tell us these things
So have any of you ever had a command for executing shell code or something?
used to but they're dangerous running under root
typically they aren't needed unless you need some basic info or something of the sort
ive considered having a shell mode in my current bot but im not sure
Well I need it because my ISP blocks port forwarding so I cant ssh into my pc when I am not home to access pm2 and stuff
so I at least want to check on pm2
yikes
it just seems like a useless feature
eh
Any reason why this mute command does not work?
https://hastebin.com/danuyujuwo
The only part that works is the invalid member/no member, everything else does nothing without error
const modrole = db.fetch(modrole_${message.guild.id}); if (!message.member.roles.has(modrole)) return;
Maybe try logging to see if this is true? It could really be anything after your three mod checks.
like console log it to see what?
Wait i think i found out the issue
Never set a mod role in the db
that's what I was thinking
But you should alert the user if a mod role has not been set up or use normal permission checks.
I'm assuming this issue is due to my bot being sharded (cant leave it as 1 shard due to it having more than 2k guilds), but for some reason, when the bot tries reacting with a custom emote on shard 2, it says its unknown, though on shard 0, it doesn't say that. What confuses me though is that it shows the custom emote on the embed. Is there any way to fix this issue?
yes that would make sense
thank you
i dont like it
what is melting my brain right now is that it shows the custom emote in the embed
if it shows it, just catch the error and say nah we dont need that 
thats what im doing
i replaced it with something else
im assuming then theres no way to react with a custom emote thats on another shard
unless i create guilds on each shard with the same custom emote
Every so often I keep getting this error
(node:17388) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null at module.exprts (C:\Users\Aidyj418\desktop\boss-bot\boss-bot-v2\events\client\message.js:5:53) and I am really not sure why... here is the code:
const db = require('quick.db');
module.exports = async (client, message) => {
let prefix = await db.fetch(`prefix_${message.guild.id}`)
if(!prefix) prefix = '!'
if (message.author.bot) return;
if (!message.guild) return;
if (!message.content.startsWith(prefix)) return;
if (!message.member) message.member = await message.guild.fetchMember(message);
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const cmd = args.shift().toLowerCase();
if (cmd.length === 0) return;
let command = client.commands.get(cmd);
if(!command) command = client.commands.get(client.aliases.get(cmd));
if (command)
command.run(client, message, args)
};
I'm not gonna look at the code, but I'm just gonna guess you allow messages from dms
dms dont have a guild property
something like message.guild.id wouldnt work in a dm
i dont allow messages from dms.
this line is for that: if (!message.guild) return;
and the error happens at ```let prefix = await db.fetch(prefix_${message.guild.id})
has always worked until i seperated my events today
I'm telling you what the error is telling you ¯_(ツ)_/¯
yes
or you could just move the code where you fetch and replace the prefix below your check for the guild.
Is it possible to host my Bot using my IP?
as in hosting a bot on your computer? yes
uhm
What would the verbal name of a bot like be
what
The verbal name of a bot I have no idea what that is
the fuck
varialbe name
idk make it anything u want
Ok thx
mine is just the bot name xd
All right I have someone that's saying that you just don't make that stuff up
that's fun until you change the bot name
That you're supposed to get it from somewhere
are we talking about variables
Yes
like are you talking about in your source code or something else
bot = discord.Client()
@bot.event
async def on_guild_join(server):
await client.post_stats(jsonObject={
"server_count": len(bot.guilds)
})
@bot.event
async def on_guild_leave(server):
await client.post_stats(jsonObject={
"server_count": len(bot.guilds)
})```
that
as long as you refer to your discord client as whatever you call the variable it doesnt matter
I was told that the variables name goes somewhere in the first line
So I like I get it goes in the first line but I have no idea where and so I can just put anything
do you know programming basics
if so the concept of a variable and its name shouldnt be so foreign to you
Yes I'm just confused cuz other people are trying to help me and they confuse me so much that I have no idea what I need to do to fix the code now
well what is the problem with the code
I'm still missing the second requirement
And so I was told I needed the viriable name
That that was causing the problem
first argument has to be your discord client object
you are copying and pasting code without thinking about it arent you
no I am thinking about it but my friend that told me that this worked said it would work that you just go ahead and put it in
is there a faster alternative to ytdl-core
i'm getting an issue that tells me that the stream isn't generating quickly enough although I have a fairly good download/upload speed
Use lavalink
lavalink is just bloat lol
srs?
way too heavy
it's java so it hogs ram and has bad garbage collector so it only keeps on growing in ram usage
christ
so should I not use it? if it has no bad gc then I fear that it'll suck up all of my 8gb
Its still better than ytdl no?
if it's as bad as you say it is, over time I'd need to restart my bot, no?
Anything java should be better than an equal js/node implementation
not necessarily, but generally yes assuming it's structured well
if i'm understanding what you're saying
Yeah but afaik lavalink is actually a stream player server sort of thing, its completely different from ytdl
i haven't personally benchmarked any of node.js streaming libs so i wouldn't know
i just know that lavalink is incredibly slow
and i've only had bad experience with it
so, what do you recommend?
Ive heard lots of people praising it lul, but ive never used it
I doubt I want to continue using ytdl-core if it keeps posing these kinds of problems because of a reason that I can't control
lavaplayer is still good but lavalink just fucks the implementation up and ruins the point of lavaplayer
oh boy; another question
whenever I try to install "ref", rather, anything that includes building via node-gyp (i presume), it always fails with error code 1, reinstalled visual studio 2017, installed windows build tools via npm and all that, no idea what to do now
I have gone through everything I can find to figure out how to fix this but I still can't figure it out
Is anyone here good with both JS and Golang? If so, would you say that "image" (official go package) is similar to the Web's Canvas API or no?
i currently have an image manipulation api written with express and node-canvas that I'd like to re-write in go
Can I use javascripts .replace method to replace multiple things?
well how can i store variables for say a welcome message then?
you can just run a loop to replace stuff
Can I get some help with the error above
Yeah I know it's just the fact I cannot figure it out yeah I got that I'm missing a part of it except I can't figure out the exact what I'm missing and where It needs to go in that line
No I'm sorry I know where it goes in the line I just can't figure out the part I'm missing
Yeah I know it says bot but like what about it
It's cool
Yeah I'm just like confused on what it actually is because I've been doing my research for about 2 hours now and I can't like actually figure it out
Ik but what is that
Oh wait
Read that wrong
My apologies
It's what you defined as your bot
I don;t know what you called it though, probably bot
Yeah I defined everything as bot
bottoken = "token"
client = DBLClient(token=dbltoken)
bot = discord.Client()
@bot.event
async def on_guild_join(server):
await client.post_stats(jsonObject={
"server_count": len(bot.guilds)
})
@bot.event
async def on_guild_leave(server):
await client.post_stats(jsonObject={
"server_count": len(bot.guilds)
})```
Do you know how to pass an argument in a method?
No
That's what I thought so it just put the word bot in between it
Mhm
Yep that's like what like half the people said
Then why didn't you listen to them
That's what I said yeah
So I just take out all the other stuff in it and put in bot
That's not it... 🤦
The error is with the init mehtod
So you want to put the parameter in that method
Where is that file
What's the code for that
Wait
Oh wow
The error is most likely with the DBLClient since you forgot to pass an argument
Probably
Just pass bot=bot with the token there
That confuses me like where do I put it in the ()
Before the DBL token
yes