#development
1 messages · Page 565 of 1
Save the message object as a vaiable to refer to it later then you can edit it
so how could I restart my bot a long with the commands so the saved changes to the code takes effect?
hmm everytime I try to search voice receiver I get dbl ads for @drowsy fjord
let message = msg.channel.send("Hello world");
message.edit("Hello world 2").then(() => {
message.edit("Hello world 3");
});```
:(
@lusty dew could just make a reload command
Hm
or nodemon if you don't want to use a process manager
How would I do that?
but I'd recommend the process manager
Last time I made something like that
it didn't actually work
It said it reloaded the command but it didn;t
i use pm2
npm i -g pm2
pm2 start yourbot.js --watch .
But I want to like make 2 s before editing message?
Whom are you talking to?
@lusty dew you
Ah o
@earnest phoenix setTimeout
ok
In js anyways
I send code
how exactly does pm2 work though?
It runs as a daemon/service process
and then runs your nodejs processes underneath it
message.channel.send(`*lol*`)
.then((msg)=>{
setTimeout(function(){
msg.edit('*haah*');
}, 1000)}).then((mssg) => {
mssg.edit(`Gotttem`);
}, 1000)}
}```
also Bots, like this:
let message = msg.channel.send("Hello world");
message.edit("Hello world 2").then(() => {
setTimeout(() => {
message.edit("Hello world 3");
}, 2000);
});```
i want to do 3-4 times
So would it stop working if my computer went to sleep?
you don't really have to wait for the .then() but it's good practice
yes it would
nothing runs if your computer is asleep
Do you have anything else you could run it on?
If it's a lightweight bot you could even just buy a raspberry pi ($35 for the most expensive model) and run it on that
or $5 for the cheapest but I'm not sure how well that would run a bot
A vps cost $3 tho
if its a lightweight bot, even glitch/heroku can run it
rpi is a one-time investment and can be repurposed later
if you're the one paying electricity bills, a vps will be cheaper than a pi
I have $0 so ima have to try and make glitch or heroku work somehow
and yea, vps internet is a gazillion times better than any home internet out there
unless you're on like 1gb/1gb fiber

even then unless you have business internet it's probably can be against your ISP ToS to run a discord bot
wut
Never heard that one before
home-grade internet can have clauses saying you can't run an external service someone else can access
what kind of ISP would disallow people to run home-based services/servers? wtf
Mine for one 
it's a bit of a gray area for discord bots since you're not actually hosting a serivce so much as communicating with discord, but you should probably still check
you don't have third parties accessing your stuff if you run a discord bot
it's just outbound connections
technically, there is no difference between a discord client and a discord bot, as far as networking is concerned
the discord app uses the same websocket system as a discord bot
other than that a bot on thousands of servers would generate a lot more traffic
and since encryption is a thing they can't detect if it's a client or a bot
yeah, if your isp doesnt offer unlimited data
you're most likely screwed
my bot uses about 10gb/mo on 600 guilds
Think about the bandwidth 😢
plus if you get a vps in a big datacenter you're more likely to be closer to a discord server, or at least have a bigger pipe connecting you to it, which can result in lower ping for your bot
yup, which is very important
thats where the gateway is?
I'd rather not spend two weeks in traffic a day
no
^
i tried to authorize my bot, but its not showing up on the my bots page. Any help?
Soemone know how to add role to specific badge?
if(message.author.premium) return console.log('Is it') return undefined
i've made a mod mail bot but am wondering what people would suggest as the best way for the user to identify what guild to send the message to
i could use IDs, ie send [id] [message..], however IDs arent user friendly
my question?
then let someone else answer it, you dont have to
sorry for disturbing
but does anyone has a way to put an image inside an image with jimp?
im making a profile command
is password = webhook token in api
huh
lanes$help
Someone know how to code a stats api for Brawlstars game?
does this game have a public api?
it doesnt
after a quick search i have found 2 broken apis for the game
none of them work
not anymore*
This api is currently down 😦
I want to create my own api to remove down moment.
Because i’m the first brawlstars statistics bot atm 👀
well, where are you going to take the data from?
^
is there any official website that has the data you need?
Just sweet talk supercell till they give you access to player stats 
I alrzady took the data from brawlapi.cf and statsbrawl
But this two websites are down 5h a day.
how do they get the data tho? they are not official are they?
I don't think they are
Unofficial api yes
so find out where they get the data from
They don’t want to tell me 😭
I already google this for 10h x)
But i found nothing
I think, when you have the beginning, after it’s easier
No x)
And they have a discord bot as well
Hello cuties,
Are the rate limits for sending messages per guild?
I'm wondering because, would it be possible for the bot to get ratelimited if a guild is very actively using the bot 👀
Got an answer nvm
Hey I'm planning on buying a VPS on OVH but can it host a mysql database? And what should I take like Ubuntu or what?
any vps can host a database
but you need to install it and set it up yourself
ubuntu is a standard choice yes, i believe most people use it
If I am using heroku and github, if I already deployed my project and it's running on heroku , will it stop if I deleted the files on github?
I have heroku performance L
Rtfd
Hey so Im trying to edit an embed with a command to be able to edit any embed message. It works as Im only trying to edit the body of the embed, only trouble Im having is that I want the properties of the original title, color, etc to stay the same but only edit what I write in so "body"
Clone, edit
in worst case scenario you can always just recreate the same embed with the changes you want to edit it
I posted my bot this morning and I waited almost all day to check
Please see
@earnest phoenix
@earnest phoenix hi
Ok.
so what's your code
DMs.
I’ll show it.
@earnest phoenix just do it here so other people who are scrambling with the same situation will get help easily by searching.
IDK>
Would it be safe to just use .hasPermissions("KICK_MEMBERS") to check for if someone has mod status
are you actually writing code in google docs
My friends been over for the week while his parents were splitting up, he coded it, he left..
idk what it is tho
con.query("SELECT * FROM counter;", (err, results, fields) => {
if(err) {
utils.log(err, true)
}
id = results[0].counter + 1
})
i have a variable set here id but when i use it somehow it says its undefined
con.query({
sql: "INSERT INTO thing (userID, option, id) VALUES (?, ?, ?)",
values: [uid, args[0], id]
}, (err, results, fields) => {
if(err) {
utils.log(err, true)
}
})
when it inserts into the table it is null, which means its undefined
but if i do something like msg.channel.createMessage(id) its not undefined?
pls explain because im dumb
dont code in google docs
best ide
move the code that depends on id inside the callback
idk what that means. My friend made this. I just want to know how to get it online and what its prefix is... can someone dm me.
Can someone pls help
put the code on hastebin```
So I'm trying to add the ability to change prefix.
And I'm using the code: if (message.member.hasPermissions("KICK_MEMBERS")) {}
To check for mod status for it.
Will this work or is there something else to use?
Usually people use manage server, dont they?
your preference
Could change to manage server instead and have it say you need that perm to use the command
how long can author names be?
2-32 characters
Can someone help me? My friend made this code: https://pastebin.com/raw/u02u4rVs I don't know how to work it or get the bot online.
make it yourself
I can't code...
then learn
Mate, I'm just asking for simple help..
mate, im telling you your friend cant code for you all the time
hy
pls
We wont spoonfeed and we cant help if you dont know what your doing a small bit
^
Did I come at a bad time?
I do! I just can't find the prefix.
but before you said you dont know how to code
👀
shh
Oof
🤦
take a python course and code the bot yourself
NVm
what are the max amount of characters for a description in an embed
2048 iirc
a message can have 2k chars
wait what
A user message can have 2000 characters
If your good with python pls dm me. I need help.
I think its because he wants code, not help.
Got the code set up (and db) for changing prefix but when I tried changing it as a test it didnt actually work.
Using discord.js and mongo for the db
Can show the code if needed cause got a repo set up with the main file in
Looks like it's missing required libs
if yes you won't know how to download requirements
DMs.
No
Alright
If you are good with python can you please help me? (DMS) I have a code with an error, and need help fixing it.
1)No
2)You've been asked to learn how to code before you actually do so, and looks like you are copy coding since you don't even know how to download the lib requirements (sorry if this is too har for you but if you want to be better at coding, you need to learn).
I'm just asking for simple help, I don't want to fully learn coding just to fix this error.
I mean if you're not willing to learn then how can we help
@earnest phoenix nobody will help you if you don't actually learn the language
Nevermind, I figured it out.
Don't copy paste code
Is it alright if I post a github link to my bots code?
Need someone to check and see if I've done something wrong cause cant change prefixes. But nothing is crashing so...
Also its using discord.js and mongo
Yeah
Sure
Alright got what's wrong
Mongo is async so it returns the value after the message gets sent
let's say i have an array of objects, like this
const objects = [{"e": 10, "respects": 69}, {"e": 23, "respects": 13}]
``` how could i make a field for each object in the array?
a for loop?
you mean add each of them to an embed as a field?
yes
objects.forEach(item => {
embed.addField(item.e,item.respects)
})``` ?
or whatever the embed constructor is
i dont use rich embeds i just use the embed option for createMessage
you make a literal embed object?
yes
let embed = {};
objects.forEach(item => {
embed.addField(item.e,item.respects)
})
same thing
wew
just instead of the addField
you set the fields yourself
wheres that embed visualizer
brb
yeah that
I need help with oauth. I'm trying to make my bot's invite to redirect to a page. under scopes I selected bot, under bot perms I selected admin, under redirect url I selected the url I need. I copied the link, but it still doesn't redirect after authorizing. Can I post the link? in `` thingies of course
let embed = {fields:[]};
objects.forEach(item => {
embed.fields.push({name:item.e,value:item.respects})
})```
25
wut
the fuc
Integrate your service with Discord — whether it's a bot or a game or your whatever you wildest imagination can come up with.
lol
If you are good with python, Please DM me. I need help with some errors.
you're annoying
Me?
i've been working on this damn project for 5 hours now, everytime i look here you are asking for help in dms
Mate, ive asked 2x.
I just need help lolzo.
I'm still a little new to Vim, and I try to do this:
- I open my
.vimrcfile and paste this: ```
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree'
Plug 'morhetz/gruvbox'
Plug 'vim-airline/vim-airline'
Plug 'valloric/youcompleteme'
Plug 'mattn/emmet-vim'
Plug 'w0rp/ale'
Plug 'pangloss/vim-javascript'
syntax on
filetype plugin indent on2. Then, I go do the install command. 3. At the very end, this command pops up, and it pops up every time I open vim.sh
Vim: Caught deadly signal SEGV
Error detected while processing function <SNR>50_PollServerReady[7]..<SNR>50_Pyeval:Vim: Finished.
line 4:
Exception MemoryError: MemoryError() in <module 'threading' from '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.pyc'> ignored
Segmentation fault: 11```
Yeah! I'm just trying get it answered and no one will.
because the answer is not simple
and requires you to know what you're doing to understand it
and you refuse to learn, so...
¯_(ツ)_/¯
@opaque eagle are you on mac os?
yes
i googled it and it seems to be a common problem in mac os
oh
have you tried reading stuff like this? https://github.com/powerline/powerline/issues/1947
I did see it, but I really understand what it talked aabout
Never used Python before
i've never used vim, and i dont have a mac, so i cant help
but it seems that many people had problems with vim plugins after updating mac
https://paste.tscforum.com/pvfexlasgg.coffeescript Does anyone think this would work?
It is supposed to do
if the coin Multiplier they have = 1x then it won't double the coins and it will show the normal embed
but if they have 2x multiplier it will show the 2x embed
and show the multiplied coins
well, have you tested it?
Yea got no errors
but I fixed it
:>
My next thing is making the coin multiplier part
Also
That brings me to my next question
I am trying to make a shop to buy the Coin multiplier
and I am trying to give the items ID's
so people can say the ID of the item and buy it
But how could I make the item ID's?
like an arbitrary unique id?
Well
Coinmultiplier would have an ID of 1
Xp multiplier would have an id of 2
and so on
well, you have either assign the ids yourself, or you can generate random ids
How could I assign the IDs myself?
if you have an sql database, it has an auto incremented unique id
I am using MongoDB
But like I just said
I want to give it my own ID
like
let items = {
coinMultiplier: {
"id": 1
},
xpMultilier: {
"id": 2
}
}
if you want to find items by their IDs, the IDs should be the keys, and the name should be a field
Something like that, then users could do tc!buy 1 or tc!buy 2
so js items = { "1": { name: "coinMultiplier" } }
this way you can also add more fields if needed
for example item description, item price
etc
let items = {
"1": {
name: "CoinMultiplier",
price: "100"
},
"2":{
name: "CoinMultiplier a Week",
price: "400"
}
}
Something like that?
yeah
items[id]
its a string, so it has to be items["1"]
but if you get the id from the discord message, its just the variable items[id]
?
yes
Mk
let items = {
"1": {
name: "CoinMultiplier",
price: 100
},
"2":{
name: "CoinMultiplier for a week",
price: 400
}
}
does it have to be like that
or can it be
let items = {
1: {
name: "CoinMultiplier",
price: 100
},
2:{
name: "CoinMultiplier for a week",
price: 400
}
}
Mk
actually it doesnt make a difference
even as strings you still cant do item.1
and even as strings, you can still do items[1] as a number
Yea
I don't really want to do a bunch of checks ugh
Is there a faster way to like
Oh way
Oh wait
I can just do
is there a way to use both ids?
like
items[1, 2].price
or smth
nope
Damn
you need to iterate it
?
loop
you want to get a list of prices, right?
Yea
and check if they have the right money
for any of those items
so I could do
a for loop right?
you can do something like js Object.entries(items).map(item => { return `[${item[0]}] ${item[1].name}: ${item[1].price}` })
and you'll get an array containing the list of items with their ids and prices
Hm
I was just gonna do something like this
if(data.bal >= items[1].price){
data.bal -= items[1].pric
data.coinMultiplier = "2x"
}else{
message.channel.send(`You don't have sufficient funds! You have ${data.bal} you need ${data.bal - items[1].price} more coins to purchase this item!`)
}
something like that
and I think that is how I would get how much they would need more
I am not completely sure
yeah that will work
just switch them around in the message, or you'll get you need negativenumber more coins
xD
Yea
True
XD
It'd be nice though
if I could loop through all the prices
so if they do
tc!buy 1
it will check their bal with that price
and if they do the second one
it will also check their bal with the price of that item
I don't want to have to do a bunch of checks
Hm?
if you want to work on multiple items, just use loops
That is what I was gong to do
But I am not very good with loops
Oof
Ill figure it out though
!
You been a ton of help already
Thanks ❤
👍
So my code pushes this error
throw err; // Unhandled 'error' event
^
Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object])
discord.js?
k
bot.on("error", console.error)```
^
but most of the i get that error is because the internet went out
^
I also get that error if My pc goes to sleep if I am hosting on my pc like a nub
welp
Looks like ima have to do a bunch of checks
I can't get the for loop to work
:/
what are you trying?
for(price in items){
}
is items an object?
yea
var?
for in lets you iterate over keys, so price here is not the item price, its the item id
of is a collection iterator
for of will iterate over values, so price would become the entire item object, with all is sub keys
So how could I get price then?
you can use whichever loop you want, just use the context properly
cause I want them to be able to do tc!buy 1 and it checks the price of item ID 1 or tc!buy 2 and it checks the price of item ID 2
example ```js
for(a in items) {
console.log(items[a].price)
}
for(a of items) {
console.log(a.price)
}
What is the a?
the value of the current item
Ah so if they tried to buy the first item
it would check the price of that item?
and if they tried to buy the second one it would check the price of the second item
also, apparently for of doesnt work for objects, only for arrays
oh
I use of to iterate collections
i dont get what you're trying to do tho, this is for iterating over all items
you dont need to check prices of all items if they want to buy just one
Well I am just trying to prevent me from having to do
if(data.bal >= items[1].price){
//gives coinMultiplier 2x and subtracts coins
}else{
//tells them they have insufficient funds
}
if(data.bal >= items[2].price){
//gives coinMultiplier 2x and subtracts coins
}else{
//tells them they have insufficient funds
}
if(data.bal >= items[3].price){
//gives coinMultiplier 2x and subtracts coins
}else{
//tells them they have insufficient funds
}
and so on
why do you need to do that?
if they want to buy item 1, just check item 1, dont check other items
if(data.bal >= items[`${args}`].price){
//gives coinMultiplier 2x and subtracts coins
}else{
//tells them they have insufficient funds
}
couldn't I do that?
so if they do
tc!buy 1 it will check price for 1
thats exactly what you should do, i though you were already doing that from the beginning lol
but you're doing it wrong
you dont need to convert anything
yea
oh yea
else, you need to extract the value from args
If you have an object like this:
item1: {
desc: "",
price: 100
},
item2: {
desc: "",
price: 200
}
}```
console.log(obj.item1.price) // 100
console.log(obj.item2.price) // 200
lmao
Sorry for wasting your time
Its not a waste of time if you learned
is anyone familiar with the "message.channel.overwritePermissions" function in discord.js
is there a function to overwrite the permission throughout the whole server?
You would need to use a loop
oof
here is an example of a loop I use
message.guild.channels.forEach(async (channel, id) => {
//overwritePermission function here
})
That is how I do it
okay
Although
?
It isn't that good for big bots or so I heard
Since it can be API abuse for big bots or just servers that have a tone of channels
but its fine
ton*
the only alternative is to use roles instead of channels
or override category permissions
and make channels sync with category
Hey tim
data.coinMultiplier = "2x"
I just realized a thing I didn't think of and now I can't figure it out
Coin Multiplier is not the only item on the shop
There is also xpMultiplier
But I can't figure out how I would do if they bot the Coin multiplier make it 2x and if they bought xp Multiplier make it 2x
could I just do
a check?
What do you want exactly
xp and coins are two different things, right? so they should be two different properties
Yea
like data.cointmulti and data.xpmulti
also
if you want to remove some checks, since you want to simplify your code
instead of data.coinMultiplier = "2x" just do data.coinMultiplier = 2
I can;t
this way, you can do coins * data.coinMultiplier
instead of if(coinmultiplier == "2x") { coins * 2 }
client.checkUserExist = (message) => {
client.loadUserData(message.author.id, data => {
if (data != null) return
data = {
id: message.author.id,
bal: client.settings.starting_balance,
xp: client.settings.startingXP,
levels: 0,
coinMultiplier: "1x",
xpMultiplier: '1x'
}
client.writeUserData(message.author.id, data, () => {
client.log(`Successfully created account for ${message.author.username}#${message.author.discriminator}`)
})
})
}
Delete string
just change it
Delete the string 
But I guess I could do
do the same as you do with levels
I do coin multiplier on my bot
use a number instead of a string
@earnest phoenix Cool
Text want string, and number doesn't want it
You make no sense
sorry
else if (data.coinMultipler == 2)
I could do that
Instead of checking if coinMultiplier == "2x"
But
Still how would the bot know if they bought Coin multiplier or Xp multiplier?
cause if I just did
if (data.bal >= items[args[1]].price) {
data.bal -= items[args[1]].price
data.coinMultiplier += 2
data.xpMultiplier += 2
}
wouldn't this just add them both?
two things
- you dont need that if anymore
you dont need to check if multiplier equals to 2 or not
I am not
simply always multiply by the multiplier
That is adding
wait
honestly
I am dumb
I am adding 2
not adding it to the number 2
oof
Yea
I can't figure that part out
:/
That is what I been saying
and asking for help on
if(items[args[1]].name === "coinMultiplier")
thats why you have a name field in your items
Ah ok
Wow that was simple
I clearly don't think hard enough
But it goes By ID
So I should use
use .id?
or what
Wait nvm
if i'm making just a simple bot, would sqlite do as a db for it?
according to my research, sqlite is the best database for most bots actually
according to my research, glitch is the best host
@_@
the thing is, why would you use a database server when you only have a single process using it?
the only time a database server would make sense is if your bot is sharded into multiple processes or across machines, or you need external access via apis
so for small bots, its usually not needed
and sqlite has already proven itself to be able to handle millions of requests
I started out with a json storage engine
then I ported it over to mongo as the demand got higher
im still using json as well, because i dont have time/motivation to rewrite everything
but i plan to rewrite it to sqlite
i think that even with shards, sqlite will do fine in a single machine
i would only move to a database server if i were to split it into multiple machines/instances
well, once your bot gets really big, like i assume yours is
then you go on an adventure
yes, miserable adventure
the more you grow, the less docs there are
even on huge bots most dbs can handle it without breaking a sweat
with great power comes great responsibility
except I don't have responsibility
pretty much any real db can handle tens of thousands of queries per second at least
even sqlite can
really just want to get replication up for my db
had an incident before where a node magically won't boot
👏🏾
public invite is not available
a friend was trying to add it
there's another invite link that goes thru the full oauth flow
so I can rate limit it
cool
What's wrong with RR 🤔🤔 @keen drift
nothing 
{ [Error: SQLITE_CANTOPEN: unable to open database file] errno: 14, code: 'SQLITE_CANTOPEN' }
whats up here
could be a lot of things
im still stuck
im trying to make a function to go through each channel and mute a user
so far the function is message.guild.channels.forEach(overwritePermissions(mutedmember.id, {
VIEW_CHANNEL: true,
SEND_MESSAGES: false
}))
what's the issue?
message.guild.channels.forEach(
await channel.overwritePermissions(mutedmember.id, {
VIEW_CHANNEL: true, SEND_MESSAGES: false
}));
wrong
That should work better
that code won't work
It works for me
it's 100% invalid
Perfectly fine
...
message.guild.channels.forEach(
await channel.overwritePermissions(mutedmember.id, {
VIEW_CHANNEL: true, SEND_MESSAGES: false
})
);```
you pass the result of overwritePermissions to forEach
and i can guarantee you that is not a function
also you don't need to await if you don't use the result
its a method
But you do you guys
it's useless and just adds overhead
¯_(ツ)_/¯
and gc pressure
@last lava any reason you're not using a mute role instead?
it's way faster to mute
a guild can have 500 channels
you'd send 500 requests to discord to mute a member
i dont find it consistent
vs a single one to add a mute role
consistent 
for some reason, my role doesnt mute for the channel the person is in
but does for all other channels
then your permissions are wrong
i double checked them...
if you have something like https://javascript.is-bad.com/ba097c.png
then it's impossible to mute
if any permission overwrite allows a permission, it will be granted
regardless of denies
probably what the prob was
that forEach doesnt even have a callback
I’m having an issue with some errors in my code. Anyone good with Python? If so please dm or ping me.
so should i just stick with assigning a role?
using a role is better, but its a pain to update the channels for it
okay
how can I make it so when they do tc!shop it dms them the shop embed and then they can just send the [itemid] they want to buy. Cause rn it is lookin for the item number when I do tc!shop
should i create a new role, or have one premade
you can do it the channel way, you're just missing the callback in the function: .forEach(channel => do something with channel here)
If you are good with python, please ping or DM me.
If you create the role gotta check if it exists after so it doesn't keep creating the role after every single time the mute cmd is used
keeps trying to create*
thats what i used prev
@quartz kindle like this
message.guild.channels.forEach(channel => channel.overwritePermissions(mutedmember.id, {
VIEW_CHANNEL: true, SEND_MESSAGES: false
}))
okay
message.guild.channels.forEach(channel => channel.overwritePermissions(mutedmember.id, {
VIEW_CHANNEL: true, SEND_MESSAGES: false
}))
does this make any sense?
if (cooldown != null && (Date.now() - cooldown > 0)) return reply(`You can only use !daily every 24 hours`);
if (cooldown == null) cooldown = Date.now();
i'm using dates to make a cooldown system
Date.now() - cooldown will always be > 0
so how do i check if the cooldown is equal or greater than a day?
let d = new Date(); d.setDate(d.getDate() + 1); if lastUse + cooldownDuration > d.timestampthingy
somewhat like that
Anyone good with py? If so... help?
Can you check this code to run it? I can’t find it’s errors.
@earnest phoenix that's not how you run a bot
Mate, it has errors.
I just need help fixing them/
congratulations on leaking your token
rip
oof
Shush
I been waiting 2 days for @gilded plank
@earnest phoenix first off is it in a python file or are you actually running it from there
Wait
SyntaxError: await is only valid in async function
I get this error
even when I add async in
My cooldowns are so overworked, but they work
Ok?
Was referring to a older conversation
the function has to be async
@lusty dew you need the function you are calling the await from to be async
@spring ember I already have it handled
Cool
Is there a way to add more than 1 reaction of the same type to a message? (py)
how do you add a reaction to a message
currently with client.add_reaction(msg, emoji)
repeat that
hm it doesnt add more it seems
can u just post code
msg = await self.bot.say(embed=await self.generate_embed())
for i, r in enumerate(self.options_reaction):
await self.bot.add_reaction(
msg,
(b'\U0001f1a'.replace(b'a',bytes(hex(224 + (6 + i))[2:], "utf-8"))).decode("unicode-escape")
)
await self.bot.add_reaction(
msg,
(b'\U0001f1a'.replace(b'a', bytes(hex(224 + (6 + i))[2:], "utf-8"))).decode("unicode-escape")
)
await self.bot.add_reaction(
msg,
(b'\\U0001f1a'.replace(b'a',bytes(hex(224 + (6 + i))[2:], "utf-8"))).decode("unicode-escape")
)
await self.bot.add_reaction(
msg,
(b'\\U0001f1a'.replace(b'a', bytes(hex(224 + (6 + i))[2:], "utf-8"))).decode("unicode-escape")
)```
hm
sec
do a loop then
well it is a loop and should add each reaction twice
(i just copied the lines where it adds the reaction once)
Hi
arent u adding the same reaction
yes
by reaction of the same type i meant the same reaction
no
Hi
thanks for the help @knotty steeple
is there a way to save a message including the reactions and repost it?
no
@earnest phoenix done
yes
If I want to make a user blacklist in json I have to do how?
ok
save userdata you can use to identify the user (hint: choose something that doesn't change) in your json object and wherever you implement your blacklist logic (aka where you want to do something with the blacklist in your code) check if the user in question is in your blacklist. If they are do things you want to do with blacklisted people
const Discord = require("discord.js");
const bot = new Discord.Client();
exports.run = (client, message, args) => {
if(message.includes('everyone')) return;
if(message.includes('here')) return;
const saywhat = args.join(" ")
if (saywhat < 1) return message.channel.send("Je n'ai pas fourni de texte à dire ")
message.channel.send(`**${message.author.username}** dit ` + saywhat)
}
@earnest phoenix il me laisse pas faire de say tout simple avec genre même sans everyone ou here
Att
Ok
if(args[0] === 'everyone') return;
Ok thx
message.includes est dépassé
J'avais oublier
if(args[0] === 'everyone' && 'here') return;
Yes
Ok thx
Jsp si ca va fonctionner comme ca
Ah
Avec les & &
Alors
Mais sans ca fonctionne
if(args[0] === 'everyone') return;
if(args[0] === 'here') return;
?
Oui
Ok
Go test
Merci
Il bloque pas @earnest phoenix
Il met quand même mdrr
@earnest phoenix ta défini comment tes args
Ma commande say
const Discord = require("discord.js");
const bot = new Discord.Client();
exports.run = (client, message, args) => {
if(args[0] === 'everyone') return;
if(args[0] === 'here') return;
const saywhat = args.join(" ")
if (saywhat < 1) return message.channel.send("Je n'ai pas fourni de texte à dire ")
message.channel.send(`**${message.author.username}** dit ` + saywhat)
}```
ah mais
J'ai ça moi
if(saywhat === 'everyone')
Ok
met le en dessous de ta const
et
D'acc
if (!saywhat) return message.channel.send("Je n'ai pas fourni de texte à dire ")
plus simple
Ok
Sauf que
Maintenant il fait plus de say
Wtf
data.bal >= items[]
Since I am doing cases what would I put in the [], cause I am wanting to check whichever ID they said it will check the price of that Item
could I just do
data.bal >= items[args[0]]
https://ghostbin.com/paste/wha88
^full code
your code order is wrong
first of all, this js message.author.send(shopEmbed).catch(e => { return message.channel.send("Please, enable your dms and try again!") }) will always send, regardless if they have dms enabled or not
you should run that only if the dm fails, for example in a catch block, if the dm message fails
Ok
then this js setTimeout(() => { message.author.send(`What item would you like? Please say the number of the item you want: Example: 3`) }, 3000) why are you waiting before you send the item list? you're basically trying to wait for an answer before sending anything
you should send the list first, and then await messages
why dont you add the message in the embed? like in the footer
also, to send messages in the correct order, you shouldnt use an arbitrary set timeout
you should wait for the message response
.send(message).then(msg => {
msg.send(another message)
})```
or use async/await
now back to the original question
if (data.bal >= items[]) { is also in the wrong order, there is nothing yet to compare
it should be after the await message
so then you just if (data.bal >= items[answer].price) { switch } else { send(insuficient funds) }
if fact, you dont need the switch at all
👀
instead of this js switch (parseInt(answer.content)) { case 1: { data.bal -= items[0].price data.coinMultiplier += 1 message.author.send(`You have just bought ${items[0].name}!`) break; } case 2: { data.bal -= items[1].price data.xpMultiplier += 1 message.author.send(`You have just bought ${items[1].name}!`) } } do this ```js
data.bal -= items[answer].price
data[items[answer].name] = 2; // set 2, else if the person buys it twice, he gets multiplier x3. unless thats what you want
message.author.send(You have just bought ${items[answer].name}!)
you dont need them
why lol
lmfao
the problem with the switches is that as you keep adding new items, your switch will be huge
and you dont need it all, when you can just directly access the item with the answer
where?
data[items[answer].name]
instead of .name
could I do.id
since I am wanting to them to use the ID
yes, but that is not whats happening in that part
data is your database, the user data
remove this message.author.send(shopEmbed)
Why?
and add it here
Oh
message.member.createDM().then(dmchannel => {
dmchannel.send(shopembed)
let filter = m => m.author.id === message.author.id```
actually
you dont even need the createDM at all
Damn my code is all types of messed up
....
ctrl z
anyway, the shopembed should be inside the dm channel
now another problem
you changed the item names, or maybe i remember them wrong
so now they dont match the name that is in data
Yea
if you try to do data[items[answer].name] is the same as doing data["Coin Multiplier 2x | Day long"]
yes you can
but now you have to think, how are your future items going to look like?
Isn't it item instead? Because of the forEach?
shopEmbed.addField(item.id + ' ' + item.name, '\n' + 'Description ' + item.description + '\n' + 'Price:\n' + item.price)```
are all of your future items going to be stored in their own namespace in data?
Not all of em
yes, item also works
so you will need a check later
Otherwise you can just do a for loop, and those are 3 times faster.
his array has 2 items
What kind of check would I need to add?


