#development
1 messages · Page 1073 of 1
oh
its just 0x8
not 0x08
the way i do it is user.guilds.filter((e) => e.permissions & 0x2)
@opal plank
oh ok
oh
you should really get a handler because you already have the commands on different files
@honest perch does it work?
but let me check why yours is outputting multiple times rq
@earnest phoenix send the help command
okay
didnt try it wait up
yep that also works
@earnest phoenix also check this afterwards https://discordjs.guide/command-handling/dynamic-commands.html#how-it-works
ok
Hmm im not seeing anything that would loop the command tbh
now i restrated the bot
let me try it
its bot looping rn
but when i edit something in the code
and restart the bot
it does it
so will i literally just have to close VS everytime
vsc
hmmm
you know in cmd
yeah
do i need to stop the bot
though you should use debugger instead
before like editing the code
when the bot goes on, it'll keep that code it was ran with, any edits wont change the bot unless you specifically change the cache
which is a saving grace for reloading commands without having to restart the bot
okay
Thanks
wait so should i do this
for the dynamic commands thing
so instead of this put what i sent above
Because it's a function. Not a property
but it was working a second ago
after looking at Not Erwins command handler
i changed into a proper command handler
and now i get this error
i use it in a embed
Show me the code for the embed
I see. You're using the function. Are you sure the msg.author is defined? Because the error says it's not
If the message isn't cached or it's a partial, and you try to access information without fetching it first
hmm
should i send the whole file?
oh what?
im getting a different error now
it now says that displayAvatarURL is null
so you dont know?
hmm
What does
Math.random()>=0.5 do?
show full code
Math.random gets a random number between 0 and 1
if that's an if statement then it's telling the code that if the number is above 0.5 run whatever code is in it
Math.random() generates a random number between inclusively 0 and exclusively 1
shivaco
So you could say that's used to calculate a 50% chance for something
k thx
if(bot.member.voiceChannel){
return message.channel.send('bot already in a vocal')
}```
``` TypeError: Cannot read property 'voiceChannel' of undefined
0|main | at Object.module.exports.run (/root/juzoo/src/radio.js:9:19)
0|main | at process._tickCallback (internal/process/next_tick.js:68:7)``` 
i searched online for answers (to my question) and i found one stack overflow that had a wrong answer
smh my head
ok so say i open a normal pool connection with mysql2 https://modeus.is-inside.me/UhfVUCUQ.png u would just pass pool around wherever i need yes?
@sand scroll msg.author is null
it says that
@wicked pivot if bot is a Client instance, it does not have the member property.
because it worked before i changed the way i did my command handling
i dont think its a problem with the code itself
maybe it's a problem with my command handling?
with pm2 do you have to add -g to the npm download
You should get the Guild instance then use the .me property instead. Also, .voiceChannel is no longer a thing (.voice.channel).
oh
it says they fixed it in the newest version of discord.js
about message author being null
clearly not though
version 5
but i am version 5
Anyone knows why i am getting this error The request cannot be completed because you have exceeded your <a href="/youtube/v3/getting-started#quota">quota</a>. for youtubes api v3 when not even being close to exceeding there limit.
you're being ratelimited
But how
too many requests
I made 280 requests in this whole day
log the status code
403
yeah i understand that im getting ratelimited
do you have other accounts using the same api key?
youtube has a quota system where each operation costs money
depending on how large your bot is/command usage, you'll hit that rather quickly
i havent used youtube api because of that. While good, it has way too much limitation
quick question... what url should i use to make a get request to get the user object?
278 requests in 24h
it depends what type of requests you are doing
get
what do you use then @opal plank
spotify wrapper would be a better option for search
though i havent used VC much at all
any ideas, erwin?
i use the simple-youtube-api module btw
discord user object, js { username: 'OfficallyLost', id: '475371795185139712' ... }
you want to manually fetch it, correct?
yes
d.js?
discord.js?
im not using a library
yes
axios? curl?

just node-fetch
all i need is the url but i cant find it
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
actually
i think you dont need auth for user
holdon
erwin
at least for public
on youtube?
ye
fat rip, like i said, try spotify instead of youtube
im not trying to connect, im just trying to get the user object form a users id. and all i need is just the url lmao
like
fetch('this thing here'..)
oh
wait
hmmm https://discord.com/api/gateway this is for gateway
im literally retarded
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
🤦♂️
thanks anyways though :)

i might make a library just for my bot for what i need
its pretty simple for specific stuff, i recommend trying it
yeah
im not sure if you even need auth token on that
you might though
nvm you do
just auth token and thats it
just tried
oh right
okay so im very new to coding and things
and like
i dont know how to import discord libraries
or whatever
What language are you using and what's the name of the library you're using.
python
Learn the language you're using pls
Use the import keyword. Search it up for more info.
ok
Learn the language you're using pls
hm
im making an embed in another file
and it says that msg.author is null
and it cant access displayAvatarURL() because of that
any ideas?
supposedly this is a bug in discord.js
hey friends! I'm working on adding music commands to my bot. Right now, it works but you can only play one song at a time. If you use the command again, it'll skip the current song and play the new one. What would be the best way to go about adding a queue to this?
Here's my current code for reference
so uh... does anyone know why im getting this error
?
my code: ```js
await fetch(https://discord.com/api/users/${req.user.id}, {
method: 'GET',
headers: { 'Content-Type': 'application/json' },
authorization: Bot ${process.env.CLIENT_TOKEN}
});
someone knows how user public flags work
@ancient falcon it's a bitmask
to check if a bitmask contains the value use the bitwise AND
ah I see thank you
I'll ask you something. Household Discord Bots also have language support or how do they do it, I make bots, I can do it by adding different commands 😦 Does anyone know who knows how to do something?
if you mean multilingual bots, store language configuration in database, put all your textual data in a strings file or database table/document
use guild id to load correct strings file, load all textual data from there
client.commands = new Discord.Collection();
^
TypeError: Cannot read property 'Collection' of undefined
at Object.<anonymous> (/storage/emulated/0/Discord-TenZO-Bot/index.js:6:31)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47```
can someone help please
can someone send me the code on how to do this command (i did it after 8 hours of reasearching and then i accedently deleted it) but can someone just make the code and send it to me pls
?????????????????????????????????????????????????
if you mean multilingual bots, store language configuration in database, put all your textual data in a strings file or database table/document
@quartz kindle I am Turkish, I will only add the English language, should I do it the same way?
and I don't understand so much
@fallow sentinel the discord.js module does not export an object called Discord. It does export one called Collection, which is what you're looking for.
This is because you're de-structuring it.
let texts = {
english:["hello","bla","etc"],
turkish:["sa","???","."]
}
let lang = database[message.guild.id].language
message.channel.send(texts[lang][0]) // hello in the correct language
@calm meadow i know thats kinda obvious but how do i do it to make it go live. for example if i go to another server and do the samething i want to see the server owner and the members and all that stuff
and if its so easy can u send a screenshot of the codes
i juSt deleted it i already explained that and i can t undo it
let texts = {
english:["hello","bla","etc"],
turkish:["sa","???","."]
}
let lang = database[message.guild.id].language
message.channel.send(texts[lang][0]) // hello in the correct language
@quartz kindle THANK YOU ❤️
yeah and i told you to rewrite it
Recycling bin 
i just dont want to spend half a day looking foor nothing again so thats why i am asking help
but you won't
i did
what
and its anoying'
Recycling bin
@unborn haven
you already know what you need to do now
i dont because i deleted the whole thing accedenly and when i mean the whole thing i mean the WHOLE BOT because my smaller brother flipen deleted my project that took me like 3 weeks to make
yes but the reasearch was like few weeks ago
K imma just stop trying
i have search history from 6 months ago
and my flippen brother deleted the bot today
hey small update on my progress concerning the language changing thing : i learnt how to use mysql, integrated the auto updating table (it adds the server in the list when the bot join it, delete it when he leave and the name is changed in the list if it's changed)
now i "just" have to make the actual language thing, it needs to detect whenever the server is in french or english when a command is typed, so it'll display the corresponding one. and the language changing thing
and i'll be done
so thanks to the guys that helped me earlier
id advise not automatically deciding what language
to use
use english by default and let the user configure it
and if its so easy can u send a screenshot of the codes
@unborn haven ...
https://github.com/MujyKun/IreneBot/blob/25d32af213094ddee646e9e523d42f41b2a220aa/module/Miscellaneous.py#L322
if you actually wrote it, you would know how to rewrite it
and u never even specified which language either

or which framework
they're lying if it wasn't obvious already i was just playing along to make them trip on their own lies lol
@earnest phoenix I was saying like it will look the database to see if the server is in english or french and then use the french or english command. But yeah, that's exactly what i'm gonna do
they're lying if it wasn't obvious already
@earnest phoenix
yeah it's obvious, but they clearly don't know what they are doing. hopefully they learn something from looking at an example of the code
i sincerely doubt it, there is a small chance but these people are help vampires, they refuse to learn and only want the code lol
another question if anyone knows, i've got this: js const e = await lost.getUser(req.user.id).then((e) => e); console.log(e.id); and i get an error saying e is undefined, any ideas why this is happening?
If they’re using discord.js the starting guide quite literally tells you how to do things like that. So like. 🤦🏻♀️
@calm meadow and if u can read for ike the 3rd time the BOT GOT DELETED SO NO i cant send the codes and u were saying its so easy i wasnt i was asking for help
no I'm saying
the bot got deleted
ok
just code it again
why ask someone else to code your bot again?
if you did it once, just do it again
i do not hve a backup
I can't count how many times I've had to redo my entire bot because my dumbass doesn't back his shit up either
code it again. No one here is going to do it for you
u think i can remember a bunch of characters or how to code one command in 3 weeks NO
I'll do it for $200
I'll do it for $150
i am not paying anybody nothin
i am not paying anybody nothin
@unborn haven
then code it yourself
i swear to god
☝️
omg
also I literally linked an example with discord.py framework
you can use that for reference
if you want
https://discordjs.guide/ here's discord.js if you're using javascript
it was 3 weeks ago i did that code, today my dumbass brother deleted my bot
and u expect me to remember that
You can either do it yourself or not do it at all. Because no one here is doing it for you
what is the offer, go on
Here. I'll even point you to the correct portion of the discord.js that shows you an example of what you want
You have to do the rest on your own
so uh, anyone know my issue?
await lost.getUser(req.user.id).then((e) => e); is undefined for some reason.
im not using a library btw
it was working perfectly fine before i put it into classes, and now its not
I have no clue tbh. I hope someone else here can help ;-;
what is lost?
@calm meadow @sonic copper sry i didn't realise that u guys sent me examples i was just getting carried away cause i still cant beleive my fu**ing brother deleted my bot that i spent almost a month on
const Client = require('../classes/Client');
const lost = new Client();```
btw, you should do this as far as I know
var e = await lost.getUser(req.user.id);
or lost.getUser(req.user.id).then((e) => e);
wut
hey huh
how do i get my data from MYSQL to my code ?
I need to get the "language" from my table and if it's english then change it to french and vice versa.
But when i try this :
con.query("SELECT language FROM serveurs WHERE serverid = '" + message.guild.id + "'", function (err, rows) {
if (err) {
console.log(err.message);
}
const embed = new MessageEmbed()
.setColor(0x854a96)
.setDescription(rows);
message.channel.send(embed);
});
it writes "undefined"
apparently i need to make a callback
but i have no idea how to do a callback
Do you mean it sends an embed saying undefined
exactly
Does it log anything to the console
Are you using MySQL?
To my knowledge, would rows not be an array?
idk
.setDescription takes anything that can be resolved into a string, which does include arrays (it would be split by a line break). You could try logging err and rows to the console to see what you're getting.
all the arguments you have in the function
you just need to add a ")" at the end
and you need to removes the quotes and the {} before and after the variables
so it should be : ```js
embed.add_field(name="Owner", value=guild.owner + ' (' + guild.owner.id + ')', inline=True)
here are the syntax errors
but idk if there are logic errors
@sudden geyser i'm getting this in the console
so like this?
yeah, do you get any error if you run it like this ?
ok
so i have to change all of these the same way?
you should better try writing it like this :
const embed = new MessageEmbed()
.addField('Things:', variable1 +'non variable' )
message.channel.send(embed);
like the last one of your screenshot
np
: )
iam running js
!
?
so i'm not dumb
ok wtf
Yeah I got some serious python vibes from that code.
This is not JavaScript: https://canary.discordapp.com/channels/264445053596991498/272764566411149314/734932138939515022
sigh plague. I thought we talked about this
what
yes index.js or node .
learn to code
you probably want to learn javascript and node

So your coding in January?
*js
Here’s the js guide on embeds.
I highly recommend reading through the entire guide though. It’s a good starting place
learn JS first smh
@bot.command()
async def embed(ctx, *, a):
await ctx.message.delete()
embed=discord.Embed(title=f"{a}", color=0xffc8ff)
await ctx.send(content="", embed=embed)
oop wrong code
im a little retarded, bye
bye?
@bot.command(name='clear', help='clears messages [default 5]')
@commands.has_permissions(manage_messages=True)
async def clear_messages(ctx, amount=5):
await ctx.channel.purge(limit=amount+1)
print(f'Cleared {amount} messages. command by {ctx.author}.')
hi
catnip what
wtf catnip
no simple embeds are like i showed you
const embed = new MessageEmbed()
.setColor(0x854a96)
.setTitle('Voici la liste des commandes :')
.setThumbnail(client.user.displayAvatarURL)
.addField('- Modération :', 'ban, kick, say, sayembed')
.addField('- Utilitaires :', 'ping, userinfo, avatar, pf, dé, time, bot-infos, app-infos')
.addField('- Fun :', 'choix, propagande, rdude, sextests, décris-moi, blague, anti-dépresseur')
.addField('- Musique :', 'join, leave, en cours de développement...')
.setFooter('Pour avoir plus d\'informations sur une commande faites : *help <commande>')
message.channel.send(embed);
(don't mind the french language)
what are you two even talking about
pluquechop was having trouble with embed, because he was using python code on js file lmao
I think your issue is just you trying to pass something that's not StringResolvable
Guys, what's the permission to removing reaction, adding reaction is ADD_REACTIONS but what removing them?
Why does nobody here know how to code properly

rows should be an array but seems to be a custom type. Either way, you should realistically be passing a string.
Rigidity you have made me sad with this message.
not you lmfao
i mean most of the scriptkiddies here
the ones without green name
or purple or red
<You also have the green name>
But hidden
meeeh i don't have the green name :c
im saying 95% of people without roles here dont know jack shit
lmao

Me sitting here watching people not being able to do anything with code while me creating complex functions and bots on just mobile

The role doesn't mean anything really.
Thx Lite btw
yeah np
@earnest phoenix same tho
you code on your phone as well?
Mobile gang 
Guys, what's the permission to removing reaction, adding reaction is
ADD_REACTIONSbut what removing them?
@earnest phoenix anyway idea?
@earnest phoenix hell yea mobile gang
My fingers are too fat to code on mobile.
hehe
coding on phone uncomfortable as hell
Manage Messages
If you want to remove other people's reactions.
You should be able to remove your own regardless to my knowledge.
The bot is just a user. It shouldn't be any different
yup
Uhh... I mean... Bot removing it's own reactions Should't need permissions Should it
no
bot adding reactions is the only thing that requires perms
same for users
We all know bots are users, just doesn't have access to user endpoints @sudden geyser
Which apps do you use Voltrex
For mobile dev
I use Koder and iTerminal
Rigidity is right
Bots and users both share similar endpoints. Some endpoints just can't be accessed by bots while some can't be accessed by users.
Keyboard go brrrr
Ik about reactions, but i think every reaction has it's own object containing users who reacted in the reactions property of the message
Filter to remove the reaction of the bot itself?
all endpoints can be accessed by users
assuming their authorised to do so anyways
ie. have the correct permission
No, users can't send embeds can they
oh lol. apart from that
Only self bots can
does anyone know how to fix my issue, also?
Filter to remove the reaction of the bot itself?
@earnest phoenix a bit confused. do you mean you want to remove only your bot's reaction to a message? For example, if three users reacted with 🎉 and you wanted to remove your bot's reaction, would it go down to 2, or remove all three of them.
What's the issue you're having
i posted it a while back, its just that ```js
await lost.getUser(req.user.id).then((e) => e);
lost is my client, nothing to do with d.js or eris or any of that.
and that code returns undefined for some reason
@sudden geyser
"reaction of the bot itself", of course only the bot's reaction
if (user who reacted.id == client.user.id) return; ?
I wonder why are you using await and .then() at the same time
They both resolve a promise
reaction.users.remove(user)?
idk its weird. i done await client.getRESTUser(user id).then((e) => e); for it to work for eris, nothing else would work. and im trying to implement the same logic here
Then you're probably looking for <ReactionManager>.get(...).users.remove(...)
Though .get takes a snowflake and for a reaction that's quite weird
No because it's a literal collection, collection.get takes the element name
From the map of the collection of course
for more context: ```js
const Client = require('../classes/Client');
const lost = new Client();
@client.command()
async def poll(ctx):
if str(ctx.author) == "penche#7432" or str(ctx.author) == "SWAGHETTI#7791" or str(ctx.author) == "Winter#7588":
message = await ctx.send("**----POLL----** \n \n**Green Today?** :thumbsup: \n \n**Red Today?** :thumbsdown:")
await message.add_reaction('👍')
await message.add_reaction('👎')
thumbs_up_count = 0
thumbs_down_count = 0
message_id = await message.channel.fetch_message(message.id)
for second in range(20):
for reaction in message_id.reactions:
if reaction.emoji == '👍':
thumbs_up_count = reaction.count
if reaction.emoji == '👎':
thumbs_up_count = reaction.count
await message.edit(content=("**----POLL----** \n \n**Green Today?** :thumbsup: {} \n \n**Red Today?** :thumbsdown: {}".format(thumbs_up_count,thumbs_down_count)))
hello I am trying to create a bot that makes a poll. it adds the emojis, and when people start voting thumbs up or down it edits the message with the results. this is what i have but it's not really working cause it just goes back to 1 even though its 2 thumbs up. any ideas?
ok so now i have everything i just need do copy paste and translate things, thanks a lot
How do I get bots in my sever
like your own?
Yeah
Hallo
hey
i got this error
C:\Users\ASUS\Desktop\bot discord\src\Client.js:139
const command = new Command(this); // Instantiate the specific command
^
TypeError: Command is not a constructor
at C:\Users\ASUS\Desktop\bot discord\src\Client.js:139:25
at Array.forEach (<anonymous>)
at C:\Users\ASUS\Desktop\bot discord\src\Client.js:137:16
at Array.forEach (<anonymous>)
at Client.loadCommands (C:\Users\ASUS\Desktop\bot discord\src\Client.js:135:56)
at init (C:\Users\ASUS\Desktop\bot discord\app.js:21:10)
at Object.<anonymous> (C:\Users\ASUS\Desktop\bot discord\app.js:26:1)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
this
how can i fix it
i add weather command in my bot
How do I get a bot to welcome people
pulse you have to actually do work lol
if u cant google you fucked when it comes to coding
can some one help me
mlem what is Command
nope
weather
nobody is gonna code for you man.
unless they bored as fuck with no other option lol
yeah sorry dude
mlem what is
Command
@sudden geyser const weather = require('weather-js');
const discord = require('discord.js')
const Command = require('../Command.js');
module.exports = {
name: "weather",
description: "Weather of City",
usage: "weather",
category: "utility",
run: async (bot, message, args) => {
if (!args.length) {
return message.channel.send("
| Please give the weather location")
}
weather.find({ search: args.join(" "), degreeType: 'C' }, function(err, result) {
try {
let embed = new discord.MessageEmbed()
.setTitle(`Weather - ${result[0].location.name}`)
.setColor("#ff2050")
.setDescription("Temperature units can may be differ some time")
.addField("Temperature", `${result[0].current.temperature} Celcius`, true)
.addField("Sky Text", result[0].current.skytext, true)
.addField("Humidity", result[0].current.humidity, true)
.addField("Wind Speed", result[0].current.windspeed, true) //What about image
.addField("Observation Time", result[0].current.observationtime, true)
.addField("Wind Display", result[0].current.winddisplay, true)
.setThumbnail(result[0].current.imageUrl);
message.channel.send(embed)
} catch (err) {
return message.channel.send(" | Unable To Get the data of Given location")
}
});
}
}
it’s always fun to learn tho
people dont wanna learn
that's not really what it is
is a weather commands
Go to src\Client.js, line 139 at column 25
That's where your error is coming from.
I assume that's some sort of command handler.
so anyone got an idea..... on that poll idea....
where @sudden geyser
this may be the issue.
how to fix
1. You're trying to declare another const variable as the same name. You can't do that with const.
2. It seems you're trying to export an object in your class; not a class called Command. Using the new keyword on it does not make sense.
he isn't
one is named Command and the other one is command
the C is not equal
and js is case sensitive
ah I thought I read them both as the same
the problem is
that Command is not a constructor
where did you get that code from
that seems like a complex system
that someone on https://stackoverflow.com made
from this
so you copied it and expected it to work right out of the box
can anyone help me with this, js console.log(lost.getUser(req.user.id) .then((e) => { console.log(e); return e; }).then((e) => { console.log(e); }).catch((e) => { console.error(e); })); its returning undefined for some reason... no idea why
@hazy blade yeah no, nobody will give you code like that, learn to code, you'll see it isn't even half hard
ok
@digital ibex you can't just directly log a promise to the console, because the meaning of promise would be useless there
You resolve the promise first then log
Not directly log a promise
e is not a promise, it's the resolved response of the promise that you resolved
@hazy blade what is with this code its so complicated for something so simple
@old pilot by an eval obviously
Uhh, you don't have to use eval() in every language to evaluate something I'm pretty sure
Just got pagination working and its an optional thing for the help command with the handler. Also I replaced the discord permission system for command access with something like minecraft plugins. Am proud
Am using Go with a custom library i made :p
pagination is pretty easy with dpy tbh
ah
Is it bad that i literally see nothing more than a pitch black screen on the video you sent @zinc condor
it is bad
dont you just have to handle the events and send a few post requests to add the reactions

The thing is i made a function for js users to make pagination more easier, currently 30 people using it
yeah mostly, mine does timeouts when you dont react in a certain time limit and a fast travel one so it keeps each embed in a slice and just traverses it
rapptz made one for dpy but uhhh (it kinda sucks ngl)
its a bit harder when you are more low level
but yeh i remade permission system in minecraft so its like
+akko.general.help - help command permission
-akko.general.* - disable access to all general permissions
so yeh i think its nicer
I am a bot

fair
I was about to say exactly that "fair"
this is not discord related but when i try to print a custom font like this --> print("𝙈𝙖𝙜𝙣𝙪𝙨 𝙎𝙬𝙖𝙥 𝙏𝙪𝙧𝙗𝙤") it comes up like this:
any idea how to fix it? python btw..
download the font?
oh is that not on an editor
ah then i have no clues how that works
Ite
Heyo how do i upgrade from discordjs 6 to discordjs 12?
@earnest phoenix your console font doesn't support it
use windows terminal and it'll probably show up
if you want fancy fonts in the console just use ascii art
@earnest phoenix rewrite the whole thing
Oh
Uh
Ok
Can someone join my sever so ik if my bots are working
Correctly
@flint python make an alt
does anyone know why im getting this error? { message: '400: Bad Request', code: 0 }
what im doing is await lost.editNickame(guild.id, req.body.nickname);
the editNickname method: ```js
async changeNick(guildID, newNickname) {
const fetch = require('node-fetch');
const nick = await fetch(https://discord.com/api/guilds/${guildID}/members/@me/nick, {
method: 'patch',
headers: { 'Content-Type': 'application/json', Authorization: Bot ${process.env.CLIENT_TOKEN}}
}).then((e) => e.json());
return nick;
}
instead of Bot
Bearer <token>
oh
wait
did you check the payload they want?
a string?
it doesn't say
then why are you sending that
I'll try to find something
but I've got to finish my homework for tomorrow
maybe try with x-www-form-urlencoded
kk
well I've never interacted directly with the discord api actually
so why don't you check how they do it in d.js
oh
good idea
if this doesn't work anyways
lol
to d.js's source code i go
ok no
to eris' source code i go
you have nothing in the body
i did
unless im blind that code doesn't define the body anywhere
what i done was js headers: { 'Content-Type': 'x-www-form-urlencoded', Authorization: `Bot ${process.env.CLIENT_TOKEN}`}
oh im stupid
also the content type does need to be app/json
yes
and if you look back at the docs it asks for json params
you send a json object in the body
o ok
i done js method: 'PATCH', headers: { Authorization: `Bot ${process.env.CLIENT_TOKEN}` }, body: { 'Content-Type': 'x-www-form-urlencoded' } am i not doing it correctly?
it says the same thing
application/json
what
kk
content-type is a header
tbh I needed something to say to get out of here lmao
why are you sending it in the body
look at the docs
a simple json object with a nick property
so ```js
async changeNick(guildID, newNickname) {
const fetch = require('node-fetch');
const nick = await fetch(https://discord.com/api/guilds/${guildID}/members/@me/nick, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json', Authorization: Bot ${process.env.CLIENT_TOKEN} },
body: { nick: newNickname }
}).then((e) => e.json());
return nick;
}
lol
{ message: '400: Bad Request', code: 0 } same thing
your body has to be a string
How to implement discord rich presence on android app
the body itself
yeah, his is what idoen
not the nick param's value lmao
await lost.changeNick(guild.id, req.body.username);
not that
?
How to implement discord rich presence on android app
@vapid jacinth i'm pretty sure you can't, rp on android is limited to a few verified apps
oh ok
that's what you want as the body
the body itself must be a string
remember that the JSON object exists
and it has a lot of useful methods
such as stringify
for a simple object like that just construct the string yourself, stringifying objects is slow
i done
const nick = await lost.changeNick(guild.id, req.body.username);
console.log(nick);
and it logs { nick: null }
then you sent null as your nick
i put hi, lemme try again
log your variables, don't guess
@stable nimbus yes, what do you need help with
@sonic lodge I got things rolling so far, but I need help mainly getting the command to be a toggle, do you use js?
i do, and wdym a toggle?
So I want the command to create an entry if it doesn’t exist, and to remove it if it does.
Do you mind if I dm?
sure
How do I make a reaction role code?
I'm trying to make a code for it but I'm unsure
what language
no clues
no your in the right channel @earnest phoenix
Oh! Ok!
What r u thinking of doing @earnest phoenix
Like I'm trying to do reaction roles and all the codes don't make sense and the docs are either outdated
The process
on the messageReactionAdd event, look for x emoji, and if it is x emoji, add the role
check for the message too lol
U have to get the emote and map it to the role id and then whenever a user reacts on that message u have to use addRole
I guess
and also check if you have permission or it will error
Ok thanks! Its for a server that I'm using--
Hmm see how a bot uses reaction roles first @earnest phoenix
Maybe yui bot
That'll give u an idea
its pretty simple to be honest
Yep
Its sometimes hard to code but I use things like Carl-Bot and Reacton Roles
I mean decide on the process how u wanna add the reaction role command.. Like how u will get emotes and role id from user
What message will be displayed
etc.
You can just have a json where you have
message_id: {
reaction_emote: role_id
}```
simplest way
Yeah
And message_text
Or whatever u wanna add
First u get all that then code the action when user reacts on that message
he so
yesterday i wrote about my problem here
and it was about my bot going online and offline continuously after being approved
i am hosting in heroku for free
so i downloaded the file from GitHub and run in local
so idk y but the bot is online
but no command works
also there isn't any on_ready messages in the terminal
its possible that the bot is rate limited
wdym?
listen to the debug event and see if your bot got ratelimited
okay
if you bot constantly tryed to relogin its possible that the API locked you out bcs of spamm
Connected to pydev debugger (build 183.6156.16)
``` but i don't remember spamming
if you bot was running over night and something caused it to constantly try to login again it can cause it (happened to me once)
you have to wait for up to 12 hours. and Ive added a limitation about how many times pm2 tryes to login again and added a delay of 10 seconds between the logins
does the console say its ratelimited?
empty
this depends on your code and if you use pm2 for running node stuff
i am using python
then idk
oh okay
thank you
did you login after your client got logged out?
wot?
you could add a delay between the logins
you can login the client after it got logged out
in the bot? or heroku ?
if you got a credit card Amazon AWS offers 1 year free for a small VPS
or Google also offers a Free VPS
but google is slow
well the free VPS is not the most powerfull in the world and limited to the Host Region US
oh
so i just got the ready messages but no command works
and the bot goes online and offline too (ping me if u can help me please)
Is there a JavaScript function that rounds up the decimals and only keep it’s tenths? Because sometimes I add a number by 1.3 and it becomes like 2.99999999999997 for no reason.
round them up then
hey
someone know how i make that if someone do the command and dont write anything after that the bot wont crash?
??????
?
😳
someone know how i make that if someone do the command and dont write anything after that the bot wont crash?
@stiff stream
could've just put 4
^
where?
you should use args
Definitely
you can easily check them
And don't do some weird gay split method it's just ' '
Like the fuck is a / +g/
Or whatever that weird youtuber guy who everyone watches and is a noob does
so that "hi yes" becomes ["hi", "yes"] and not ["hi", " ", " ", " "..., "yes"]
@pale vessel
someone know how i make that if someone do the command and dont write anything after that the bot wont crash?
also heroku is crap
@lusty quest
Yeah. The free Dyno hours thing.
i want it that if someone dont say anything after that it will respond
And the paid versions are expensive.
check the message content first or use args
?
Just do a timeout and return from the function after that @stiff stream
anyone can help me make anti spam and link?
@jolly quail how do i make timeout function?
I can only help with js
setTimeout()
k
just setTimeout()?
@jolly quail can you help me make the anti link and spam
@stiff stream .setTimeout()
like 1000 is 1 sec right?
setTimeout(function,time in ms)
Ya
Just read the docs
Whole function would have to be put inside settimeout
@clever vector idk..
i put that there?
Nah
lost line
Not like that
so how?
k
like 1000 is 1 sec right?
@stiff stream yes
Time is mostly specified in ms so Yeah
setTimeout(function () {
}, 3000);```
setTimeout(function,time in ms)
@jolly quail
@jolly quail thats will work too right?
@jolly quail thats will work too right?
@stiff stream why not
I was thinking like declare a variable x and set to 0.. If u get a response.. Set it to 1
ok
Inside the settimeout check if x is 0
let me try
wait let me change the arg[0] to 1
Idk how much u got out of what i said xD
Well it's just my solution... U can ask others if u want
Cuz i gtg
Cya
how do i get the guild name?
@earnest phoenix
(message.guild.name, message.guild.iconURL())
the first one is for name
and second for server logo
@earnest phoenix
my error
if(command === "pokemon"){
const { get } = require("request-promise-native");
const { MessageEmbed } = require("discord.js")
const args = msg.content.split(" ");
let pokename = args[1].slice.join("")
const options = {
url: `https://courses.cs.washington.edu/courses/cse154/webservices/pokedex/pokedex.php?pokemon=${pokename}`,
json: true
}
msg.channel.send("Fetching Informtion for API").then(msg => {
get(options).then(body => {
let embed = new MessageEmbed()
.setAuthor(body.name, `https://courses.cs.washington.edu/courses/cse154/webservices/pokedex/${body.images.typeIcon}`)
.setDescription(body.info.description)
.setThumbnail(`https://courses.cs.washington.edu/courses/cse154/webservices/pokedex/${body.images.photo}`)
.setColor("#ff2050")
.setFooter(`Weakness of pokemon - ${body.info.weakness}`, `https://courses.cs.washington.edu/courses/cse154/webservices/pokedex/${body.images.weaknessIcon}`)
msg.channel.send(embed)
msg.delete()
})
})
}
```
code
try arg[0]
i did
MessageDeleted}) .tygey 3}
why is not deleting the you need to type the announcement that you want to send. after 3 seconds?
?
yes
Hmm
Ur deleting which message exactly
The message u sent and message.delete are different messages
@stiff stream i will only delete the message you send
why is not deleting the
you need to type the announcement that you want to send.after 3 seconds?
@stiff stream wtf that is deleting a message called 3000 and not wating 3000 seconds and deleting
ohhhh
NO SPOONFEEDING I WILL DO
.then((message) => {
setTimeout(function() {
message.delete()
}, 3000)})
``` i think this will do
ty
np




