#development
1 messages · Page 1332 of 1
@viral veldt Thank you
@agile lance try to use,<client>.guilds.channels.cache.get("ID")
if (args[0] == "catch" && args[1] == `${pkmn}`) {
try {
message.channel.send("You have caught a "+pkmn)
console.log(counter+" yeet")
counter = 0;
}
catch (err) {
console.log("error")
}
}
@vale garden Counter was defined AFTER the logging thats why.
@agile lance try to use,
<client>.guilds.channels.cache.get("ID")
@viral veldt Alright, <client> is replaced with how I use my client class right?
yes
yea but it has a value before anyways
and defining it before didnt make any difference
yea but it has a value before anyways
@vale garden Try what I put
kk
if (args[0] == "catch" && args[1] == `${pkmn}`) {
try {
message.channel.send("You have caught a "+pkmn)
counter=0;
console.log(counter+" yeet")
}
.catch (err) {
console.log(err)
}
}
Oh I see an issue
if (args[0] == "catch" && args[1] == `${pkmn}`) {
try {
message.channel.send("You have caught a "+pkmn)
counter=0;
console.log(counter+" yeet")
}
.catch(err=> {
console.log(err)
})
}
what
You just did catch (err) =>
ahh yes
Typically that doesn’t work for me, I do .catch(err => { code here
wdym
.catch(err => console.log(err))
kk
.catch(err => console.log(err))
@viral veldt Thats about the only d.js thing i was taught at first
if (args[0] == "catch" && args[1] == `${pkmn}`) {
message.channel.send("You have caught a "+pkmn)
counter=0;
console.log(counter+" yeet")
.catch(err => console.log(err))
}
even after this
nothing
yea catch the error first
hmm
if (args[0] == "catch" && args[1] == `${pkmn}`) {
message.channel.send("You have caught a "+pkmn)
counter=0;
console.log(counter+" yeet")
.catch(err => console.log(err))
}
Do you have args defined?
if (message.content.includes("!")) {
!catch ?
if(message.content.startsWith(“!catch”) {
if(!args[0]) return message.reply(“Provide the pokemon!”)
if (args[0] == `${pkmn}`) {
message.channel.send("You have caught a "+pkmn)
counter=0;
console.log(counter+" yeet")
.catch(err => console.log(err))
}
}
That could work
Try that @vale garden
if (message.content.includes("!")) {
!catch ?
@viral veldt the error maybe from this
if(message.content.startsWith(“!catch”) {
if(!args[0]) return message.reply(“Provide the pokemon!”)
if(!args[0] == pkmn) return message.reply(“This is incorrect!”)
if (args[0] == `${pkmn}`) {
message.channel.send("You have caught a "+pkmn)
counter=0;
console.log(counter+" yeet")
.catch(err => console.log(err))
}
}
Try that
It checks if the message starts with !catch
Then proceeds to checks for the argument
If it fails to find it returns a error message saying it can’t find it
kk
If it finds it but it’s the wrong pokemon, It says its the wrong pokemon
If it finds it and its the right pokemon, It sends the message displaying it was the correct pokemon
How is the pkmn defined?
let pkmnsList = [["Weedle", "https://bit.ly/3nX5gVk"], ["Kakuna", "https://bit.ly/2T0vzf9"], ["Beedrill", "https://bit.ly/3dAhUoi"], ["Pidgey", "https://bit.ly/3lXgbN2"], ["Pidegotto", "https://bit.ly/2H7689i"], ["Pidgeot", "https://bit.ly/2HbfgK7"], ["Scyther", "https://bit.ly/3k6lxFe"], ["Rhyhorn", "https://bit.ly/31xNG0L"], ["Rhydon", "https://bit.ly/3o3hvQ7"], ["Rhyperior", "https://bit.ly/3nZISum"], ["Horsea", "https://bit.ly/3nZITyq"], ["Seadra", "https://bit.ly/346t3dy"], ["Kingdra", "https://bit.ly/2HhEAxS"]]
let no = Math.floor(Math.random() * pkmnsList.length)
let pkmnsImg = pkmnsList.map(item => item[1])
let pkmns = pkmnsList.map(item => item[0])
let pkmn = pkmns[no]
let pkmnImg = pkmnsImg[no]
heres everything
Maybe pkmn isn’t spawned?
try {
if (args[0] == "!catch") {
if (!args[1]) return
if (args[1] == `${pkmn}`) {
message.channel.send("You have caught a "+pkmn)
counter=0;
console.log(counter+" yeet")
} else {
if (args[1] != `${pkmn}`) {
message.channel.send("Wrong pokemon")
}
}
} catch (e) {
console.error(e)
}```
@vale garden try this
kk
mmm 🥄
ok so now
when i do that
it just spawns in a new pokemon
after me doing the command
const discord = require('discord.js')
const client = new discord.Client()
client.on('message', message =>{
const guild = message.guild;
const joinChannel = guild.channels.get("767258761038790656")
})
client.on("guildMemberAdd", async member => {
await joinChannel.send("welcome to the server, " + member + "!")
return;
})
const filePath = require(“./token.txt”)
client.login(filePath.token)
It says “guild.channels.get is not a function”, Help please
and if the args are wrong, it gives the wrong pokemon message and then spawns in a new poke
@agile lance read the docs
@agile lance use fetch and get is inside cache prop
@agile lance use fetch and get is inside cache prop
@restive furnace so instead of “get” use “fetch” and add .cache before .channels?
Test
if you use fetch don't add .cache after .channels
but if you use get, add .cache after .channels
Ohh okay, Thanks
np
it says joinChannel isn’t defined?
const discord = require('discord.js')
const client = new discord.Client()
client.on('message', message =>{
const guild = message.guild;
const joinChannel = guild.channels.get("767258761038790656")
})
client.on("guildMemberAdd", async member => {
await joinChannel.send("welcome to the server, " + member + "!")
return;
})
const filePath = require(“./token.txt”)
client.login(filePath.token)
I defined it here
Could I call it from a global.joinChannel?
read the docs
@trim saddle I have, Nothing worked
defining code in one event call back doesn't apply it globally
So should I use a global.joinchannel then?
Hey, just a question on stats, how many servers on average do I need to like start getting premium subscriptions?
no, using let outside of any functions works
Okay
@drifting wedge uh that's up to you
Hey, just a question on stats, how many servers on average do I need to like start getting premium subscriptions?
@drifting wedge Idk. I only have 1 premium user for mine and mine has 12k users and 59 servers
when you feel you've built a sufficient userbase and feel a need to expand then you start premium features
No not that
@agile lance learn scopes
Like how big, until ppl start paying?
@agile lance how much does the one person pay?
1 million ¯\_(ツ)_/¯
@agile lance how much does the one person pay?
@drifting wedge $3 monthly
@restive furnace Thats with doing what you daif
said*
@agile lance can u share deets on ur bot? Dm maybe?
@agile lance can u share deets on ur bot? Dm maybe?
@drifting wedge deets?
Economy
const oauth = new DiscordOauth2();
const accesstoken=accessCode;
oauth.getUser(accesstoken).then(console.log);```
when i put the variable (and yes its defined before) it doesn't work but if I manually put a code in " " it works.
It’s all economy, Soon to be global
And what does premium do?
@agile lance
Its guilds
Going to that hastebin
it said
TypeError: message.guild.channels.fetch is not a function
at eval (eval at evulate (/home/freestyle/bot/dist/commands/developer/EvalCommand.js:22:30), <anonymous>:1:24)
at EvalCommand.evulate (/home/freestyle/bot/dist/commands/developer/EvalCommand.js:22:30)
at EvalCommand.execute (/home/freestyle/bot/dist/commands/developer/EvalCommand.js:50:31)
at Client.eval (eval at evulate (/home/freestyle/bot/dist/commands/developer/EvalCommand.js:22:30), <anonymous>:6:33)
at Client.emit (events.js:326:22)
at MessageCreateAction.handle (/home/freestyle/bot/node_modules/discord.js/src/client/actions/MessageCreate.js:3114)
at Object.module.exports [as MESSAGE_CREATE] (/home/freestyle/bot/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/home/freestyle/bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/home/freestyle/bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/home/freestyle/bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
hmm
ok
well heres the docs https://discord.js.org/#/docs/main/master/class/Guild?scrollTo=channels
Docs didnt help
I figured it out
The way I defined it didnt wokr
I switched it to a global.joinchannel instad
These commands:
@commands.command(hidden=True)
@commands.is_owner()
async def load(self, ctx, module : str):
"""Loads a module."""
try:
self.bot.load_extension(module)
except Exception as e:
await ctx.send('\N{PISTOL}')
await ctx.send('{}: {}'.format(type(e).__name__, e))
else:
await ctx.send('\N{OK HAND SIGN}')
@commands.command(hidden=True)
@commands.is_owner()
async def unload(self, ctx, module : str):
"""Unloads a module."""
try:
self.bot.unload_extension(module)
except Exception as e:
await ctx.send('\N{PISTOL}')
await ctx.send('{}: {}'.format(type(e).__name__, e))
else:
await ctx.send('\N{OK HAND SIGN}')
@commands.command(name='reload', hidden=True)
@commands.is_owner()
async def _reload(self, ctx, module : str):
"""Reloads a module."""
try:
self.bot.unload_extension(module)
self.bot.load_extension(module)
except Exception as e:
await ctx.send('\N{PISTOL}')
await ctx.send('{}: {}'.format(type(e).__name__, e))
else:
await ctx.send('\N{OK HAND SIGN}')```
Don't work all of a sudden :/
I want to make my bot spawn credits (my bots currency) every x hours in a server for people to be able to pickup. How do I make a timer for it so that it spawns it automatically for every server? (discord.py)
Like the trick'ord treat bot
@ivory seal use passpord instead
count howmany bots in a server?
because you're adding the id inside the string
oh
wait you did
ok that's better
still doesnt work
bruh
Items.findOne({
userID: message.author.id,
}, (err, itemDB) => {
if (err) console.log(err);
if (!itemDB) {
const newItems = new Items({
userID: message.author.id,
huntingrifle: 0,
fishingrod: 0,
pickaxe: 0,
});
newItems.save().catch(err => console.log(err));
}
});
Items.findOne({
userID: message.author.id,
}, (err, itemDB) => {
if (err) console.log(err);
console.log(itemDB); //null
itemDB[item] += amount;
itemDB.save().catch(err => console.log(err));
});
why does it say null when i delfined it right before
;-;
Is your id a string or a number?
because if it is a number then why are there '' marks surrounding it?
@gentle lynx
string
oh ok
write a description for your bot
Detailed description of your bot *
Use a keyboard, use your language knowledge, think how to write a good description
I made a simple moderation bot. But im still working on it at the moment
@ivory seal use passpord instead
@honest perch do u mean passport?
how can I use async in setTimeout
does someone knows mongoose db findoneupdate method? I am trying to make that work with a custom prefix, but so far it isnt working..
@gentle lynx setTimeout(async () => {...}). You can just search Google and find a lot of answers: https://stackoverflow.com/a/42964310
How do send messages in other guild in sharding? with brodcasteval?
@tired panther
any idea?
ask Tim our saviour
@honest perch do u mean passport?
@ivory seal use this strategy https://www.npmjs.com/package/passport-discord with passport
ye but this is only for authentication right?
does it work for the guilds.join scope?
@tired panther Try experimenting. Are you able to successfully broadcastEval a channel.send(...), or are you able to fetch the guild then send from there?
does it work for the
guilds.joinscope?
@ivory seal see yourself
kk
Yes it does
@tired panther Try experimenting. Are you able to successfully
broadcastEvalachannel.send(...), or are you able to fetch the guild then send from there?
@sudden geyser I think you do not have to fetch them since this operation will be proceeded in all shards.
another question?
which changes are there in sharding?
when I say fetch, I just mean look up, which would be by cache
ah ok thanks @honest perch
when I say fetch, I just mean look up, which would be by cache
@sudden geyser the word fetch is usually used for promises
iirc
It can be used for a number of things, but I misused it a bit.
Not necessarily promises, but some form of look up in my eyes
for example, you may fetch some data from your local database
it may return a promise, a callback as its last argument, or just the value assigned to the variable
i use the word fetch for doggos catching bones thrown in the air
if I had nitro I'd use an image of a dog with a waffle in its mouth
that's close enough
ok
I have one small doubt. I coded another avatar command and I want to make it like there should be a masked link that should be like Click here to download this avatar
Can I get any tip by how can I do it
I am sending the code
just link it to the avatar
[Click to download avatar](link to avatar)
that's how you put links in markdown
embed = discord.Embed(title = f"{member.name}'s Avatar!" , description = f"Click here to download this avatar!" , colour = member.colour , timestamp = ctx.message.created_at)
that's how you put links in markdown
@earnest phoenix k
how to add multipule owners on User IDs, max. 3, You are already listed as an owner.
,space??
how to add multipule owners on
User IDs, max. 3, You are already listed as an owner.
@earnest phoenix if you have friends, you put their discord ids in separated by commas
707198291246579732, 503948134439976972, 141075183271280641
ok
I want to make my bot spawn credits (my bots currency) every x hours in a server for people to be able to pickup. How do I make a timer for it so that it spawns it automatically for every server? (discord.py)
Like the trick'ord treat bot
So i have this code on my bot, but it seems like the collect event never triggers, the normal message event is triggered first, anyone knows why?
let c1 = msg.c.createMessageCollector((m) => { m.author.id === msg.author.id }, { time: 30000 })
c1.on("collect", m => {
msg.client.db.set(`${msg.g.id}.config.prefix`, m.content)
msg.s(`My prefix has been succesfully set to\n> ${m.content}`)
})
c1.on("end", () => {
msg.s("Woops, looks like nothing has been sent in 30 secs, cancelling...")
return;
})```
the end event triggers tho
You forgot to return in the filter function.
it has to return?
if i lok at the example guide i dont see any return
lemme try with that
If you don't return or don't use the short-hand version of an arrow function (=> expression rather than => { expression; }), it evaluates to undefined by default.
Which is a falsely value.
Which is why it never passes the filter.
oohk
thanks ^^
worked btw
k now the end event triggers even if the collect event triggered, do i need to put a return or smth in my collect event?
It's supposed to emit when the event ends.
Might wanna stop the collector to prevent it from firing multiple times within those 30 seconds
yeah thats what i was about to do
👍
^ you can pass to the options object (the third argument to .createMessageCollector) a key called max, which is the max number of items to collect.
If you don't want the end event to trigger, I recommend you look at the two parameters you're given: collected and reason. If collected is empty, nothing was collected. If the collector ended for some reason, such as expiration, it means the time ran out.
When someone who doesn't have access to my (public) repl presses the run button, will repl.it allow the program to read data from the environment variables in .env? Because I'm testing smth using discord.js webhooks and would NOT want anyone else to run the same instance of the node.js app.
No
ok so my bot goes online but its a command that wont work, it says this in the terminal ReferenceError: options is not defined its if you do ,image it sends a image from google
so the app will just crash when someone presses run cuz process.env.WEBHOOK_ID should be undefined and discord.js will go nuts?
ok so my bot goes online but its a command that wont work, it says this in the terminal ReferenceError: options is not defined its if you do ,image it sends a image from google
@fading breach options is supposed to be an object iirc
i think you forgot to replace the english word with an actual object
send code

how do i put the code in a little box
@fading breach put ``` then your code then end off with a ```
('like this')
let args = message.content.substring(prefix.length).split(" ");
switch (args[0]) {
case 'image':
image(message);
break;
}
function image(message){
var options = {
url: "http://results.dogpile.com/serp?qc=images&q" + "example",
method: "GET",
headers: {
"Accept": "text/html",
"User-Agent": "Chrome"
}
};
}```
how is options not defined here???
nope its right
also can you try pressing the run button on this repl: https://repl.it/@code913/djs-web-test#index.js
testing smth
ill hastebin it
the program should outright crash when you press run since it can't read environment variables
its really crappy code
its really crappy code
@fading breach basically all of us have crappy code
no need to be ashamed
i got it
options is defined inside a function which means outside stuff can't use it
alright
function image(message){
var options = {
url: "http://results.dogpile.com/serp?qc=images&q" + "example",
method: "GET",
headers: {
"Accept": "text/html",
"User-Agent": "Chrome"
}
};
}
request(options,
put the request stuff inside the function
the image function
function image(bla) {
var options = "something"; // options is created here, it only exists inside here
// options exists here
request(options) // works
}
// options does NOT exist here
request(options) // error, options is not defined
What is the difference between putting script tags inside the <body> tag and <head> tag
How can i add a function / method to D.js files in node modules? without editing the actual files in node modules
head tag only for js, meta, title and css
body for it's elements
but, if you put script tag inside body
they will execute it later after they load the elements

but you can use defer <script src="#" defer >
so if i want stuff like d3.js to load before all other elements i put them in head?
probably, yes, because html loads from top to bottom, so the head loads first.
I'm not sure about where to put the javascript, but as far as I know, the HTML loads from top to bottom
ok
How would I be able to show privacy practices so I can get an A+ security rating 
what app is that?
@earnest phoenix use djs's structure extensions
which class do you want to add a method to?
Several classes
not all classes are extensible through this method, so it depends which ones, but here's an example: ```js
Discord.Structures.extend("Message", oldMessage => class myMessage extends oldMessage {
myMethod() {
console.log(this.content)
}
})
Hmm ill try
I want to try out the command called Bans. I coded one command which shows the bans of a specific server but it's not showing the bans. Can anyone help?
Why don't the server images show up as GIFs in the command you see in the image? Coding is as follows;
embed.setAuthor(message.guild.name, message.guild.iconURL({}))
embed.setThumbnail(message.guild.iconURL({}))
what app is that?
@quartz kindle duckduckgo
It has an inbuilt thing
@earnest phoenix you need to set the format as gif, in the {} put format: "gif"
@earnest phoenix try .iconURL({dynamic: true})
Someone help me
@earnest phoenix try .iconURL({dynamic: true})
@misty sigil i trying
I want to try out the command called Bans. I coded one command which shows the bans of a specific server but it's not showing the bans. Can anyone help
Are there errors?
Me?
if (!serverQueue) return msg.channel.send({embed: {color: "#2F3136", description: "**:x: | There is nothing playing that I could stop for you**"}});
serverQueue.songs = [];
serverQueue.connection.dispatcher.end("Stop the music");
return msg.channel.send({embed: {color: "#2F3136", description: "⏹️ **| Stopped Music** "}});```
why
@next flax who did you copy
Write your own fucking code
i m making for my own servers

Because you learn nothing through ctrl c ctrl v
Because you learn nothing through ctrl c ctrl v
@pure lion true. I code these things myself. If I have any problem. I go through the documentation and stack overflow for the explanation
Explanation = Learning some things which I don't fuckin know
then go ask on stackoverflow 
Stack overflow is last resort
@earnest phoenix try .iconURL({dynamic: true})
@misty sigil thx ❤️
@pure lion so apparently they use https://tosdr.org/ to grade a website's privacy rating
Terms of Service; Didn't Read (ToS;DR) is an active project to fix the biggest lie on the web. We help you understand the Terms and Conditions and Privacy Policies of websites.
Okay epic
so unless your website is listed there, your website will remain "unknown"
idk if you can add websites to it
its mostly just popular services and big websites there atm
Why didn't nobody help me
what is it
Lol
show ur code
We asked you
L
😫 😫 😫
Ye
idk then
Yeah
you need to bans = await ctx.guild.bans()
Oh
Tim are u py dev
@quartz kindle Thanks ❤️
And I want to make a system type of thing like if I type ,warn . It should send Please mention a member and a reason with it
@quartz kindle
I tried many times
T didn't worked but
It*
K
@next flax no
Does somebody in here knows dblpy well?
#dontask2ask
That’s not related to dontasktoaks ;-;
it's an ask2ask just ask your question
its still basically this
Hmmm
...
Sorry, I will repaste it
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Here
on_dbl_py doesn’t work. When I vote for my bot I don’t get any output
I am not sure if the rest of the code is correct
But the bot itself just ignores this part
async def on_dbl_vote(self, Bot, data):
should be
async def on_dbl_vote(self, data):
also, receiving vote events requires you to setup the webhook in your bot's edit page, in top.gg
did you do that?
how can i make my bot that if it gets disconnected it will automatically delete the queue
I think the problems is in webhook
Any java experts around? My bot made in Rust is on the blink again 
@next flax no don't do that
what
But how do I set the webhook properly
It automatically destroys the connection when it's disconnected
Assuming you're using ffmpeg
yep
They ye
@dapper ocean where is your bot hosted?
Up my bum
@quartz kindle heroku
I know Heroku is trash
But it’s the best hostings from free ones
then your webhook URL should be YOURPROJECTNAME.herokuapp.com/WEBHOOKPATHHERE
There is literally a pinned message
you also didnt add the webhook options in your code
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=3000)
i want it that it will delete queue for the server it happened in
I got your point
but what should i do for that
👍
as if i dont do that and it gets disconnected it says
so i have to restart
it
again
😢
@pure lion pls help
this issue
Where do you host
Wot
this.user.setPresence({
status: "online", //You can show online, idle....
game: {
name: "Moving Money", //The message shown
type: "WATCHING" //PLAYING: WATCHING: LISTENING: STREAMING:
}
});
Any idea why this isn't changing the presence?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
game as well as activities is an array
game: [{ ... }]
Not sure if this required in DiscordJS too but worth a try
it's not game anymore, it's activity https://discord.js.org/#/docs/main/stable/typedef/PresenceData
Venity url name
How do i count bots in a guild
??
exactly what i said
you would also probably need to fetch all users in order to get an accurate count
ok
@earnest phoenix
#topgg-api @dapper ocean
the code they sent only works off cache (not all members are going to be cached at all times), you need to download them all to get an accurate count
https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=members
https://discord.js.org/#/docs/main/stable/class/GuildMemberManager?scrollTo=fetch
What’s that
if you eval that code here you'll probably not get an accurate count because not all members are fetched, vaggos
But you pinged me
yes
Oh
i redirected you to #topgg-api
Thx
console.log(bot.guilds.cache.map(g=>g.name)) Consoling log the following doesn't show me all the servers and only 100, what is a better way to do it?
?
what is there not to understand about three words
okay, 6
console.log(bot.guilds.cache.map(g=>g.name))Consoling log the following doesn't show me all the servers and only 100, what is a better way to do it?
@feral aspen join the array
add .join(", ") after the mapping
you don't have to spoonfeed them lol
let them figure out
if they wanted to know more they'd ask
🥄
no one has to spoonfeed but a simple snippet is fine to help
we're here to be helpful, not judge
i m unable to find a dispatched stop property in the docs like the method used for that in v11 was end can u help me finding one?
on which object
v11 docs
getting used to sharding is hard....
no info with v12
broadcastEval()
on which object
@earnest phoenix stream dispatcher
k
you're not helping cwickks
the dispatcher itself is now a stream
so it has a finish event
ok
finish doesnt work
i tried it already
i saw a conversation
on
github
saying its a proper
which can be used in 12
but it says
Server venity url name?
well
did you read the error
Server venity url name?@earnest phoenix
i can't speak caveman
yep
it means that there is no stop method @next flax
hmm
is that a loop hole
are you looking for destroy, by any chance @next flax ?
@earnest phoenix what do u mean
i just want my bot to stop the queue
Can someone get me thru discord oauth with glitch?
what
destroy works @earnest phoenix
thnx
wait
if i use that
then
it happens the same thing when i disconnect
the bot
without clearing the queue
wait lemme
update my code
more
its fine now
no
is their a event like if my bot gets disconnected
queue will be delete
lemme check docs
guys how do i make my bot dm someone
in which library
are there any alternatives to this npm pakage?
https://www.npmjs.com/package/passport-discord
is their a event like if my bot gets disconnected
@next flax voiceStateUpdate event
u saw docs?
well u can refer the docs
docs
wait its a ban?
are there any alternatives to this npm pakage?
https://www.npmjs.com/package/passport-discord
@ivory seal yes, make yourself one
ye i tried using the fetch method i was unable to do more than one in the js file
hm
can someone help me i want to use spotify links for my discord bot
i need docs or a package
erela.js has a spotify plugin
i m unable to find 😢
or use the official api
lavalink prob
yeah
since soundcloud api is closed rn
Oof
spotify and soundcloud are being scraped
none of the official apis are being used
you're not allowed to stream from spotify; some bots scrape spotify links and search the songs on youtube
lavalink is an external program
a webserver running java
google lavalink and an appropriate lavalink client for your lib
lavalink is trash with performance though
lavaplayer is alternative too
is lavalink ez to use?
lavaplayer is java
lavalink is a wrapper around lavaplayer
i'd go for implementing everything by myself but that requires a lot of lowlevel knowledge (any -> RAW -> opus) etc. which i doubt you have
also yes
lavalink is easy to use but is absolutely trash in performance
hm
i would make one in c++, but I don't have enough experience in it
i made an alternative in c# but it's private use only right now
is their a way by which the bot will create a webhook
@next flax yeah, there's a few bots that actually those that to clone users name and profile pictures and act like them.
So, my basic commands look like this. I've tried following tutorials and the official discord.js but I found nothing! I'm trying to make the bot send an embed, but it's really hard to find a good explanation on how to do it! Anyone able to help?
you must be blind because embeds are right to the side on the official docs
I know, I tried that.
It just doesn't work for some reason
what did you try that didn't work?
and of course, there's a reason as to why it didn't work lol
Lemme show you the error...
show the code too if you can
you're trying to use message where it doesn't exist
look at your code
you defined message as msg, not message
^
Ohhhhhhh
chill

Like for a vc channel?
yep
I think their is a event for that if it is it will be in the docs
Are you using node/discord.js?
djs
client on disconnect will work right
When you do client.on a list should pop up (if your using vsc im not sure if other editors do this) displaying a list of events that can be used
ok
If you see it in the list then yes it will work
that is VoiceConnection#disconnect so you need to join a channel first and then listen for that event
you're probably looking for Client#voiceStateUpdate, which triggers when a member leave/joins a VC
Ah
but what do you mean by client on disconnect?
the shard/client itself or regarding VCs?
like
if my bot is disconnected manually
so queue will be deleted automatically for that guild
this sends two parameters, oldState and newState. to check whether the bot was disconnected, make sure that newState is null , which means that the bot is no longer inside a VC
you can delete the queue if that returns true
u have example?
like your message event, you can use it likejs client.on("voiceStateUpdate", (oldState, newState) => { if ( oldState.id === client.user.id && // make sure that the member is the bot itself by comparing old VoiceState member ID and the bot's ID! !newState // ...and make sure the bot is not in a voice channel anymore, meaning that it got disconnected ) deleteQueue(); // delete the queue if all the conditions are true });
here's the available VoiceState properties - https://discord.js.org/#/docs/main/stable/class/VoiceState
ok
#verification-help
like
if my bot is disconnected manually
so queue will be deleted automatically for that guild
if somone drags the bot
@next flaxnewStatewill still exist, thus your bot will not delete the queue
ok
oldState is your bot's previous VoiceState. if it was moved, newState will be the about the new VC
So in theory Flaze couldn't you make a switch argument that detects if the bot was moved or just disconnected normal to delete the queue?
Hmm
since the values can be different types
True
what permission do you guys recommend for prefix changing?
MANAGE_SERVER
manage server
okay, thanks
or administrator
don't ever put administrator lul
Poo
and for nuking a channel?
manage channels
manage channels
manage messages isn't enough right
it is
yes, not enough
okay
you need to nuke a channel, that requires manage channels permission
i was assuming they mean deleting them
channel.clone```
thonk
Clone just copys the channel
so channel.delete too?
how can i call a function in bot.py from /cogs/admin? (discord.py)
If you want to delete it do channel.delete
hm
make sure to add (), since it's a method
What's the error?
their isnt any
module.exports = {
name: "ban",
category: "moderation",
description: "Ban anyone with one shot whithout knowing anyone xD",
usage: "ban <@user> <reason>",
run: async (client, message, args) => {
if(!message.member.hasPermission("BAN_MEMBERS")) {
return message.channel.send(`**${message.author},I m sorry but You do not have perms to ban someone**`)
}
const target = args[0];
if(target.id === "724300617656303687") {
return message.channel.send(`**${message.author},I m sorry but I cannot self-ban**`)
}
if(target.id === message.author.id) {
return message.channel.send(`**${message.author}**,I m sorry but You can not ban yourself!`)
}
let reason = args.slice(1).join(" ");
if(!reason) {
reason = "No reason given";
}
target.ban(reason)
let embed = new discord.MessageEmbed()
.setTitle("Action : Ban")
.setDescription(`Banned ${target} (${target.id})`)
.addField("MODERATOR", `**<@!${message.author.id}>**`)
.addField("REASON", reason)
.setColor("#ff2050")
.setFooter(`Banned by ${message.author.username}`);
message.channel.send(embed)```
Target may be the issue
so what should i do
i m trying to make it both
Ah
if (!channel) return{
channel = message.channel
}
channel.clone();
channel.delete();
updated version of nuke cmd
Do something like let user = message.mentions.members.first()
you can use <Message>.mentions.members.first() to get the first mention of a member in the message, and as for ID, you can get the member from the cache using message.guild.members.cache.get(args[0])
^
(Trying not to spoon-feed too much)
if you use message.mentions you're going to have a hard time getting the ban reason
the mention could be the last arg for instance
Hmm
In that case make it look for the mention in the first arg
If it doesn't see a mention execute nothing or a help message
@next flax also your nuke command looks like its gonna make a copy of the channel then delete the original channel leaving the copy
hi, i have an idea on creating a reward for those people who vote the server, then what command do i have to make?
@earnest phoenix you have to use webhooks and use the vote event to fire the rewards
Ask in #topgg-api
k
@next flax also your nuke command looks like its gonna make a copy of the channel then delete the original channel leaving the copy
@main trench nuke cmd is that only
u havent tried better anti spam bot?
how can i call a function in
bot.pyfrom/cogs/admin? (discord.py)
@chrome hound what are you trying to do
module.exports = {
name: "ban",
category: "moderation",
description: "Ban anyone with one shot whithout knowing anyone xD",
usage: "ban <@user> <reason>",
run: async (client, message, args) => {
if(!message.member.hasPermission("BAN_MEMBERS")) {
return message.channel.send(`**${message.author},I m sorry but You do not have perms to ban someone**`)
}
let user = message.guild.members.cache.get(args[0]);
if(user.id === "724300617656303687") {
return message.channel.send(`**${message.author},I m sorry but I cannot self-ban**`)
}
if(user.id === message.author.id) {
return message.channel.send(`**${message.author}**,I m sorry but You can not ban yourself!`)
}
let reason = args.slice(1).join(" ");
if(!reason) {
reason = "No reason given";
}
user.ban(reason)
let embed = new discord.MessageEmbed()
.setTitle("Action : Ban")
.setDescription(`Banned ${user} (${user.id})`)
.addField("MODERATOR", `**<@!${message.author.id}>**`)
.addField("REASON", reason)
.setColor("#ff2050")
.setFooter(`Banned by ${message.author.username}`);
message.channel.send(embed)
let dmembed = new discord.MessageEmbed()
.setTitle("Action : Ban")
.setDescription(`You were banned from ${message.guild.name}`)
.addField("MODERATOR", `**<@!${message.author.id}>**`)
.addField("REASON", reason)
.setColor("#ff2050")
.setFooter(`Banned by ${message.author.username}`);
user.send(dmembed)
}
}
it is still not working
@chrome hound what are you trying to do
@slender thistle I wanna have a global function calledis_owner_or_has_permsand i don't want to add it to every cog.
@earnest phoenix you need to make a webhook that uses the top.gg api to detect if someone votes your server
oh i actually have one
@earnest phoenix you need to make a webhook that uses the top.gg api to detect if someone votes your server
@main trench and how do i do it in javascript?
Why not add it there?
@next flax you have it set to only work with id's
@earnest phoenix you can make webhooks in the discord server settings but I would ask for more help in #topgg-api
i used ids only
In embed: Embed size exceeds maximum size of 6000* 😦
I'm not good with Api help so I don't have a example
Help me
@next flax the issue is it is banning a user then dming them have it dm the user first before banning them
Your embed is too big try making it smaller @sick fable
ok
170,000 times a year - That’s how often criminals attempt to steal domains. Protect your domain. This is what it says once I am buying my domain, is this true? Or they just want my money :((
Its just wanting you to upgrade a safety plan in your domain you can just ignore it
So yeah they want your money
Bleh scammers 
What scammy registrar is that, @earnest phoenix?
One of the embeds was coded wrong
ok
Godaddy
sounds like freenom- oh
It's basically the one that has provided me with the best experience.
Your embed is too big try making it smaller @sick fable
@main trench I can't make it more smaller
Cloudflare is a newbie in the registrar game, so won't recommend it.
Google domains is good.
Btw, can I get a free email on that domain?
Without having to pay again a lot money
You can.
Hm its only 0.91$ 
1000 email accounts, free.
Perfecto
Not until it is on the search console.
is it searchable on google?
@earnest phoenix ^
search console?
Google search console.
Mention me if you need help regarding anything WoT or IoT.
Web of things, Internet of things.
module.exports = {
name: "ban",
category: "moderation",
description: "Ban anyone with one shot whithout knowing anyone xD",
usage: "ban <@user> <reason>",
run: async (client, message, args) => {
if(!message.member.hasPermission("BAN_MEMBERS")) {
return message.channel.send(`**${message.author},I m sorry but You do not have perms to ban someone**`)
}
let user = message.guild.members.cache.get(args[0]);
if(user.id === "724300617656303687") {
return message.channel.send(`**${message.author},I m sorry but I cannot self-ban**`)
}
if(user.id === message.author.id) {
return message.channel.send(`**${message.author}**,I m sorry but You can not ban yourself!`)
}
let reason = args.slice(1).join(" ");
if(!reason) {
reason = "No reason given";
}
message.channel.send(`<@!${user.id}> was banned`)
user.ban(reason)
}
}
Holy moly
i removed embeds
Could you please do that in a pastebin?
my pc lags if i open several tabs
😢
why isnt the bot is banning
i just wanted to know this
same error
what's the error?
well, you need a try catch block on the bottom half of the error
users may not always have their dm's open
there might be a better way than just try-error tbh[
@quartz kindle do you know if theres a better method in d.js than just wrap a <user>.send() onto a catch block?
im now curious
If there is, ping me please ^
Doesn't a .catch(e) exist already?
a better method in d.js than just wrap a <user>.send() onto a catch block?
Oh.
no, the api doesn't tell you anything until you try to send a message
i know that bit, but idk if d.js provides a better method that accounts for that
that would be swallowing errors
idk, just wondering tbh
i.e. bad lib design
tell ME about bad lib design
not like djs already swallows ws errors
fucking twitch lib devs swallow 90% of all errors
library.on('error', e => {})
they swallow so many errors it feels lke they did that internally ngl

Thanks for your help it was only 1$ it was very cheap
Nice, @earnest phoenix!
Now I am going to work on it!
yesss
because it has a low seo rating
you should've checked out github student pack and gotten a cheap .dev domain
how to downgrade discord.py version 1.5.0 to V1.4.1
out of curiosity, why would you do that?
Im now going to set everything up with my site, then email I feel so happy ;DDD
XYZ is pretty popular too. It is used for all sorts of things nowadays and .dev is not included in the GH Student pack.
Let me know if you need help with the email setup. I am a little too experienced with that.
how to downgrade discord.py version 1.5.0 to V1.4.1
??
out of curiosity, why would you do that?
maybe using old lib that doesnt support newer sytanx?

discord.js v12 to v11 would be a huge troll
v13 gonna be just like the update from v11 to v12
MORE CACHING INTENSIFIES IN v13
crys
laughs in 128gb RAM
More work for me @_@
woohoo more bandwidth to spend
wow
correction, 126GB
And 200mb/s disks

precisely
dude i was legit pulling my hairs trying to figure out how to re-attach a VSC debugging session

finally figured out


What the fuk
wot?
I got a friend request from hydrabolt
imma slap you with a Leviathan friend rq
brb
actually
bots dont have friends anymore i dont think
I mean

yep
shameful of me to not know them
he is


the guy with pikachu pfp
even though i asked em' if they wanted d.js typings for TS

i dont think i spoke to that person though
im like, 99% sure
@main trench I can't make it more smaller
@sick fable try reducing the amount of words and or images in the embed
Can I get ram???
a cheap way to check length is to simply JSON.stringify(embedObject).length > 2000
like, REALLY cheap way of doing it
Is there an efficient way to run multiple puppeteer instances?
i only played a little with puppeteer, cant give much help there
that shit is the only reasons i still have ERRCON errors on my bot

What
cough cough web scrapping cough couhg
i have a google assistant command that uses puppeteer
can a bot accept a friend request
I've seen people use it for running HTML code and sending the result
No, @earnest phoenix.
yeah, that
@earnest phoenix no
Use request, @queen needle.
bots have no friends, they are lone losers 
F
why does puppeteer download the whole fucking source of chromium
That sounds like I.
Because it runs on chromium, @earnest phoenix.
You can also use Firefox.
It's a browser inside the console.
I use it to run WhatsApp web instances to automate several things and work on an unofficial API.
Wait isn't Puppeteer that Chrome Node.js API?
Whats that
yes
I use it to run WhatsApp web instances to automate several things and work on an unofficial API.
@still cliff you fucking smartass
:p







