#development
1 messages · Page 979 of 1
ok thx
@quartz kindle can you help me?
if(parseInt(muteTime) == null) delete muteTime;
So the Code will look like this ?
welp, delete seems to only work for objects, not for primitives
just set it to undefined
wdym replace? they were never removed?
Anyone!?
if i set muteTime to undefiend so this will be true ?
if(!muteTime){
//code
}
it will be true with any of 0, null, undefined, "", NaN
:/
yeah im waiting for help too xd
@earnest phoenix try looping through all channels and filtering voice channels
I tried
client.channels.cache.filter(c => c.type === "voice").reduce((a,b) => a + b.members.size,0)
something like that
then the same thing without the .cache for v11
i know
👍
show code
its not gone
i sent you a link
.bulkDelete()
tf
so then why doesnt this work ... ? client.channels.fetch("723199082486562857").bulkDelete(50)
because fetch returns a promise
get
how do i check the message from the author. He wrote !test but the bot should say that he should use !test [text] for example.
do I have to use the cache here too now
Await at the start
check for args
for get yes you need cache
for fetch no
get returns the channel from the cache, or undefined if not found
fetch returns a promise that resolves into a channel, from the cache, or from the api if not found in cache, or error if not found in the api
ok
ty for help
i havent developed in a long time with discordjs and this new update is confusing me a lot
how do i make an error for a command where it says it should use something after !test
pls in python
i dont know python, but if args is null, then nothing is after test
if your not doing args, then if nothing is after the first word, then error
its super basic, if your unsure how to do it, i would checkout a beginners guide on python
how i can add a emoji?
you mean create an emoji? as in adding a new emoji to a guild?
@stable grail are you using the commands extension
sry for asking that dumb but what are extensions xd
commands.bot
you can use on_command_error as a global error handler OR give the command argument a default value like None and then checking if arg is None:
i removed the global error because its not allowed on this server .d
How can i learn free space(s) from cpu(s)?
You can still ignore this server in your error handlers
oh
guys?
arg is red underlined do i have to install something?
Math.floor(require('os').cpus()[0].times.idle/1024/1024) this is true?
my vps has "8GB RAM" so I think it wrong.
What's your command function like rn
it should send 3 random messages
which works
but they author should send a text after the n?eightball
the*

Misunderstanding. Show me the command function with the decorator
whats that?
async def
async def eightball(ctx):
when i use cookies on my page, i have to warn the user, right? But is it okay, when the warning is only on the homepage?
Depends where they're viewing from. In the UK atleast you must notify about cookie usage
thx
Whats the proper way to handle "permission denied" errors in discordjs?
I am currently just catching the error.
I was told that catching the error isnt correct and i need to check if the bot has permission.
But checking if the bot has permission every time seems like doubling the number of queries, and wasting resources.
the other suggestion i got was to cache the send message permission per channel, but i was thinking maybe discordjs already does that, but i wasnt sure how to find out.
Ive google around for a bit, and most suggestions for dealing with the error is just to catch it.
and no, checking for permissions does not waste resources
i have to send the permission request, wait for it to get back, then send the message then tho
right?
you dont have to, unless the member is uncached.
the member object has "permissions" property
permissions doesnt account for overwrites tho does it?
its just the role permissions
Um Im using a json "database" and Heroku cant handle those and glitch disabled uptime robot pings so does anyone know where can I make my bot run 24/7 online?
permissions doesnt account for overwrites tho does it?
its just the role permissions
member.permissions#has("ADMINISTRATOR")for example should work
also im a bit sleepy so yeah..
thanks that answers my question.
Some per-channel permissions are checked differently I believe
overwrites are seperate.
so if someone manually removes my bots talk permission in a room, it wont work.
but thats a rare condition that i can just catch
hopefully
if it becomes an issue later, i can just disable commands for a few minutes in channels where permission errors happen
which, the only case i think it will, is if the error happens enough time that my so many bad requests happen the bot gets temporary blocked
man i just realised how long the primary script text files can be for bots
mine has 225 lines
thats a lot
:awhat:
and im still not even done with everything
rip nitro
sad
its been a while since ive had nitro
like a long time
uhh no
i always got confused with the Math.floor function
before i figured out it could be used to make random numbers if you do for example Math.floor(Math.random() * 10)
so then you'd make a command for it
msg.channel.send(Math.Floor(Math.Random() * 10)
break;```
yeah i have the =>{ set to msg=>{
i use discord.js
Help about what specifically? The deprecations are just warnings, but you should use something up-to-date.
Also I wouldn't recommend using Glitch in its current state.
why do you have a .htaccess file
@earnest phoenix no, make ur own
I forgot how to find a channel by its id can someone help me?
What would you suggest @sudden geyser ?
Suggest what specifically
Yes but propose what. What dependencies to use instead?
I do not understand
I forgot how to find a channel by its id can someone help me?
What library are you using.
me?
yes
guild.channels.cache.get is what you're looking for
Um Im askng for help again
I want my bot
to send that he joined another server
to my support channel
and my code looks a little bit like this
not a little bit
const newEmbed = new Discord.MessageEmbed()
.setColor('#03a9fc')
.setTitle(':tada: New User! :tada:')
.setAuthor('Mari0', 'https://resizeimage.net/mypic/IGol2TBPzfzPANt1/XRQLX/mario-0.png')
.setDescription(`I joined another server! Servers: ${client.guilds.cache.size}`)
})```
now
I need to find the channel
on my server
and send a message
can someone help me?
You could get the collection of guild channels on <Client>.channels, or get the guild first in the <Client>.guilds collection, then do what I showed above.
Which is the function who show all the members , even if they are offline, in a server with 1000+ members? Please? actually i'm noob
hello, i have problem i have bot on my vps and when i run bot and type -play bot need to play live stream code: ```css
connection.playStream(streamlink/stream)
bot join but dont play anything, any solution ?
my attempt at trying to make a command that requires a role failed and it did nothing
any help?
wait
hold on i think i know what i did wrong
i didnt add a cache
dang
any help on deafing the bot while connected to any channel
i need help How to make a Music Bot
In which language tho
Discord.js
what the f***? https://gyazo.com/ef7e24f007e6c4a7883024f9a03e8598
@earnest phoenix define it
@tepid canyon discord.js
hello, has anyone mastered puppeteer
I give up for tonight maybe tomorrow ^^
I try to create an Instagram bot, problem here is the bot does not like and when it changes position sends me back ```(node:3284) UnhandledPromiseRejectionWarning: Error: Node is detached from document
likeTagProcess : async(tags = []) => {
for(let tag of tags) {
await instagram.page.goto(TAG_URL(tag), { waitUntil: 'networkidle2'});
await instagram.page.waitFor(1000)
let posts = await instagram.page.$$('article > div:nth-child(3) img[decoding="auto"]')
for(let i = 0; i = 3; i++){
let post = posts[i];
await post.click();
await instagram.page.waitFor(1000)
let isLikable = await instagram.page.$('#react-root > section > main > div > div > article > div > section > span:first-child > button');
if(isLikable) {
await instagram.page.click('#react-root > section > main > div > div > article > div > section > span:first-child > button');
}
await instagram.page.waitFor(3000);
await instagram.page.click('#react-root > section > nav > div > header > div > div > a > span > svg');
await instagram.page.waitFor(1000);
}
await instagram.page.waitFor(60000);
}
}```
Ptdr
@pine coral ??
two xD
not here 
qui voilà @pine coral
@north hollow have you even started anything for the bot yet?
Personne @meager burrow
- Speak english. This way everyone can understand you. It is our lingua franca after all.

Yes
trying to make a level system of sorts, how do you work out when a user actually levels up
like is it some sort of math or do people just type them out
probably some formula
ie: if currentXP > baseXP * 1.5
can probably throw in some Math.log() or Math.sqrt() for something more fancy
i have zero ideas tbh, never had a reason to make levels. but okay
base xp though, like
you can even make something as simple as
if xp > Math.exp(level)
although the curve for that is kinda steep, you might wanna lower it a bit
if user is level 3, it needs 20exp to level up, if user is level 4, it needs 54exp to level up, etc
if xp doesnt reset on each level, its a quite reasonable curve
might work, i think the guy i'm making it for wants to give up to 10xp per message lol
yeah thats the problem with exponentials, they easily get out of hand
but they are damn good at preventing stupidly high level people from getting too far ahead
exp / 2 :^)
maplestory used to have a xp system where every 10 levels the xp requirement would be multiplied by 10
that makes early levels easy to gain shiv
ouch
maybe there's a way to use the exp, but try and bring it up a bit for the earlier roles
also the logic i'd need would prob be user.xp > Math.exp(user.currentLevel + 1) right
to get the next level
Math.sqrt can be good if you want a more linear progression, with resetting xp on every level
looks like it'd work better
also logic wise, this would theoretically check if the current time is past when the user last spoke + the interval (say 5 min) right
so the user can only get xp every 5min
@tepid canyon ya
how do you return a function
i have code like
something.parse(stuff, (err, smt) => {
return smt
})```
how do you return smt
js'
you returned smt
you're returning inside a callback
if you made that function yourself, then you'd need to change how the function works
i didnt
otherwise, functions that return callbacks are taken out of context and cannot return
unless you put it inside a promise and await it
this is what happens:
someCode(); // this executes immediately
someFunction(callback => {
// this is taken out of context, basically this doesnt exist for the outside code
// this is executed asynchrunously, it might take some time execute
// when you finally receive the callback, the outside code is already long gone, you cannot return anything to the outside anymore
})
someMoreCode(); // this executes immediately and does not wait for the above callback
the only way to force a callback to return to the same context is to wrap it inside a promise
like this
result = await new Promise(resolve => {
someFunction(callback => {
// do something with callback
return resolve(data)
})
}):
console.log(result); // result now contains the content of data
oh okay thanks
this code creates a promise and uhh
what does the resolve => { return resolve(data)}
do
when you create a promise, you get two values, resolve and reject
resolve is a function that makes the promise return a value
reject is a function that makes the promise return an error
ah thanks
if neither resolve nor reject are ever executed inside the promise, the promise will basically never return
and the code would await forever
so basically a promise can wait as much time as it needs to
until it finished whatever it needs to be done inside it
yea
im trying to test my api and um, how can i test it if its on localhost?
if its on localhost, you can only test it from localhost lul
wym?
localhost = this computer
yeah
it can only be accessed from the same computer
is that a website or what?
yeah, https://apitester.com
Do you know how your APIs are performing? Check your first and third party APIs for functionality and performance with our free and easy-to-use API tester.
you cannot access localhost from it lol
o
localhost can only be accessed from the same computer it runs on
what would i use instead then?
nobody from outside can access it
so i can't test my api?
not from outside
fuck me
im confused, what else can i do to uhh
do the equivalent of testing my api?
is the api supposed to be public and accessible from outside?
its private, but im still making it
but do you want to use it from other computers eventually?
are you running it from a node.js app?
ye
simply using whatever.listen(3000)?
yup
then, if there isnt any firewall blocking it, it should already be accessible from outside
via your ip address
oh oki
kk
if you give localhost to a testing website, thats basically asking the website to test itself lul
my public ip or the 123.123.123 one?
public
kk
ok so
@quartz kindle how would i check if a user's last seen date was over a month ago
if 1 month is 2592000000
i tried x.lastSeen < (Date.now() + 2592000000)
but it's firing true when my last msg was a few sec ago
should be - not +
this is a dumb question but, ur public ip anyone can see and they can't do nothing w/ it?
they can see your public ip if they connect to you for some reason
otherwise nobody automatically knows your ip if you dont give them, unless they wanna guess it
and no, they cant do anything with it besides scanning ports looking for vulnerabilities (which pretty much dont exist anymore) to try to ddos lol
i mean, giving people ur public ip isnt gonna do anything? like it would giving them ur 123.123.123 ip
const users = msg.client.userLevels.filter((x) => x.guildID === msg.guild.id).array().filter((a, b) => b.level - a.level).splice(0, 10);
so for some reason this line is returning nothing and i have no idea why
oh right
giving people a public ip should probably be avoided, but in some circumstances it can be unavoidable
you dont have an ipv4 address?
idk, lemme chck
slice would be better in this case i guess
you can also truncate the array length
array.length = 10
should i use the ipv4 one?
probably
kk
wait you can just manually set the arr length? damn
though with slice, should it be the same?
slice(0, 10)
um
ye, slice and splice are the same, its just that splice also removes the result from the original array, while slice doesnt
ah
then you migth have a firewall blocking it
oh
also check your node logs just in case
do you have console.logs on your "/" endpoint?
can i somehow await a map
await sorted.map(async (x) => {
const u = await msg.client.users.fetch(x.userID);
let emoji = '⭐';
return `${emoji} **${u.tag}**: Level ${x.level}, ${x.xp} XP`;
}).join('\n')
tried this but it just outputs an [object Promise]
nope, array.map cannot be async
oh, i don't. what should i log?
what you can do is map it then use Promise.all() on it
map(async) will give you an array of promises
then you can feed the array to Promise.all(array)
tim, what should i log to my console? like how would i get the error
you're not looking for an error in this case
oh
you're just looking for confirmation
...lol?
for example, just put a console log at the very beginning of your "/" endpoint
nevermind sorted that
so if your api is ever reached, you should immediately see an indicator in your logs that something has successfully reached your api, even if the return data might not have worked
nice top 10 users xD
prob won't work :/
anyway, your node app is in a linux vps?
its all on my pc, windows
ah well that explains it
o
besides the windows firewall, you also have your router/modem's firewall
you need to open ports in all of them
ok so your app is working
its just your firewall thats blocking external access, so the testing website will not be able to access it
but you can access it yourself since you're on the same machine
is there a way to not block external access? or is there no way?
open ports
how would i do that?
you need to find your router's gatewayy address, access its control panel
and look for port forwarding or virtual servers
you can also google "how to port forward <your router make and model here>"
Hi, I keep getting this error in code. Could someone explain to me what the error means. I have never seen it before.
The error: TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received undefined
idk what my router make and model is uhm
do you have a small piece of equipment that should be somewhere between your pc and your phone line or tv cable?
i don't think so
then that box should be your router
if this sky box is related to the website sky.com then here you go https://helpforum.sky.com/t5/Did-you-know/How-to-set-up-port-forwarding/ba-p/2662260#
oh
hey can someone help me program something?
depends what language and what it is?
gimme a sec it's a bit hard to explain
i get this error
18.06 19:19:08 [Bot] throw new ERR_INVALID_CALLBACK(callback);
18.06 19:19:08 [Bot] ^
18.06 19:19:08 [Bot] TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received Promise { undefined }
18.06 19:19:08 [Bot] at setInterval (timers.js:169:11)
18.06 19:19:08 [Bot] at Object.<anonymous> (/cryptoverse.js:105:1)
18.06 19:19:08 [Bot] at Module._compile (internal/modules/cjs/loader.js:1133:30)
18.06 19:19:08 [Bot] at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
18.06 19:19:08 [Bot] at Module.load (internal/modules/cjs/loader.js:977:32)
18.06 19:19:08 [Bot] at Function.Module._load (internal/modules/cjs/loader.js:877:14)
18.06 19:19:08 [Bot] at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
18.06 19:19:08 [Bot] at internal/main/run_main_module.js:18:47 {
18.06 19:19:08 [Bot] code: 'ERR_INVALID_CALLBACK'
18.06 19:19:08 [Bot] }```
you tried to pass an invalid callback
how big is the file?
where is the bot hosted?
how do you access you rpi? ssh?
then navigate to your bot's folder and check the size of the json file
@quartz kindle is the callback just the stuff in the return thing inside the function or what
for example foo("whatever", bar => {}) bar would be the callback
?
what is timers.js? is it a file you made?
@quartz kindle how do i make it like ignore requiring a callback and just execute the function
i dont have timers.js
what about cryptoverse.js
then thats the problem
setInterval expects a callback function as the first parameter
setInterval(function here, 12000)
you're giving it function(), ie executing the function before giving it
instead of giving it for him to execute
wait whats it supposed to be then
ah
function bla() { return 10 } // bla is a function
a = bla // pass the function to a
a = bla() // execute the function and give the result to a (10)
setInterval(bla) // pass the function to the interval
// the interval will try to do bla()
setInterval(bla()) // execute the function and give the result to the interval (10)
// the interval will try to do 10() // error
kk
How do I put a Emoji?
can somenone help me, i was making a music bot, than i got this error
/rbd/pnpm-volume/9216dccb-314f-4120-9b9d-2105eb722f88/node_modules/.registry.npmjs.org/simple-youtube-api/5.2.1/node_modules/simple-youtube-api/src/index.js:26
if (typeof key !== 'string') throw new Error('The YouTube API key you provided was not a string.');
even tho i got the right api
have you tried reading the error
like i said
put the token in ""
stop using json as a database
still didn't go
npm i quick.db
stupid easy to use db
@earnest phoenix
better use that instead of a fucking json db
docs exist for that very reason
help with d.py, Extension 'cogs.rpg' raised an error: AttributeError: 'Command' object has no attribute 'casefold'
My code:
@commands.command()
async def leaderboard(self,ctx):
count = 0
leaderboard = discord.Embed(title="Leaderboard", description="top 25 users, based on points", color=0x00FF00)
for usere in credits.find().sort('credits', pymongo.DESCENDING):
username = await self.bot.fetch_user("_id")
if count == 0:
leaderboard.add_field(name=f"**TOP 1: __{username}__**", value=f"Points: **__{(usere['credits'])}__** \n \n ", inline=False)
count += 1
elif count == 1:
leaderboard.add_field(name=f"**TOP 2: __{username}__**",
value=f"Points: **__{str(usere['points'])}__** \n \n ", inline=False)
count += 1
elif count == 2:
leaderboard.add_field(name=f"**TOP 3: __{username}__**", value=f"Points: **__{(usere['credits'])}__** \n \n ", inline=False)
count += 1
elif count <= 25:
leaderboard.add_field(name=f"**{username}**", value=f"Points: {(usere['credits'])} \n \n ", inline=False)
count += 1
if count == 25:
await ctx.send(embed=leaderboard)
return
await ctx.send(embed=leaderboard)```
you install it, you require it and read the docs
the basics of a real database can be learned in an hour
i put it between "" and it still didn't work
less than* an hour but for just storing basic user info in a discord bot quick.db is more than enough
can anyone help
on what
help with d.py, Extension 'cogs.rpg' raised an error: AttributeError: 'Command' object has no attribute 'casefold'
My code:@commands.command() async def leaderboard(self,ctx): count = 0 leaderboard = discord.Embed(title="Leaderboard", description="top 25 users, based on points", color=0x00FF00) for usere in credits.find().sort('credits', pymongo.DESCENDING): username = await self.bot.fetch_user("_id") if count == 0: leaderboard.add_field(name=f"**TOP 1: __{username}__**", value=f"Points: **__{(usere['credits'])}__** \n \n ", inline=False) count += 1 elif count == 1: leaderboard.add_field(name=f"**TOP 2: __{username}__**", value=f"Points: **__{str(usere['points'])}__** \n \n ", inline=False) count += 1 elif count == 2: leaderboard.add_field(name=f"**TOP 3: __{username}__**", value=f"Points: **__{(usere['credits'])}__** \n \n ", inline=False) count += 1 elif count <= 25: leaderboard.add_field(name=f"**{username}**", value=f"Points: {(usere['credits'])} \n \n ", inline=False) count += 1 if count == 25: await ctx.send(embed=leaderboard) return await ctx.send(embed=leaderboard)```
@autumn summit
oh the python problem
How can i Make a number counter?
so whenever someone reacts to a message it sends message following the queue from 1 to 2 to 3
sorry If I didn't explain well 😦
how do i make my discord.py bot show the server under activity playing
I need gif category ideas to add to my bot
Do you?
Yeah lol
My bot is a gif and mod bot
So I just need some more gif ideas to add to it
in the docs, it says bot.id, is this the same id as the user id of the bot from the Discord API? I'm guessing yes but I'm just making sure
I need help when i try it then it doesn't sending to channel in in terminal i don't getting error
learn js
smh
you're not enclosing your url as a string
yes and?
nothing is wrong
yes it is
nah
stop acting dumb
then tell me what is wrong
answer me dumbass
low iq moment
i don't know who's retarded here, the guy who's been doing software deving and IT work for 6 years or someone who doesn't know what a string is
🤷♂️
tf noting is wrong on it
stop wasting my time
stop being dumb
🤡
i genuinely can't tell if you're trolling or not
enclose 👏 your 👏 url 👏 as 👏 a 👏 string 👏
fourth time
I did string
no you didn't
I did alr
no, you did not
I did
what
yeah
no, i genuinely can't understand what you're trying to say
I don't using basic source like y'all
stop being a clown
ur clown
do what i told you to do and your error is going to magically go away
fifth time now
enclose your url as a string
smh
js does not know that the url is a string
it thinks it's a part of the syntax
you have to enclose it as a string
to tell it
"hey use this url"
and you clearly did not read the mdn link i sent you
and you clearly do not know what a string is
stop being a help vampire
if u mean then k but string is for another module
@green kestrel either trolling or a severe help vampire
imagine
uh i think hes trolling lol
I don't trolling probably
Do you know what is and how to make a string.
hello
Using discord.py how can I have my bot join and speak on multiple servers?
self.voice_chat = None
async def play_joke_audio(self, joke, voice):
filename, player = await YTDLSource.from_url(joke.audio)
if self.voice_chat is None:
self.voice_chat = await voice.channel.connect()
self.voice_chat.play(player, after=lambda e: os.remove(filename))
Voice chat seems to only work with one server at a time
I tried doing this
async def play_joke_audio(self, joke, voice):
await self.connect(voice.channel)
client = await self.get_client(voice.channel)
filename, player = await YTDLSource.from_url(joke.audio)
client.channel.play(player, after=lambda e: os.remove(filename))
async def get_client(self, channel):
for client in self.bot.voice_clients:
return client if client.channel is channel else None
im getting AttributeError: 'VoiceChannel' object has no attribute 'play'
have a list of clients & players instead of a single reference
oh
nvm
wait
yeah
i'm not fluent in python so you'll have to wait on someone else if you want better tips
henlo
const filter = m => m.author.id === message.author.id && m.content === "hit"
const filter2 = n => n.author.id === message.author.id && n.content === "stand"
message.channel.send("**`" + message.author.username + " has a(n) " + aaa[a] + " of " + cards[card1] + "`**\n**`Bot has a(n) " + bbb[b] + " of " + cards[card2] + "`**");
const collector = message.channel.createMessageCollector(filter, { time: 5000})
collector.on("collect", m => {
message.channel.send("**`" + message.author.username + " has a(n) " + aaa[a] + " of " + cards[card1] + " and a " + ccc[c] + " of " + cards[card3] + "`**\n**`Bot has a(n) " + bbb[b] + " of " + cards[card2] + " and a " + ddd[d] + " of " + cards[card4] + "`**")
})
const collector2 = message.channel.createMessageCollector(filter2, {
time: 5000})
collector2.on("collect", n => {
message.channel.send("**`" + message.author.username + " has a(n) " + aaa[a] + " of " + cards[card1] + "`**\n**`Bot has a(n) " + bbb[b] + " of " + cards[card2] + " and a " + ddd[d] + " of " + cards[card4] + "`**")
})
collector.on("end", collected => { if(!collected.size)
{message.channel.send("You need to provide a valid response bruh")}
})
||
collector2.on("end", collected => { if(!collected.size)
{message.channel.send("You need to provide a valid response bruh")}
})
so this is my full code
at least the collector part of it
soz for bad indentation
but
when i type hit after the command
it goes properly
but if i type stand
it still sends: "You need to provide a valid response bruh" even after i send stand
what do i do
Why not just 1 filter, and depending on what is collected you run a different function?
And maybe use less +'s in your message part, and just use ${}
Does a discord bot leave a voice channel on its own? or how would I have a bot leave after a certian amount of time of inactivity
It won't leave unless you make it or someone disconnects it. You can use channel.leave() to make it leave after whatever you choose as a "certain time of inactivity".
how do i do only one filter
the msg part is fine idc about it
lol
should i do a if else
if so how
@tepid canyon
Personally, I use awaitMessages, but either method works it would seem. You would use something along the lines of collected.first().content and go through that. Just have your filter filter messages from the message author, and do something like if (collected.first().content.toLowerCase() === "hit") { code here }
ok
i think i tried that
but it didnt work
wait one sec
yea
if (const filter = m => m.author.id === message.author.id && m.conten
t === "hit")
^^^^^
SyntaxError: Unexpected token 'const
this error
@tepid canyon
You can't put const in if ()
you can put the const in a line above the if
It has to go before the awaitMessages or messagecollector
wait
dude
You dont need to change your whole code
ok how
i cant just const filter;
or
ok im confused and dumb
lol
plz just help
const filter = m => m . . .
Just like you had before, but without the content part.
oh kk
dude it isn't that hard
but how do i do the content part
see
the thing is
im really dumb
lmao
so its
const filter = m => m.author.id === message.author.id
if (filter === m.content === "hit)
like that?
what
no
what are you even trying to do
then how
even idk
lol
im sorry can you just tell me how i'd do it
im really confused
for some reason
if I don't even know what you're trying to do
im tryna
how am I supposed to tell you what to do
what are you trying to check
if its "hit" it doesnt something, "stand" it does something else
so im tryna collect certain words
and send an error messages if those words arent collected
Just like you had before in your code message.channel.createMessageCollector() like you had before you can use that, then just add .then(collected => {}) and work through your if statements with the collected.first() like i said before
no im asking about the filter
like i said, const filter = m => . . . like you had before, but remove the m.content part from it. and pass that into the collector function.
is there some sort of npm package around that offers half decent terminal formatting options
ie right/bottom/centre aligning text
hello, i have problem i have bot on my vps and when i run bot and type -play bot need to play live stream code: ```css
connection.playStream(streamlink/stream)
bot join but dont play anything, any solution ?
Use a set interval loop
@earnest phoenix that's not how it works
playStream plays a stream of data
not a youtube/twitch stream
lmfao
isnt twitch or youtube stream
well you literally said "streamlink"
i will send you link in dm
no
just tell me
what are you trying to play
well if ffmpeg was missing they would've gotten an error
still that's not how it works
playStream doesn't play that kind of stream
you gotta pass in a stream of bytes
say
you download a song, turn it into a stream of bytes
and then pass it into the function
you can play the radio
but you need to get a stream of data from it
and then pass that stream to it
ahh okay, thanks 🙂
np
So my boy has a command called "server-info"
But when I run it it crashes (in DBL), but if I run the command in a smaller server it does work,
what do I need to do to fix it?
Code:
if(message.content.startsWith("Beaver server-info")) {
const embedServerInfo = new MessageEmbed()
.setAuthor(message.guild.name, message.guild.iconURL())
.setThumbnail(message.guild.iconURL())
.addField('Name', message.guild.name, true)
.addField('ID', message.guild.id, true)
.addField('Owner', message.guild.owner.user.tag, true)
.addField('Member count', message.guild.memberCount, true)
.addField('Members online', message.guild.members.cache.filter(members => members.presence.status != "offline").size, true)
.addField('Bots', message.guild.members.cache.filter(members => members.user.bot === true).size, true)
.addField('Roles', message.guild.roles.cache.size, true)
.addField('Created', message.guild.createdAt, true)
.addField('Verified', message.guild.verified, true)
.addField('Role list', message.guild.roles.cache.map(r => r).join(" ").replace("@everyone", " "))
.setColor(15105570)
return message.channel.send(embedServerInfo);
}
})
error:
same happens with my bot specifically on this server, idk why
oof, maybe they blocked it?
owner is not cached
not sure, but i just checked if the owner==null and if it does itll just not add it to the embed, or you could check if the owner==null and if so then replace it with 'Unknown' or something so at least it returns something without errors
ohhhhh
so just fetch the member by the id
which will return the member if in cache or fetch them if not.
it's a promise, so you'll need to await it
oh ive been having a problem with fetching users by id's since im upgrading from v11 to v12
in v11 i can just do client.users.get('321191321437995009').createdAt, but in v12 if i do client.users.fetch('321191321437995009').createdAt it returns undefined
would i need to await it?
yes
you can one line it though
(await client.users.fetch('321191321437995009')).createdAt
ok ill try that out thanks
or {createdAt} = await
I assume they're doing it in an embed
ig
so addField("owner created at", (await ...).createdAt) is probably the best way to one line it, as I don't think you can destructure it and use it in one line
Though, I've never tried :P
i usually just do everything in the description, so rn i got
var user = await client.users.fetch('321191321437995009').createdAt
console.log(user)
and its giving me undefined
sorry ive never used await before haha
oop nvm i forgot the brackets idk i thought that they wouldnt do anything but i got the response
thanks hahahaah
well you have to fetch the user first before getting its properties
yup makes sense now, thanks to u as well
What's a good lib to use for making requests in python
requests
Async? aiohttp
Sync? requests
So uh
H e y
thinking of a good way to ask my question<
Basically I want to do a phtext command where it sends the image but uh
It sends the file
(discord.js, using the Alexflipnote API)
new Discord.Attacment
Thanks
ohhhh
wdym what os?
yes
Wdym with that like what kind of 'user'
new Discord.Attacment
@restive furnace it's sending the file but I want it to show the image :////
@pure lion
new Eris.MessageAttachment("thing.png")```
(its discord.js, iam just lazy to rename it on my own bot code)
Copy paste cough cough
No cough cough.. Im just messy coder cough cough I make things work first and dont rly care abt weird things, unless it stops working. cough cough
to CF8 ^
here is my code cough cough
case 'phtext':
let loading = await msg.channel.send('Loading...')
let ph = new Discord.MessageAttachment(
`https://api.alexflipnote.dev/pornhub?text=${args[1]}&text2=${args[2]}`, name = "pornhub.png"
)
loading.edit(ph)
break;
ah
wait
okay
hmmmm
message.channel.send("My Bot's message", {files: ["https://i.imgur.com/XxxXxXX.jpg"]});
``` change the imgur link to ph thing
found it
from stackoverflow ofc
@pure lion ^
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
i think i tried that already
what error
Oof
what error
it sent the file
where
i know i asked this before but can i get more information about embed
var embed = new Discord.MessageEmbed()
.setTitle(string)
.addField(string, string)
msg.channel.send(embed)
assuming you use js, my all-seeing-specticles broke
about what
var embed = new Discord.MessageEmbed()
.setTitle(string)
.addField(string, string)
msg.channel.send(embed)
@pure lion
basically i wanna react with an emote thats not a standard emoji
var embed = new Discord.MessageEmbed()
.setTitle(string)
.addField(string, string)
msg.channel.send(embed)
@pure lion thanks
emoji_id: Value "704009611207770192>" is not snowflake.
message.react('id')
my bot is verified 🎉
@frosty swan my bot allready not verified 😭
Not funny.
is codding dicord bot col and fun
i do not know language
He has developer role :d?
yes i have :p
i only know haskel bro
Not u@frosty swan
i use "learn you a haskell for great good" book
Not u@frosty swan
do not ping me
dO NOt PiNg Me
but sir i do knot know if haskell is a god lamguage???
can u make dis cod bot with haskell
if you want help with any subject write dm do not ping me
ok sir
var embed = new Discord.MessageEmbed()
.setTitle(string)
.addField(string, string)
msg.channel.send(embed)
@pure lion
someone can help me: The YouTube API key you provided was not a string.
yes
aferin
😄
: )
: )
@frosty swan where are you from
thank u for help sir
OGO glitch :)
you don't need to know
@frosty swan ok (Türksün gibi geldi)
OGO glitch :)
@restive furnace yes 😄
im using vds
@frosty swan is it website
stop ping me
yes bro
ok
anybody want to make me a logo?
yes bro
@strong tundra thx
i still dont understand diffence between vds and vps
vds is physical hardware i think
ok
vds is physical hardware
@strong tundra can you send me VDS's link (DM)
how can I fix "The YouTube API key you provided was not a string."
no
no
@strong tundra ok
and how I do that
.toString
^
how can i find VDS
where I put .toString
I think VPS is cheaper thsn VDS, since VPS is literally Virtual Machine in Cloud, while VDS is physical hardware according to ruby's knowledge
how do i get the verified bot developer role here?
is VDS Visual Studio Coding
no
ok
thanks for your help
okay I will continue with glitch 😄
update ur packages @rigid maple
how ?
@restive furnace how to fix The YouTube API key you provided was not a string.
show up ur code
also you dont need to ping me since when im online im probably watching this channel
GOOGLE_API_KEY.toString()
update ur packages @rigid maple
@restive furnace how ?
https://google.com/search?q=learn+node.js also as i said before you dont need to ping me.
I am not using node.js
https://prnt.sc/t2mv5a like that ?
yes
oh
module.exports = { GOOGLE_API_KEY: "key here " }
I only have the token in config
ive a discord.py bot on heroku and ive set the config vars how do i access it in my code
well youre importing PREFIX and GOOGLE_API_KEY there
like client.login('thenwhat')?
I think he was talking to Edy
oh lmao
i set the token on heroku config vars
when I type prefix is showing me an error
oh
Heroku puts config vars into env
@royal tree bcs you have only token on ur config file.
ah ic
Missing a comma.
where?
End of line 2
after the token value
ok
@warm marsh it says bot_token not defined
Show your code
using os.environ
The key must be a string
import os
os.environ["bot_token"]
or whatever you called it in config vars
yes yes
still not working
Your imported keys must be the same as the config file.
TOKEN must be "TOKEN" in config.json
ok
is working
thanks
I turned the bot on and now is showing me another error https://prnt.sc/t2need
sure
I'm making emoji to image bot like
if I send h!emoji [emoji], bot sends original emoji image.
but really hard to change this code
( if [emoji] to if h!emoji [emoji])
help! (sorry for my english skill)
// Emoji to image - beta
client.on("message", async message => {
if (message.author.bot) return;
const args = message.content.trim().split(/ +/g);
let emoji = args[0];
emoji = emoji.substring(3, emoji.length - 1);
const emojiarray = emoji.split(':');
const botemoji = client.emojis.cache.get(emojiarray[1]);
if(!botemoji) {
await message.channel.send({files: [
{
attachment: botemoji.url,
name: botemoji.name + '.png'
}
]});
}
When I try to play a song the bot says I am not in a voice channel but I am, https://prnt.sc/t2ntch
yes
uh..
is a old bot
https://github.com/zhycorp/music-bot-example is this that code?
yes
^ clone this code and try again
ok
const pokemon = require("../../dex.json")
module.exports = {
name: "Command name",
category: "Category name",
description: "Command description",
run: (client, message, args) => {
var pkmn = message.content.toString().toLowerCase();
pkmn = pkmn.substring(9);
for(var i=0;i<pokemon.length;i++){
if(pkmn == pokemon[i]._engName.toLowerCase() || pkmn == pokemon[i]._frName.toLowerCase() || pkmn == pokemon[i]._nb){
var text = "__You selected__\n";
text += "**N° "+pokemon[i]._nb+"** \n";
text += "English name: **"+pokemon[i]._engName+"** \n";
text += "French name: **"+pokemon[i]._frName+"** \n";
text += "Type: **"+pokemon[i]._type+" "+pokemon[i]._type2+"**\n";
text += "Catch Ratio: **"+pokemon[i]._catchRate+"**\n\n";
text += "__Base Stats__\n";
text += "HP: **"+pokemon[i]._baseStats._hp+"**\n";
text += "Atk: **"+pokemon[i]._baseStats._atk+"**\n";
text += "Def: **"+pokemon[i]._baseStats._def+"**\n";
text += "S. Atk: **"+pokemon[i]._baseStats._sAtk+"**\n";
text += "S. Def: **"+pokemon[i]._baseStats._sDef+"**\n";
text += "Spd: **"+pokemon[i]._baseStats._spd+"**";
message.reply("whats the text lmao??");
}
}
}
};
hey so i did this right but i want the people to know who did it or make it into an embed
Why are you using .purge instead of just ctx.message.delete

