#development
1 messages · Page 763 of 1
uh
How to create a web scraper in 20 lines of code to scrape websites like reddit, Hacker News, and BuzzFeed. Extract content and write it to a text file.
Does anyone know how to ban multiple users at once from an array? Would be helpful so my bot doesn't get rate limited during a raid.
js
you cant do mass Bans in one request
but you can send a couple in a short period and its fine
its just a spam of it that will get u rate limited
Oh no, like banning users
1s delay between each ban
mass Bans sorry
oh yeah
Hi, i have problem with my bot when i shard this bot : Nebulusdimanche dernier à 00:29 I explain my problem It is not synchronized, it is super strange ... even by saving the file all the commands, the shard one has the json file of the bot when it launches and the two also and after they leave in their corners and the file is saved by doing rollback or I don't know what It's very strange I can show you with my bot directly Wesleydimanche dernier à 00:32 The json is probably cached meaning that changes on shard x won't transfer to shard y After you require() the file It's cached And no longer checks what's actually in the file
So i can patch this ?
what are you doing exactly with the json?
stop right there
okay, don't, problem solved

I know 😂
you won't get support for doing something that everyone told you not to do lol
This system dates from 2 years I know that it is not for that JSON but until I redo the code that has 10,000 lines I need to patch that
because... you werent meant to do it in the first place
you can't patch it
it's IO
patch code in node.js itsrlf
input/output
So when i remake my code i can't patch this ?
So no solution, I just have to redo my code very quickly ?
Yeah i recode with quick.db
With sqlite
Json is shit for database i know
pretty much
Hi
hello
He does'nt work he convert my file to a .sql
It's normal ?
Nobody have good converter for convert json file to .sqlite
Afaik sqlite extension doesn't matter or can be various things
99% chance that will never work
So i can't make this ?! Because i have a json database system with my bot and i do change this
I can't convert my .json to sqlite ?
you cannot magically convert a json database to an sql database. the structure is very very different
in all honesty if you db is 'small' its not gonna hurt you to just manually add the old stuff back
and yes tim is right
its completley diffrent format layout etc..
well then make a program to convert it over
you need to code everything yourself, how to change which keys and values into which tables and rows and indexes
So my bot is finish ... i can't convert .json to .sqlite :/
the only way to properly migrate databases is like this:
- load json file
- loop over all json items
- insert each item into sqlite database, according to your exact specification
- change all your code to load data from sqlite instead of json
i gotta transfer 5000 files over to db
There I am in the process of redoing my code of 10,000 lines which uses database .json for database with quick.db and it will be very long! And if I also have to do something to migrate the database it will last me forever!
you gonna save files in db? as blobs?
My bot have 2.600 servers 😢 and use json database for her main part 😂
nothing you can do about it Nebulus
I do change this 😦
people dont change databases, and if for any reason they need to, they hire an entire team to do it
1 year ago I knew that the .json I did everything via this
So here I am in shit because I can't keep my basic database in .json because with sqharding everything is bug
these are all lessons to learn
as my bot is approaching sharding limit and is also running json, what im gonna do is a complete rewrite
im in the process of rewriting mine
my old code is shit af anyway
just be glad you dont have to rewrite a lib just to use shards xD
@quartz kindle we have the same problem 😂
We are in the shit
@modest maple yeah but sharding is shit
Just fucking shit
well its not
it gets to a point where you shard or your bot is kinda just not gonna work
yh
but once you go through it once, you will know how to futureproof all your bots
im making my bot memory-proof as well, so i can stay on the 3$ vps for years
nice
fk
I want kill mùe 😢
I want return in the past for start dev of my bot with quick.db
And not fucking json
Argh
bruh how big is ur server to be using 70$ a month in electricity
64 GB ram
you can have dozens of bots in there lmao
thats pretty expensive for a 64gb ram system
its prob a dedi
i run a dedi
I have 4 bots lit 24/24 a minecraft server, a gmod server and 4 sites and other little tricks: ')
😂
and mines like £60 a month in electricity at low load
@quartz kindle you want return into the past with me ?
and thats 48 cores, 96 threads and 256GB ram
well, £60 is more than $70 isnt it? xD
slightly
but its not the gap you would expect
i g2g sleep now lul
Shit !
I have idea
I make an command that the player executes and it takes things and puts them in sqlite
😂
I just joined
Come on man
@earnest phoenix
Go to discord permissions calculator
I did
I am*
Then get your bots client ID
And put it where it says you need to
Then click the perms you wanna give
My bot is in here already
O
how do i add a new row onto an existing mysql table? i tried adding 3 but it only added 1 row
i hate myself
i didnt even have that problem, i did show tables and assumed the table name was a row i added 🤦♂️

ok i actually could use help now
say ur issue
i need to figure out how to actually get my database to work with my code eg the xp system i already have
and to start storing the info into the table
here is the code btw
seeing as it wont be stored onto a json anymore
oh wait yeah i also need to add another row to my table so if you could tell me the command to do that please? 😁
sqllite yh?
mysql
dont you need todo INSERT INTO <Table> (Columns) VALUES (items, items, items)
idk, this is my first time using mysql i just set it up like 10mins ago
you have to do ALTER TABLE
im pretty sure it is INSERT INTO <table> (c1, c2, etc..) VALUE (v1, v2, etc..)
cuz mysql follows the same syntax as sqllite
alter table?
I'm only saying this because data types like INT NOT NULL if you're trying to change or insert a value is moost suited for that.
I could be very well wrong tho.
im not adding values, im just adding a new row to store values
Then use ALTER TABLE
why are you adding rows when you have no data to put in them
that removes the whole point of the row

because data will be added into them eventually by the bot
but you can just do it when it needs


like insert automatically creates the row with the vlues
are you talking about columns?
which will be very soon after i finish this bit of code
rows
then just add rows when you have data to put in them
INSERT handles that for you
theres no point adding rows with nothing in, it just creates more work when searching for stuff
sigh
Are there any free servers to keep a discord bot online 24/7?
what is going on????
@earnest phoenix not really glitch and heroku are sorta scuffed semi sorta hosting systems
@earnest phoenix in the top error you did '<Numbers> and didnt close the string with a '
you were trying to give it a string as a num yh
well you didnt actually close that quote mark
so it was like wtf is this data type
ok i fixed that but the other thing?
it would appear its empty
is it possible to make a command to show the guilds your bot is in?
@analog roost dont know why you need it but add client.guilds.forEach(guild => console.log(guild.name)) to your code which is along the lines of client.on('ready'...)
or use this code already done: ```client.on('ready', async () => {
client.guilds.forEach(guild => console.log(guild.name))
console.log('I am now online!')
``` change client to bot if you already have it as 'bot.on'
alright thx
anyone found the solution to my problem or nah?
also i need to know now how to add a new row for levels so when the database detects the user has leveled up, it adds 1 onto the current level
@earnest phoenix don't spoonfeed them code
ok
The simple answer as to why we do not spoonfeed, is it does not help you learn.
If you come in this server and ask a question that has a very basic answer, and you do not know how to figure out this answer...then put quite bluntly, you need to learn more. What we will do, is point you in the right direction to learn what you need to. By simply giving an answer that you, most likely, cannot then figure out why it is the correct answer....you learn absolutely nothing.
All developers need to learn some very basic things:
How to read docs
How to read tracebacks/errors
How to figure out where to look
Would your question be better suited to simply google?
Is your question in the docs, quite clearly?
If you think about your question, do you think it's probably been asked many times before? Have you tried the FAQ?
Whenever you are "not spoonfed", you are being assisted in how to do one of the above. Don't be unnapreciative, it is the type of help you need, whether you want to admit it or not.
sorry my bad...
Dw
As for your error
Don't you have todo fetchall() to get everything from the db
Well from the specified field
hm?
probably not? but i did stuff and got a new error so i need to add new code for a coin system i was planning on adding but dont really know how to make...
Hmm
I'm about to go to sleep so I can't rlly help much, if you're still stuck I'll try help tomorrow
i can easily get it to add the coins to the database since its basically copy paste
ok
see ya
Hello. Ive been trying to make a report command and then when you click on the reaction, the report closes/deletes. ive been trying but i cant find out how to fix it. Code: >>>https://hastebin.com/guyafukexa.js<<<
its not empty
why is line 31-36 randomly in it's own scope
embedMessage.react("✅").then
then what??
thats it
that makes no sense
ok then
thanks for trying 2 help
What a surprise
What do you wanna do after you react to message
Can somebody help me with a music node im coding? I code in JS, the code dosent work I think its outdated but I don't know what to change. Hastebin ---------------------------------> https://hastebin.com/egukahasof.js
@me if you have a possible solution or a suggestion. please
That's the thing Idk what isn't working because on the code editor is says nothing is wrong
I checked the logs to
and I checked if all the packages were up to date
can you debug you're code and see exactly where it stops working
ok
Who knows how to get someones email and password
Uhhhhh asking for a friend
jkjkjk 🤣
Does anyone know how to have this where I dont have to have this window open on my computer?
Original question stating "so that the bot worked without the command prompt"
I have windows 8 and on that it comes default with the regular command promt
Thats a different one
its the Node.Js command promt
What does that matter
npm works with the Node.js command promt the regular one doesnt
not npm
something else
npx?
Im searching it
Oof but im wondering how you can use that
without having the program open
all the itme
time
If I close it the bot stops working
Could make it a system process
But I discourage that unless you're on a vps
Dedicated to hosting the bot
To host something without a window/application on your window you need either
1: A friend who's willing to host it for free
2: A VPS with at least 1gb ram (since discord bots don't really need that much ram depending on how much it's being used) [I'd suggest GalaxyGate]
3: A Home-server (or another pc) where you can keep the bot online as much as you want (but you will need to maintain it yourself).
Or run a system process for it
That too...
But again I wouldn't do that
Or you could just get code that keeps it online 24/7 as long as you have a website pinging your bot
I don’t mind telling you the code if you use JS
3B: An example of a cheap home-server could be a Raspberry Pi or something similar.
Anything that runs Linux or Windows can host a bot
Most things that can connect to the internet and have enough processing power can run a bot
Just might need to attempt to bypass stuff 
theoretically there can be a dupe id
but realistically all ids are globally unique
I will send messages to only one channel of a server, how can I do this.
This server will only be on the bot's main discord server.
Fetch the channel and send the message
Something along those lines yes
Proper error chandling might be good as well
Handling*
Gotta love mobile
try catch
thx so much 😄
Honestly I just need ideas for commands im not creative at all 😐

lol there was someone that said they need my source code to make sure my bot wasnt a spam bot 
I made the emoji stealer
is pretty fun to see peoples reactions

can even steal reaction emojis
Is that not against TOS?
Don't imagine why it would be
as long as they aint copyright

You can do it manually
Yea
It does sound like it's against TOS since I'm assuming you're using a user account to fetch the emoji URLs
Nope
I don't fetch the URLS
I fetch the name of the emoji and the id
which is what the url is composed of
Same difference...
But it isn't a user account 
I would fetch the url
less work
but can you even?
Damn it I started csgo on accident
How do I get a message from a server by it's ID?
Im trying to get reactions from the message btw
So I would have to get the channel from the discord then fetch the message?
So I just need to add the channelID to the json
client.channels.get(CHANNEL_ID).fetchMessage(MESSAGE_ID)
Imma go through the guild to get the channel
You don't need to go through the guild
don't need
just sayin
Yea ik I just like it more spread out
its just my coding style
There is no messages method of a channel
Well that's one way to needlessly go and call a load of API requests

not much of a difference if the guild/channels are cached really
@slate wave client.guilds.get(ID).channels.get(ID).messages.fetch(ID)
or fetchMessage if youre still on v11
i think I got it 1 sec

if you're trying to get a reaction on a message why not just store the message object
I want to update the reactions and have it work even if I restart the bot
you could still do that by storing the object...
rather than making an api request which can get oofed by cache
i have custom msg cache :DD
let channel = guild.channels.get(bot.reactRoles[i].Channel)
fs.writeFile("./Jsons/Testing.json", JSON.stringify(channel.messages), err =>{
if(err) throw err
})
That turns the Testing.json to have nothing in it
Because then I use ```js
let message = channel.fetchMessage(bot.reactRoles[i].messageID)
That doesnt work even when I use
let message = channel.messages.fetch(bot.reactRoles[i].messageID)
reactRoles is this ```js
bot.reactRoles[Role.id] = {
Guild: Role.guild.id,
Name: Role.name,
MessageID: message.id,
Channel: message.channel.id
}
Can you even stringify a collection?
Also, fetching is async
So both .fetch and .fetchMessage needs await or .then
Even when I dont stringify it it doesnt work
Of course it doesnt
.messages is a collection, which is a complex structure, it cannot be stringified
Yea but it doesnt work when I don't stringify it
You need to take what you need out of it and build a simple object
Of course it doesnt, you cant save non stringified objects
yes you can
Unless you save them as a buffer or blob or something
Anyway what part of messages do you need to save?
I have the ID saved and I need to get the message to get the reactions from it
I mean, you have writeFile on channel.messages
Thats trying to save all cached messages from a channel in a file
- not the right place to talk about that
- DM the mod who declined your bot
where can i know who declined it ?
beat u that time cyber :P
uh so
I have a script for recieving a post method
and so on pretty easy
but it tells me that it cannot read url of undefined
app.post("/upload", (req, res) => {
console.log("recieved a post method")
if (!req.body.url) return console.log("no url value posted cancelling...")
else console.log(req.body.url)
});
I did execute a post method on the url/upload
with a json and a url object
it tells me that url is not defined
and idk why
im using https://ifttt.com to make a web request if I like a video
and then send the url
looks like this
but idk why it gives me an error because I do post the url to it
Are you using body parser?
Using express right?
yes
const bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({extended: false}));
This will allow you to read req.body
well in my other api I have bodyparser
maybe that was missing
k thanks I will try it now
also I don't think I need body parser
cuz it also works with express.urlencoded
ok so I added it now
but it tells me now constantly that url doesn't exist
aka return console.log if there is no req.body.url
oof
doesn't matter how I do it
it just tells me it doesn't exist
console.log(req.body)
Im gonna try your method with that module
And see what it returns
ok
Cause it might actually be sending it as something else
result was
{}
I did eval a post method with my bot this time
require("axios").post("https://youtube-video-converter.glitch.me/upload", {url: "ok"})
this is what I evaluated
Strange
add a 3rd
I cant see another box to add
<ID1>, <ID2>, <ID3>
Not working
send a ss
@earnest phoenixdo it in a array
yes
Not workings
i got rid of the password cuz you know
["586214600412758040", "592792499739820230"] @earnest phoenix
@uneven wyvern you dont do that with the site
Wrong Ping fuck
Oh
you do not have it like an array
@uneven wyvern its invaild format
fuckin little phones these days
yeah
@earnest phoenix whats it saying
Nothing
@earnest phoenix yh, it looks mostly correct so im not entirley sure
bruh
It showing 2 devs alone
are you adding your own ID to that list
lmao
Another dev is not here
seems like
I also needed app.use(express.json())
because I did get a body
but wasn't able to read the url object
or any json
aaaand now I got a 503 error
a package for interacting with the youtube api
@earnest phoenix what exactly do you want to do get video info or what
mostly for playing music
simple youtube api
then ytdl-core
Does anyone know a way to see who made an edit (e.g. deleting a channel)? (js)
i thought of fetching the info from the audit logs but couldn't find a way to do it
what library
js
discord.js?
yes
you have to check audit logs
yes but i have no clue how to do that
browse the docs
check under guilds for fetching audit logs
@sudden geyser aha found it thanks
fetch executor from audit logs
can i get some help with mysql?
i keep getting this error but don't know how to fix it
have you tried reading the error
doesn't make much sense at all to me
i get that it says level doesnt have a default value but i dont understand how to fix it
ive looked on google but the answers don't make much sense either
explain?
bruh
if you read the error it gives you the sql query as well
there is probably more than 2 rows in your databasr
one that is "level" and you're not specifying it
just speculation
but then how would i specify it?
wait let me send some code and take a look, cuz i think i already have
ok
first bit, probably not the answer tho
and second bit
although knowing me, my code probably doesnt even work
sorry, most likely*
... it doesnt work does it
INSERT INTO info (id,coins)
Youre inserting only an id and a coin value. If your table has any other columns (which looks like it does) they need to have a default value configured, or be explicitly inserted as well
i uh... dont really understand...
You know what is a table?
yeah
You know what are columns?
yeah
Id level xp and coins
None of them have a default value
That means every time you do an INSERT, you need to insert a value for all of them
INSERT INTO info (id,level,xp,coins) VALUES (bla,blab,lab,la)
You cannot insert only id and coins
so basically even for the xp and id if i want to add only those, i still have to add the others and just assign them as 0 for example?
Yes
Unless you give those columns a default value during table creation
Nope, order doesnt matter
As long as the order inside the () is the same
and thats for the first time a new user is added right?
Yes
so the update is fine as it is
After that you can update columns individually
👍
is it possible that the bot can react by order?
yes (depends what lang)
js
when you react, await it and do it in order or use a bunch of .then in order (reasonably)
code?
let s = args.join(' ')
if(!s) return message.channel.send(`Hello <@${message.author.id}>, I cannot send an empty suggestion!`)
let e = new Discord.RichEmbed()
.setTitle(`Suggested by: ${message.author.tag}`)
.setDescription(s)
.setColor(color)
client.channels.get('661141334937305108').send(e).then(m => m.react(':tick:').then(m.react(':deny:')))
.then accepts a function, not a promise for your 2nd .then.
also I don't think that's correct usage
but it works
let m = client.channels.get('661141334937305108').send(e)
m.react("")
m.react("")```
@summer torrent oh ty
example won't work but promises like:
await msg.react(1starg)
await msg.react(2ndarg) // This happens 2nd because first one is awaited```

ok, it did work but for some reason it creates 2 of the same user?
@quartz kindle
are you inserting it twice?
also, if you want your users to be unique, you should define the user id as a UNIQUE column
idk which software you're using to manage your database, but look into how to create unique indexes on an existing column, or just drop the table and rebuild it that way
Inserting it twice?
😏
maybe 🤔
your code flow is very messy and unoptimized, so its very difficult to understand whats happening
try reducing the amount of database calls and duplicated stuff
yeah i know... sorry about that
for example, start with merging the xp system and coin system in the same function because its the same table after all
so you only open the table once
so the insert change it to ````INSERT INTO info (id,xp,coins,level) VALUES ('${msg.author.id}', ${generateXp}, ${generateCoins}, ${curLvl})` ```?
well, if you're inserting, that mean it doesnt exist yet, so you can insert the default values, no need to use any function
and then you can safely exit the function i guess
for example js connection.query(stuff, () => { if(!rows) { insert all default values; return; } continue code here if user already exists })
huh?
so... ```connection.query(SELECT * FROM info WHERE id = '${msg.author.id}', (err, rows) => {
if(err) throw err;
let sql;
let curLvl = 1;
let nxtLvl = 1;
if(rows.length < 1) {
sql = `INSERT INTO info (id,xp,coins,level) VALUES ('${msg.author.id}', 0, 0, 1)` ```
?
think about the order of operations
if there is no user, you dont even need to begin any current/next level logic
because it wont be used anyway
but if this is triggered on message?
or are you referring to the curLvl and nxtLvl?
yes
and also, assuming there is nothing to do after inserting a user, you dont need to declare sql outside and assign it like that
you can just run the query directly
if(length < 1) { connection.query(INSERT ...) }
ok
idk which mysql library you're using, but maybe its easier if you use async, if it supports it
mysql: "^2.17.1" is what it says in my package.json
and the client runner is MySQL 8.0
so async sql?
ill just leave it as connection.query
i cant find anything in the docs about async
so yeah you'll have to stick with callbacks
so you will need to build if-else trees basically
would something like this work?
if(rows < 1) {
connection.query(INSERT,error check)
} else {
check level and xp logic
connection.query(UPDATE, error check)
}```
exactly, except the sql part
doing sql = something doesnt run anything
you need to run it with connection.query
yeah, also dont do one update for each individual field, update them all at once
how would i lay it out for that?
SET xp = newxp, level = newlevel, coins = newcoins WHERE id = author.id
so like this
ok as for the lvl up thing? it doesnt work, eg my user is at lvl 1 and has 600 xp, but i should be at lvl 2 if i had 300
@quartz kindle ?
how to check if a number gets added in js?
when you realise despite all this code you need to find a free way to run your bot 24/7 still because heroku is god awful
😁
@earnest phoenix you're not really doing any level logic in there? show your generate functions
well i havent added yet because i wanted you to help me out with it
before you helped me change everything to keep it tidier, i had this, but it didnt work
how much xp do you add per message?
so basically the logic should be:
- get current xp and add random xp
- if current xp > level threshold
2a. reset xp, add level, save xp and level to database
else
2b. add xp, save xp to database
what new xp? to do what with it?
to compare it to the max amount of xp before leveling up
if that makes sense?
assuming thats what you're saying
oh right
so if i do if(xp > level * 300) that bit works fine
that'll have the users level and xp from the database right?
if you get the xp and level from rows[0] yes
rows[0] should be the values in the database
i have xp = rows[0].xp so that would auto assign xp to the one in the database right?
oh also in the new code where am i adding this?
technically you're giving xp a copy of the value of the database's xp, but yes
as for where to put the code?
which code?
for the leveling up system to work
where else would it go?
i mean like in the else statement or outside it
if you put it outside it would be executed regardless if the user exists or not
which is probably not what you want
yes
ok
wait would i have to add a new update thing?
in order to increase the level and reset the xp to 0
like this @quartz kindle ?
oh...
what do i do with this bit or is it not necessary?
@quartz kindle i did it but for some reason the id and stuff is still being added twice
where do you define sql
no i sorted that problem out, i just removed that line, it wasnt needed
you never do multiple queries, you do all the logic and then update everything in one go
else you will be trashing your database with too many requests
then?
i mean, its quite simple logic, what is it that you dont understand?
i have this now but if you're saying updating twice will trash it then how would i reset things to 0 one they level up?
just do what i told you before
- if current xp > level threshold
2a. reset xp, add level, save xp and level to database
else
2b. add xp, save xp to database
but isnt that it what i did there?
also, you need to add the xp before you compare with level
no, you update only the xp, instead of xp and level
So I got an error saying MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
Congrats you're listening to an event 11 times
Real pro's listen to the event 12 times 
Real pros make a new listener for each command
@wise sail wow you bullying me
why you bully me
@quartz kindle can you explain the lvl up thing again? it doesnt 100% work
@analog roost are you doing something like this? ```js
client.on("message", message => {
command 1
});
client.on("message", message => {
command 2
});
etc...```
or something like this? js module.exports = () => { client.on("message", message => { command 1 }) }
@earnest phoenix missing access means your bot could not find the message or channel it was looking for
command discrim allows users to get usernames of everyone in the specified # please remove this
is that against tos?
yes if its across all servers
help, the level isnt changed and the xp doesnt get reset
if I make it server specific is it okay then?
Oof
@earnest phoenix you didnt change anything, you're still doing the same thing... if/and
i fixed it and it works?
and you dont have any generateXp() nor generateCoins() functions
oh now you tell...
sorry
i told you to show them long time ago and yo said you didnt have them because you were waiting for help lol
but you're still not doing what i told you to
oh...
you're checking how much xp the person has before adding it, and you're not using if/else, you're running both queries
i'll give you a hint
let newxp = xp + generateXp();
let newcoin = coin + generateCoin();
if(newxp > level * 300) {
connection.query(level = level + 1, xp = 0, coin = newcoin);
} else {
connection.query(xp = newxp, coin = newcoin)
}```
For discord.py, in a channel's history, how do I check if a member has never sent a message?
you can't without spamming the api until you get to the first message in the channel
My bot just tried addRoles() on a bot and it got a Missing Permissions error even though it has enough permissions. Anyone know why it's happening?
it can't modify itself or users higher above it in the hierarchy
It is above the user
are you sure
is the user the guild owner?
No it's a bot
wait a second issue found, it's trying to edit the bot's role, as in the one it manages

are video embeds working? any ideas
I'm not sure if this is the correct place it ask, but is there a way to set this (see image) as just an image without any text?
I keep getting this in my logs. How to I set max listeners since it keeps telling me to, im confused on that part.
Heres what it says if the picture is to small to read ---> (node:1962) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added. Use emitter.setMaxListeners() to increase limit
Im coding on JS
are video embeds working? any ideas
what do you mean?
I'm not sure if this is the correct place it ask, but is there a way to set this (see image) as just an image without any text?
use the html img tag and fill the rest of the description with zero width characters
I keep getting this in my logs. How to I set max listeners since it keeps telling me to, im confused on that part.
don't, stop creating a new listener for each command, handle your commands in one listener only
Ok thanks
Can anyone spot the error it doesnt work
const modr = message.createReactionCollector(mod, {
time: 1000000
});
modr.on('collect', r => {
message.delete();
let modembed = new Discord.RichEmbed()
.setTitle("Moderation Commands")
.setDescription("Kick\nBan\nPurge\nchanneln\delete-chan")
message.channel.send({
embed: modembed
} )
one sec
maybe try indenting your embed command
no nothing
what is message
wdym
Is it the message from the message event or a sent message
its the message that has the embed that lists the reaction
can you show what mod is
const mod = (reaction, user) => reaction.emoji.name === mode && user.id === message.author.id;
const fun = (reaction, user) => reaction.emoji.name === fune && user.id === message.author.id;
const info = (reaction, user) => reaction.emoji.name === infoe && user.id === message.author.id;
const modr = message.createReactionCollector(mod, {
time: 1000000
});
the mode is the emoji
It could be possible that the mod filter's conditions aren't being met so it's not gonna collect the reaction
check if the emoji name it's matching is right
const mode = "🛑"
thats what i have
do i need the name liek the :emojiename:
i just have a copy paste emoji
from flask import Flask
app = Flask(__name__)
@app.route('/home/pi/html',methods=['GET','POST'])
def index():
return 'just the main area.. nothing to see here'
if __name__ == '__main__':
app.run(port=5644)
ok
im trying to set up a webserver to communicate with my bot (and other things i will be making)
but how would i get other files in the directory
Tutrtle figured it out thanks for the help anyway
in the app.route area
*nevermind i found the problem
With async for message in channel.history(...), how far back can you go without it being considered API abuse? It's something I've wondered about for ages haha
GET doesnt have a heavy ratelimit, and that would be fine i believe
api abuse would be continuing to do the same thing over and over again after already getting ratelimited twice or three times
Aah okay
So technically using that can't be API abuse then? Cos it doesn't rate limit to my knowledge, at least getting stuff (as Neko said)
I meant to say I've never seen it rate limit in my experience - sorry should've been clearer haha
I just didn't know if there was like a limit you should keep to, like 1,000 messages or something
But thinking about it a limit would've been implemented in the API if it was a massive issue
Eh I don't think message.history has a ratelimit or it's really huge
Fair dos, cheers
How to do it at Server Info it will show how many boosts there are to serve
in which library
js
in which library
JavaScript
yes but what is the library
discord.js
you have to use the master version
stable doesn't support it
lol r i p
you can use 11-dev too
if you dont want to use master and rewrite all embeds, some things
In discord.py how to set prefix as string, i have tried but returns nothing
like bot
bot
Or if you're using custom prefixes
if message.content.startswith == "bot": etc
@sullen salmon im asking python
This is python
i think it is ctx.message.startswith
Well for starters starts with is a function
Oh I might remember it wrong then
Secondly you don't use one = as a comparison
open brackets right?
Jee forgive me for not being faultless
3rdly thats gonna be caps sensitive
Why are programmers like this
Because don't spoonfeed code
Yhea it's a prefix, it's supposed to be case sensitive
And if your ur gonna spoonfeed code atleast know what Ur doing yourself
How is this spoonfeeding
It gives perfect insight into what to do
It teaches the use of startswith
Even tho the bot class you can Parse the prefix on start
if ctx.message.startswith("bot help"):
# code..
will this work?
Well that's saying check the message object if it starts with not if the content starts with
Also if you're using the bot object why not use cogs?
Well your using the bot object so you might aswell use cogs rather than hard coding if, elif, elif, elif, elif etc...
ok
@client.command()
async def shiba(ctx):
with open("shiba.json") as url:
r = re.compile(r"https://i\.redd\.it/\w+\.jpg")
matches = list(set(m.group(0) for m in r.finditer(url.read())))
ctx.send(random.choice(matches))
It gives me an error saying: "discord.ext.commands.errors.CommandInvokeError: Command raised an exception: FileNotFoundError: [Errno 2] No such file or directory: 'shiba.json'"
well it cant find the file
yeah ik

oof
oh rest in peace discord.js user
You have to give it the directory
Unless it's in the same folder as the code
You must give it path
What
idk
Who here is interested in converting a Python script to PHP?
gzys
throw err;
^
Error: Cannot find module 'C:\Users\itzem\Desktop\EasyTicket\run'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:17)
m
at Function.Module._load (internal/modules/cjs/loader.js:859:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71
:12)
code: 'MODULE_NOT_FOUND',
requireStack: []
}
PS C:\Users\itzem\Desktop\EasyTicket> node run index.js
internal/modules/cjs/loader.js:969
throw err;
^
Error: Cannot find module 'C:\Users\itzem\Desktop\EasyTicket\run'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:17)
m
at Function.Module._load (internal/modules/cjs/loader.js:859:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71
:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}```
help
what?
ah
const Discord = require('discord.js');
consttoken = 'MY TOKEN';
bot.on('ready', () =>{
console.log('EasyTicket Erfolgreich gestartet!');
})
bot.login(token);```
it doesnt comes a error
Uhm
Yup
am dum
what?
instead of consttoken you should have const token
what is the error
doesnt comes a error
Make a screenshot after you do node index.js
You have an extra space when between new and Discord.Client() ?
wdymn?
worked
Yeah
help
at WebSocketConnection.<anonymous> (C:\Users\itzem\Desktop\EasyTicket\node_modules\discord.js\src\client\ClientManager.js:48:41)
at Object.onceWrapper (events.js:412:26)
at WebSocketConnection.emit (events.js:305:20)
at WebSocketConnection.onClose (C:\Users\itzem\Desktop\EasyTicket\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:390:10)
at WebSocket.onClose (C:\Users\itzem\Desktop\EasyTicket\node_modules\ws\lib\event-target.js:124:16)
at WebSocket.emit (events.js:305:20)
at WebSocket.emitClose (C:\Users\itzem\Desktop\EasyTicket\node_modules\ws\lib\websocket.js:191:10)
at TLSSocket.socketOnClose (C:\Users\itzem\Desktop\EasyTicket\node_modules\ws\lib\websocket.js:850:15)
at TLSSocket.emit (events.js:317:22)
at net.js:667:12
(node:9444) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:9444) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
Incorrect login details given
no its righht
No is definitely not
oof
I'm guessing it's the wrong token you've given it for client
its right
Clearly not
It's is quite definitely wrong
i just found this gem for this channel






