#development
1 messages · Page 1040 of 1
Okay I'm gonna go learn nosql and be cooooool
hey can someone help me with one thing?
Yes
just ask
have you tried reading the error
^
um ya
That really helps
something before get is undefined
Send the code too X)
that simple, i know
lmao
It'll be fineeee there's nothing to worry about I'll just delete and start over again
discord.py: how would i go about changing bot prefix on a per-server basis? I could store it in a DB no problem, but not sure how I'd change the prefix just for one guild
Postgres is better ;)
Pregnabbaabnatsrte?
so guys uhh... if i switch to a vps uhh will i get errors?
It is a toy
it will give u a middle finger that very moment
Try it and see x)
Can someonneneneene help me with setting shit on a command basis to a mongodb using mongoose please :3
so guys uhh... if i switch to a vps uhh will i get errors?
@earnest phoenix no its just a case of runningpython bot.pyand leaving it lmao
@pale vessel men thanks
@earnest phoenix no its just a case of running
python bot.pyand leaving it lmao
@restive willow ?
or run it with js or whatever
you jsut run it like you noirmally would and leave it
oh cool whats the best vps? ill ask my mum to buy one for me x)
i use galaxygate its $3/mo for the basic plan
There is places like ovh
oh cool whats the best vps? ill ask my mum to buy one for me x)
please tell me
yeah but i need more oppinions
allow me to introduce you to google
@earnest phoenix a vps will give you full control over eveything, nothing is automatic
huh?
you will need to upload the code yourself using sftp/ssh clients, you will need to setup your own process manager such as pm2 to keep it alive, it wont update automatically until you manually restart it, etc
but a vps is fastly more powerful than any managed/automated provider and much cheaper
what is best?
there is no best, there are many good ones
im using galaxygate, but i also have a google compute engine
mongoose.connect('mongodb://localhost/test', {useNewUrlParser: true, useUnifiedTopology: true});
const db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', () => {
console.log('DB connected')
})
where do i go from here, how would i set a schema from a command file?
google enginen?
but i heard good things about contabo, ovh, vultr, etc
🇷🇺
theres also scaleway, vpsdime, and many others
im using galaxygate, but i also have a google compute engine
@quartz kindle whats a google compute engine?
upcloud is also a good newcomer
bruh
Guys can u help me
🚀 🖥️
@earnest phoenix its google's vps
I might buy a galaxy gate the prices are quite cheap considering what they are offering
@clever vector h?
aws
so why you using 2 vps?
dontasktoask
he said he has
AWS are quite expensive ngl
no bruh
i use the google one for my website and api, but im gonna move out soon
azure is more
google's f1-micro is free forever
i use the google one for my website and api, but im gonna move out soon
@quartz kindle api wdum
but their disks are slow
I had azure student credit lol
enjoy then
const foo = ({foo:'bar'})
bill gates is alwas hot
It ran out
uhhh help
wut is that lol
buy it 3 bucks is cheap
k
im using the $3 one
whats the ram tim
1gb
there are cheaper ones out there
cpu?
kk
uhhhh
no like database shit
chose ubuntu 20, so you dont have to upgrade later
ok
hostname is just the computer name
lts
root password is the admin password for it
ubuntu lts
chose ubuntu 20, so you dont have to upgrade later
@quartz kindle i only see 18.04

do i add protection?
ddos
what did you do?
protects against ddos attacks
when people know your ip address and spam it to make it go down
ur choice lol
hmm ill leave
give me invite for discord mee6
use cloudfare
?
if u want to
ddos protection is only needed if you think you're gonna be targeted by evil people for some reason
and if your ip address is public for some reason
for example if you have a popular game server
no ill leave
u are only doing for bot hosting then no need
im not famous
:crying:
dont cry for me argentina
lol
*louder crying*
lol
bruh
what do i do, just pass in mongoose.connection? wHaTtHeFuCkAmIsUpPoSeDtOdO
Tf?
lol
h
its taken i think
i put Deku Bot
no space bruh
?
oh
why spamming that
anyone got a promo code lmao
oov
yeah he never thought that
For all those people who find it more convenient to bother you with their question rather than search it for themselves.
tell some really hot apis
im confused uhh whats a street address i forgot
api.alexflipnote.dev @restive pebble
What street is your house at idk
home address lol
I normal just type my country
cool one
ice cream api
k

trolling
spotify api
wrapping
is nice idea
@earnest phoenix google where i am
How to check how many servers my bot is in?
guild size
i have a bot but its not out yet
https://discord.js.org/#/docs/main/stable/class/VoiceConnection?scrollTo=e-disconnect
How can i use this event on the bot voiceState in discord.js?
what are you trying to use it for?
I want every time my bot is disconnected from a voice chat, I want the bot to perform actions
use the voiceStateUpdate event, or you can use connection.on("disconnect")
ok how do i use galaxy gate?
Okay, but how do I check that the user disconnected from the voice channel is my bot?
voiceStates give you a user id
filter id
Okay, but it's also likely that my bot will automatically disconnect since it's finished playing music. I only want to detect when my bot is disconnected by another user
@earnest phoenix you need an ssh client, or you can use on of their tools in their admin panel
uhh how
how what, ssh or admin panel
im not sure
not sure what
the admin panel provides you with tools to access your vps
ok where is that?
similar to a glitch or a heroku terminal
otherwise you can download an ssh client, which works are your own dedicated terminal
so you dont need to login into their website every time
wait i need to pay 1 sec it could be a while intil i can pay tho cuz my mum is at work till 11:30 pm
oh you didnt buy it yet?
not yet
you need to buy first lol
;-;
Okay, but it's also likely that my bot will automatically disconnect since it's finished playing music. I only want to detect when my bot is disconnected by another user
@quartz kindle Can you help me with this?
ur bot is playing music?
Yes
@balmy knoll
ok
client.playing = true
in ur finish event
set client.playing = false
and if ur bot disconnects while true u can take actions
i do like that
Oh queueconstruct
@earnest phoenix but does that random package thing have background blur support
do you have it running 2 times
you're running your bot two times apparently
K
two bot instances
Lol
how to get the user ID of a random user instead of his name and tag? I know how to do message.guild.members.random.first() but it gives the name and tag and I use user IDs in the economy system to prevent with hunting
message.guild.members.random.first().user.id ?
longest chain i've ever seen
lol
did you ever made a Embed?
Lol
that's what i want exactly
Sup
why does discord.js have to die every five seconds
Are you trying to make a someone command?
it says cannot find module then 5 seconds later its good again
Are you trying to make a someone command?
@pure lion already did making a rob command for my economy system but i store user IDs to prevent "witch hunting"
That sounds like a you problem
Oh
if you are on v12 yes
cache
cache me ouside
if i add my bot to 2 servers it puts the same logs
how bow dat
same logs?
why does message.guild.members.random() give me user ID anyways? it's supposed to give user and tag right? Like it did in v11
it should give you the user object
it always gives you the full Object, you should always extract the piece of it you want, and never rely on its auto-extracting, since it can change
for example <Member>.user.tag
when you try to send a full object, or use it in strings, it will automatically use .toString() for you
so you can see in the docs what its .toString() does
It dosent mean I will solve it
Ok
the logs are going in test server 1 and test server 2 at the same time
please explain better, i dont know what you mean
Yeah
for ex
i muted boeing
its sends
boeing is muted in server 1 and is server 2
at the same time
show code
i guess use a Database that sends the userid of a Muted user in it. then have a timer running that checks every ~5 minutes if a user is muted if there is a new user in the db mute him on the server where he is not muted
the problem seems to be that the bot is posting log messages in multiple servers lol
if i make logs channel is 100 server and i add the bot then
@quartz kindle what i replace woth
message.guild
Imagine sending to all guilds lol
Ignoring exception in on_guild_post
Traceback (most recent call last):
File "/home/pythonbotsgig/.pyenv/versions/3.7.7/lib/python3.7/site-packages/discord/client.py", line 312, in _run_event
await coro(*args, **kwargs)
File "/home/pythonbotsgig/DAREALBOT/events/events.py", line 24, in on_guild_post
channel = await self.bot.fetch_channel(730747872798179360)
File "/home/pythonbotsgig/.pyenv/versions/3.7.7/lib/python3.7/site-packages/discord/client.py", line 1316, in fetch_channel
channel = factory(guild=guild, state=self._connection, data=data)
File "/home/pythonbotsgig/.pyenv/versions/3.7.7/lib/python3.7/site-packages/discord/channel.py", line 107, in __init__
self._update(guild, data)
File "/home/pythonbotsgig/.pyenv/versions/3.7.7/lib/python3.7/site-packages/discord/channel.py", line 131, in _update
self._fill_overwrites(data)
File "/home/pythonbotsgig/.pyenv/versions/3.7.7/lib/python3.7/site-packages/discord/abc.py", line 294, in _fill_overwrites
self._overwrites.append(_Overwrites(id=overridden_id, **overridden))
TypeError: __new__() got an unexpected keyword argument 'allow_new'
Why do I get this from
@commands.Cog.listener()
async def on_guild_post(self):
channel = await self.bot.fetch_channel(730747872798179360)
await channel.send('Server count posted successfully to DBL, next post in 30 mins.')
Python
well its not actually sending to all, since its a find function, it only returns one, but sure enough its likely the wrong guild
i dont think its random. i would guess the collection of guilds is sorted by id so you will send it to the Guild that is at the first place in the collection
Hey, i'm making a little web interface to manage my bot's configuration for the guilds, using express, but just i don't know how to get the data that is on the page. I saw an example looking like that :
app.post("/dashboard/:guildID/manage", async (req, res) => {
const guild = client.guilds.cache.get(req.params.guildID);
if (!guild) return res.redirect(404);
const isManaged = guild && !!guild.member(req.session.user.id) ? guild.member(req.session.user.id).hasPermission("MANAGE_GUILD") : false;
if (!isManaged && req.session.user.id !== "369564132770578432") res.redirect("/dashboard");
client.writeSettings(guild.id, req.body);
res.redirect("/dashboard/"+req.params.guildID+"/manage");
});```
To understand i tried to log req, and req.body, but it send me a giant bunch of things that i didn't understood, and nothing looking like the datas that i had on the website. would anyone know how i could at least just get the data the person entered ?
@distant jewel looks like its coming from internal code, try asking in the dpy support
wdym internal code
inside the library
when you fetch the channel, its trying to update the channel data, and i looks like its failing when updating channel premission overwrites
👍
^
@hasty lotus are you making a post request from client side js?
using fetch/xhr/ajax/jquery?
by client side, you mean the js file that has the express server ?
no, the code that is send to the browser
<button type="submit" class="btn btn-primary">Sauvegarder <i class="fa fa-fw fa-save" aria-hidden="true"></i></button>```
i've got this
yes
<tbody>
<% const settings = db.get(`guildconfig_${guild.id}`)
for (const key in settings) { %>
<tr>
<th scope="row" class="align-middle"><%= key %></th>
<td width="80%"><input type="text" class="form-control form-control-sm" style="text-align: left;" name="<%= key %>" id="<%= key %>" value="<%= settings[key] %>" placeholder="Enter <%= key %>"></td>
</tr>
<% } %>
</tbody>```
that's how i display the data if it can help
^^
are you using the bodyparser in express?
no
app.use(bodyParser.urlencoded({ extended: true }));
should be built in in express, let me check
ok
are you using express v4?
try this app.use(express.urlencoded({ extended: true }))
ok, so with the middleware enabled, you should be able to access req.body
and it should contain the form data you sent
My bot went offline so I checked what caused it but it just says "Killed".
Was my NodeJS application murdered 😦
the process was killed. did you use some additonal commandline parameters for starting the bot? bcs in future unhandled rejections will kill the process
and there is one commandline option for enabeling it already
While the mastermind himself is here, Tim do you have any idea what could be causing this, it appears when I'm doing a rolling restart on Kurasuta, it's a Veza error but even the creator or Veza doesn't know what could be causing it, I might have to add some logging to Veza itself to debug but I thought I could ask you before I do that. It's also weird that it only happens about 50-60% of the time, the other times it just works completely normal.
events.js:292
throw er; // Unhandled 'error' event
^
Error: This socket has been ended by the other party
at Socket.writeAfterFIN [as write] (net.js:454:14)
at NodeMessage.reply (/chip/node_modules/veza/dist/lib/Structures/NodeMessage.js:28:32)
at MasterIPC._broadcast (/chip/node_modules/kurasuta/dist/IPC/MasterIPC.js:45:21)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Emitted 'error' event on Socket instance at:
at emitErrorNT (net.js:1340:8)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
code: 'EPIPE'
}```
I only started it using node . and the only error I have is a potential memory leak.
EventEmitter leak
But it only says that because the limit
And I exceed that
But that should not make it kill itself
I wish it would tell me more why it killed itself
It ran for 3 days fine
some part of veza is not handling error and disconnection events properly, or maybe thet pass an error event that kurasuta is not listening to
Hey, just to come back to my web interface, the thing to get the body data worked fine, but when i click the button, the script to save the data in the db works, the db is saved, but the page continue to load, without any errors in the console. Any idea why ?
idk much about veza or kurasuta, but im assuming veza uses tcp sockets and kurasuta uses child processes, in that case when either server or client forcibly exit, ie for restarting, it throws an error down the pipe that must be handled by the other side
hi guis, i'm new 
Yeah kurasuta should be listening to it
sharder.on('error', error => console.error(error));
And yes they use TCP sockets and child processes
is that in your code or in kurasuta's code?
Mine
fuck typescript libs
lol
you cant see anything in their source code because its not compiled
whats MasterIPC.js line 45 after compilation?
uh sec
Line 45 exactly is
message.reply({ success: false, d: { name: error.name, message: error.message, stack: error.stack } });
In
async _broadcast(message) {
const { d } = message.data;
try {
const data = await this.broadcast(d);
message.reply({ success: true, d: data });
}
catch (error) {
message.reply({ success: false, d: { name: error.name, message: error.message, stack: error.stack } });
}
}
and that message.reply calls veza's NodeMessage.js line 28
Timo are u dutch?
this.client.socket.write(Header_1.createFromID(this.id, false, binarytf_1.serialize(content)));
in
reply(content) {
if (this.receptive) {
this.client.socket.write(Header_1.createFromID(this.id, false, binarytf_1.serialize(content)));
}
}
Yes I am
I noticed
veza is attempting to socket.write() after the socket has been closed
likely that veza is not closing the connection properly
well, Aadappel sounds quite dutch 😂
Just a question but what is veza?
an IPC library
Yeah Aardappel means potato
some advanced stuff
oh ok
aardappel is potato? lmao
Yeah
sounds like "hard apple"
aard means earth and appel means apple
lol sounds like a old german Dialekt
Applerel
🌍 🍎
Anyways, I should then add a check in their code to not write if the socket has been closed
or handle it
someone here have intagram i just want test instagram command
collects to much data for my taste
I mean looking at the error the connection is being closed by the API you're trying to refer to
something like that, either something is not marking the connection as "closed" properly, after receiving a FIN packet, or the destroyed connection is failing to send it before being killed
Doesn't the conection give a succes message?
but the error mentions "writeAferFIN" so im assuming the killed process is sending it correctly
Can someone help me with mongoose, I set up the connection and shit but I'm not sure how to add stuff and shiT
k I suck at mongo but I can try
Moongo
What are u trying to do?
i can help
I wanna just know how to add stuff to the db
I'll probably go for a check if the socket is closed or not
I know what I want to add(IDs and prefixes etc)
thats simple
you need to define a array of settings you want to send to the DB
guildID: guild.id
};````like this
not sure if it works for mongoose the same way but for MySQL I bind my connection to my client so I can access it in all my files
Superbrain thats an object not an array or am I stupid?
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
ohh wait yes object
How to set ur bot to have diff preflix? Like the server can change the preflix
Listen
Multiple prefixes?
then reference the Object to your Model and save your model
const newguild = await new Guild(newGuild);
return newguild.save()
create an array with the prefixes and then run a forofloop over the prefix array and if the message starts with that prefix then set the prefix to that prefix
If that made sense
NOPE
Guild is your Model
Wait...model?
So
Oh god I'm probably annoying everyone
mongoose use models for refering the Database structure
Can I have the code made?
No
No
😦
Spoonfeeding is against the rules
a model is again a Object
Its just 1 help 😉
Oh alright
Rules still apply
k
Create an array like this ["prefix1", "prefix2"]
Then run a for of loop like this:
for (const prefix of prefixArray) {
// Check if the message starts with "prefix" if so add it to a variable and use that
}
This is as much as I'll give u
The rest you can figure out yourself
Oh wait
Eventhough I didnt understand Thnx
guildID: {type: String,unique: true,index: true},
prefix: String});
mongoose.model('Guild', guildSchema);
as example
So if I wanted to store prefixes would I make a new schema?
No
you only need one schema
Okay
The prefixes and GuildID are in the same schema
this is the "framework" for your DB
Ooooook
with the Model.save() you create the Document
So I can have all my shit, like leveling and prefixes and wether it's enabled and disabled?
and your Model is defined witht he code i send you earlyer
yes
you can store stuff like Booleans easy
So model.save() is like ctx.fillStyle in the sense that it commits the shit to the shit?
http://node0.s8s.app/1IQL this is a part of the schema i use for my bot
when a guild is created it sets for everything a default value and store it to the DB
if you want to enable stuff you can use a Boolean to have it true or false
i have the ability to enable /disable commands in my bot
And then if I wanted to change it I just somehow get the value from the schema and overwrite it
so every time a command is used it checks if the command is enabled
Okay
you can update stuff
So to recap:
the schema is a sort of master copy of the thing you're gonna create for every guild ID?
the schema is how the Database looks
Okay
if the Bot joins a Guild it looks how the schema is build and create a Document after it
and fills out some stuff like the guildid and default values
how exactly is something you should find out since its spoonfeeding
@quartz kindle after some digging, the socket object has this
writable: true,
.on('guildCreate', h => { make the schema })
I can just check if that's true and don't write if it's false
you call the schema. you create a object that sets the Values in the schema
Alright
then save it
But what's confused me, where do I write the object? And how do I interact with it? Ex. (In my index) db.once('open', () => { //what goes here?})
The docs on quickstart were too quick
i dont use db.once(open)
What do you use?
are you sure you use mongoose?
i connet to the db and listen to the mongoose.on("connected") event. then i make it global aviable
Ah
mongoose is fun to use if you get the hang of it
Am confused
@twilit rapids sounds good
had the same issue when i used mongoose the first time
Mongoose is the name of the require in my index
can you show your schema?
Don't have one yet
wait nvm
Yeah
Would be a simple fix ngl
reply(content) {
if (this.receptive) {
if (this.client.socket.writable) {
this.client.socket.write(Header_1.createFromID(this.id, false, binarytf_1.serialize(content)));
}
}
}
const db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', () => {
console.log('DB connected')
})
if this helps
it logs db connected
mongoose.connection.on('connected', () => {
console.log('[NOTICE] Mongoose connection successfully opened!');
});
``` this is how i do it (dbOptions is a array with connection options)
then i export the connection and require it in my mainfile and attach it to my client
so i can use client.saveOne(object)
What are connection opts btw
const dbOptions = {
useNewUrlParser: true,
useUnifiedTopology: true,
poolSize: 5,
connectTimeoutMS: 10000,
family: 4
};
``` this are the one i use additional i set some other params
Alrighty
mongoose.set('useFindAndModify', false);
mongoose.set('useCreateIndex', true);
mongoose.Promise = global.Promise;
these 3 add some stuff that is handy
wait im checking if it works properly***
the 2nd one creates indexes for the Documents (i had issues with duplicates and this fixed it)
Okay I'll do that now brb
if you need more help feel free to ask
ill ask in a couple mins
if message.content == "|Quote" or "|quote":
quotes = ["Be yourself; everyone else is already taken.", "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.", "So many books, so little time", "Be who you are and say what you feel, because those who mind don't matter, and those who matter don't mind.", "You know you're in love when you can't fall asleep because reality is finally better than your dreams.", "Revenge is a fools game that fools win"]
await message.channel.send(random.choice(quotes))
bot spams again
i dont know how to fix it
are you sending the whole array?
Full code please
^^^
in codeblocks
@client.event
async def on_message(message)
if message.content == "|help":
await message.channel.send("Categories: Server, Games?, Memes, Animals and Misc. The prefix is |")
if message.content == "|server" or "|Server":
await message.channel.send("Kick, Ban, Mute, Warn, Unban, Unmute, Delwarn, Punishments, Banlock, Kicklock, Purge, ")
#fun stuff
if message.content == "|memes" or "|Memes":
await message.channel.send("Meme, Dank, Dad, Template, Anti, Game")
if message.content == "|animals" or "|Animals":
await message.channel.send("Animal, Dog, Cat, Snake, Duck, Fox, Ferret, Koala, Bunny, ")
if message.content == "|misc" or "|Misc":
await message.channel.send("Invite, Dice, Number, Quote, Say, Coin, RPS, Colour")
if message.content == "|Invite" or "|invite":
await message.channel.send("Invite with (put the bot link here)")
if message.content == "|Dice" or "|dice":
await message.channel.send("Choose: d4, d6, d8, d10, d20, d50, d100")
# if message.content == "d4":
if message.content == "|Number" or "|number":
print("ok")
await message.channel.send(random.randint(0,sys.maxsize))
if message.content == "|Quote" or "|quote":
quotes = ["Be yourself; everyone else is already taken.", "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.", "So many books, so little time", "Be who you are and say what you feel, because those who mind don't matter, and those who matter don't mind.", "You know you're in love when you can't fall asleep because reality is finally better than your dreams.", "Revenge is a fools game that fools win"]
await message.channel.send(random.choice(quotes))
if message.content == "|meme" or "|Meme":
meme_links = ["meme link", "meme link", "meme link"]
await message.channel.send(random.choice(meme_links))
bad code
Bismillah
message.send(quotes[index])
``` could be something for your random quotes
Are you sure you don't have many stances of the bot running
or mutiple bot instances
They're already choosing a random quote
ohh right nvm
3-8 bots running with the same code under the same token
no
how many messages did you get when you run your help command?
each "instance" responding to the command
how did u never tried it?
it was pausing
it sends 5 then pauses
and so on
and i assure you, i dont have anything else running
is your client.login inside some loop or event?
okay
I tried to add a VARCHAR column to my MySQL table but it said I didn't have enough space and had to use TEXT instead does it work the same or?
try Varchar(255)
np
@client.event
async def on_ready():
print("ready")
@client.event
async def on_message(message):
if message.content == "|help":
await message.channel.send("Categories: Server, Games?, Memes, Animals and Misc. The prefix is |")
if message.content == "|server" or "|Server":
await message.channel.send("Kick, Ban, Mute, Warn, Unban, Unmute, Delwarn, Punishments, Banlock, Kicklock, Purge, ")
#fun stuff
if message.content == "|memes" or "|Memes":
await message.channel.send("Meme, Dank, Dad, Template, Anti, Game")
if message.content == "|animals" or "|Animals":
await message.channel.send("Animal, Dog, Cat, Snake, Duck, Fox, Ferret, Koala, Bunny, ")
if message.content == "|misc" or "|Misc":
await message.channel.send("Invite, Dice, Number, Quote, Say, Coin, RPS, Colour")
if message.content == "|Invite" or "|invite":
await message.channel.send("Invite with (put the bot link here)")
if message.content == "|Dice" or "|dice":
await message.channel.send("Choose: d4, d6, d8, d10, d20, d50, d100")
# if message.content == "d4":
if message.content == "|Number" or "|number":
print("ok")
await message.channel.send(random.randint(0,sys.maxsize))
if message.content == "|Quote" or "|quote":
quotes = ["Be yourself; everyone else is already taken.", "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.", "So many books, so little time", "Be who you are and say what you feel, because those who mind don't matter, and those who matter don't mind.", "You know you're in love when you can't fall asleep because reality is finally better than your dreams.", "Revenge is a fools game that fools win"]
await message.channel.send(random.choice(quotes))
if message.content == "|meme" or "|Meme":
meme_links = ["meme link", "meme link", "meme link"]
await message.channel.send(random.choice(meme_links))
client.run(bot token)
Thats alot of code
try Varchar(255)
@tulip ledge actually, useVARCHAR(191)
yeah
Why 191?
for some reason emojis break varchar columns with 255 as length
I don't need emoji's
and 191 is the highest possible value without having this effect
if you store guild names i would use it with 191
No I'm storing some items from the user's inventory
then its fine
There is no user input so I don't need emoji's
ah, it's fine then ig
btw, just as an addendum, chinese characters and some UTF-16 chars also break 255 fields
what the fuck lmao
tim look away the code gives you grey hair
yeah, don't ask me why, spent a whole week trying to find out why my database was having a seizure
lmao
but like, with any string size or only if you actually exceed the string limit?
only VARCHAR(255) fields
but with any string size?
and any length above 191 actually
const sim = require("string-similarity");
module.exports = {
name: "kick",
description: "kicks a member",
execute(message, args) {
if (!message.member.roles.cache.has("730187390328504381"))
//Do they have the role?
return message.channel.send(
"You do not have the permissions to run this command!"
);
if (args.length == 0 || args[0].length == 0) {
//If no args were provided
return message.channel.send("You have to specify an user to kick!");
}
const member = message.guild.members.cache.get(
(args[0].search(/<?@?!?([0-9]+)>?/gm) == -1 //Is there a mention in the first argument?
? undefined
: args[0].replace(/<?@?!?([0-9]+)>?/gm, "$1").toString()) || //If so then return the id
message.guild.members.cache.find(
//Or else then look for the best match
member =>
member.user.username ==
sim.findBestMatch(
args[0],
message.guild.members.cache.map(member => member.user.username)
).bestMatch.target
).user.id
);
if (!member) {
return message.channel.send(
"You have to mention an user in this server to kick!"
);
}
if (member.user.id == message.author.id) {
return message.channel.send("Why would you want to kick yourself?");
}
let reason = args; // Get the reason
reason.shift();
member
.kick(
reason.length == 0
? "You were kicked from Server Staff Support server."
: reason.join(" ")
)
.then(() => {
return message.channel.send(`Sucessfully kicked ${member}!`);
})
.catch(Error => {
message.reply("I was unable to kick that member");
return console.log(Error);
});
}
};
@slender thistle Why do I get a error in VSC "moduel_not_found"
if you store a 10 char name on it with emojis
yeah, it does break
that makes no sense
ig it has something to do how the column is allocated idk
but like
i doubt that's the case you probably fucked something else up
varchar is variable characters, it should support strings with any length up to 255
can confirm that unicode emojis break a 255Varchar had the issue too back when i used Mysql
are you using proper character encoding
Like what?
the database assumes a maximum of 4 bytes for each character.
emoji's and stuff probably exceed the 4 bytes
The index key prefix length limit is 767 bytes for InnoDB tables that use the REDUNDANT or COMPACT row format. For example, you might hit this limit with a column prefix index of more than 191 characters on a TEXT or VARCHAR column, assuming a utf8mb4 character set and the maximum of 4 bytes for each character.
I cannot understand the control variable that will disable the event emitter
innodb_large_prefix is a setting in my.conf apparently used to change the assumption of 4 bytes per character
or idk where
It's a setting lol
from what i understand, this only happens on innoDB tables and when using reduntant/compact format, and with utf8mb4 and with a data size of 191+ characters with all of them using all 4 bytes
I use MySQL tho
sounds like a lot of conditions
innoDB is the database engine
oh
nvm
const guildSchema = mongoose.Schema({
_id: mongoose.Schema.Types.ObjectId,
guildID: {type: String, unique: true, index: true},
prefix: String,
w_gChannel: String,
info: Boolean,
ping: Boolean,
poll: Boolean,
uptime: Boolean
})
mongoose.model('Guild', guildSchema)
mongoose.Model.save()
no idea if this looks good or not but uhHHHH
not completly correct
okay, where am i looking?
at ur screen
funny
can the const be below and cmd?
wat
you need to create a object for saving data.````
Object{
guildID: guild.id,
prefix: "!"
}
wat
oh
ohhhhh
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
then reference the Object to the model
Can the const be here?
i dont code discord js but i think its this part
mongoose.model('Guild', guildSchema)
mongoose.Model.save()
so i just change all the shit to defaults?
Can the const be here?
@earnest phoenix no
@earnest phoenix no
@earnest phoenix no
So all the const should be above only?
not at all
you can't use any variable that's defined after the place of usage
because it doesn't exist yet
like ```
const db = New Guild(object)
then use db.save()
variable declarations are not hoisted, they have to be declared before being used, in a top down way
on the other hand, function declarations are hoisted, so if you declare it as a function instead, you can place it anywhere as long as its in the global scope
K
imagine if "discord scratch" existed 😂
😭
it does
I just wanted to say why not declare it as a function
lololol
imagine if "discord scratch" existed 😂
😭
@elfin flower a guy here created one
why
I don't remember who it was
cuz funny
also why not?
someone also wrote a bot with brainfuck.js
tf is that
now it's time for a delphi discord lib
google esolang brainfuck
brainfuck.js? why .js
brain.fuck
make a bot in scratch, its close enough
:DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
is the person called "Parmesan Linguine" the person who made it
++++++++++
[>+++++++>++++++++++>+++>+<<<<-] De initialiserende loop om de array te maken
>++. Print 'H'
>+. Print 'e'
+++++++. Print 'l'
. Print 'l'
+++. Print 'o'
>++. Print ' '
<<+++++++++++++++. Print 'W'
>. Print 'o'
+++. Print 'r'
------. Print 'l'
--------. Print 'd'
>+. Print '!'
>. Print newline
Holy jezus fuck
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
I have no clue lol
i
the brainfuck language is designed to create a fully functional programming language using as little different characters as possible
the entire language consists of 8 characters
i searched all over google
this regex is cursed enough that i feel like putting it here
the entire language consists of 6 characters
😿
\(0,\w\.default\)\(\w,\w\),\w=\(0,\w\.default\)\(\w,\w\),\w=\(0,\w\.default\)\(\w,\w\),\w=\(0,\w\.default\)\(\w\),\w=\(0,\w\.default\)\(\w\.id)
regex
regex
:O
it hurts my head
eye sore
what about my url detector regex?
".*?(?:^|[\\W])((ht|f)tp(s?)://|www\\.)(([\\w\\-]+\\.)+?([\\w\\-.~]+/?)*[\\p{Alnum}.,%_=?&#\\-+()\\[\\]*$~@!:/{};']*?)"
if i was ever forced to pick one of these:
learn regex or die
i would pick die
how
I think that brainfuck bot isn't a bot it looks more like a parser or something
just gotta ignore the urge to say 'fuck this, im out'
regex is like **&&(&((((({}{}}{:":&(((TBUS
its a brainfuck interpreter, not a brainfuck bot
its the same as coding
RIght like i thought
Can u link me like a doc for regex?
ok im
thats a great cheat spredcheat
I need to learn it too lmao
https://regex101.com/ this for testing and cheat codes
Regex101 allows you to create, debug, test and have your expressions explained for PHP, PCRE, Python, Golang and JavaScript. The website also features a community where you can share useful expressions.
this for general sense
ok
regex is annoying in the beginning. if you get the hang of it its nice to know
ok
@quartz kindle seems like that fixed it, i've been restarting my beta bot the past 15 minutes and not a single issue
im gonna
¯_(ツ)_/¯
the worst part about regex is checking the unicodes for other shit
@twilit rapids nice lmao
Just gonna double check with Kyra (veza dev) if anything can go wrong if it just falls silent if the socket isn't writeable
PLS HELP 😦
huh?
the only thing that could fail is if something else is expecting a return message or response, otherwise should be fine
you could also make use of that code to recheck/reset the connection state and/or return a proper error
This is coming again when I run the command
it also says in what line the error is
Yeah, but that's a bit above my knowledge of veza and sockets
db.save() is not a function
Oh no
OH NO
OH NOOOOOO
Are you okay
What should I do now?
No I'm not okay
message.ready doesnt exist
😦 🙂 :() 😐 :}
we told you
So what should I do about that?
fix it
some people tim, i swear lol
h
'ive pointed out the problem and even said what the problem is
message.reply() replies to a message
message.ready() is not a thing, it doesnt exist in discord.js
shouldnt the answer be obvious?
likely typed re then pressed enter and it auto filled
cuz he used it before 2 lines above
random.choice() is cool
Join for my server?
huh?
@junior maple no
PREFLIX?
lord have mercy
you don't need to check every time
hey friends
I'm having trouble with permission overwrites
if PREFLIX is defined, should be fine running that code
it is
U need to pay and stuff
you will get denied if you make no custom commands
no you'll just get denied
really?
to remove their ads and U r not doing any actual developping
i thought botghost was allowed if you had custom commands
To my knowledge they don't allow any form of bot.ghost bots
which is right
unless you want to ask a mod
okay
yea thats generally true
im aware its hard to catch copy pasted bot stuff without source, but im sure they'll block you if they see you using pre made bots
if u want to be a true developer bot ghost is bad
exactly
I mean don't they put the fact it's on bot ghost in the status
yea, unless you pay
tbh i like mee6 more than botghost
the ea of discord
and i hate mee6 with a burning passion
finally
yeah i am actually ok with that botghost thing
@earnest phoenix be careful, if the mod team see that, they'll have your bot denied, fast
someone that agrees mee6 is trash
a lot of people don't like mee6 but it's a bot after all. you don't have to invite it
yea
@misty sigil CONGRATULATIONS, YOU LEVELED UP! YOU ARE NOW LEVEL 9!

lol
HOW?
every fucking 5th message
How u level up?
i hate mee6
can't you disable it?
IKR
i prefer welcomer over mee6
@opal plank you are now level 75656
@opal plank you are now level 298731983892177312879382
BRUH
hold what does schrimp mean
BRUH
@earnest phoenix bruh to u
HUH?
I mean like to it smaller
🦐kek
🦐
schrimp image
though, for real, what do you mean schrimp a pic?
Oops no I got an idea
So you want to shrink an image. I assume you want it on your bot but I don't have any experience on it sadly.
shrink?
SO many MEE6?
K
hmm without DOM or css i havent really shrank images, i cant help much there
anyways, can anyone help me setup my channel overrides
havent you been here long enough to not expect spoonfeeding? thats better
jeremy can you be more specific
what you struggling with?
Hello
The error appearing is [INVALID_TYPE]: Supplied overwrites is not an Array or Collection of Permission Overwrites., its something to do with this code js await channel.overwritePermissions(muterole, { SEND_MESSAGES: false, ADD_REACTIONS: false });
I think
the first argument should be an array of collection to my knowledge
It should be ("MUTE_ROLE")
Here's an example https://discord.js.org/#/docs/main/stable/class/TextChannel?scrollTo=overwritePermissions
yes indeed
Each element should follow this structure: https://discord.js.org/#/docs/main/stable/typedef/OverwriteData
overwritePermissions is to change ALL permission overwrites for a channel
Nvm bye
to update a single permission in a channel, use .updateOverwrite()
the code you sent is valid for .updateOverwrite()
basic question
is there a way to write this down without having to rewrite reactions.emoji.name everytime with an array?
reaction.emoji.name === 'a' || 'b'
[a,b,c,d].includes(reaction.emoji.name)
How do i accept input in the console? Like windows batch file's set variableName /p =
what programming language?
@earnest phoenix interactive input, or input parameters?
@surreal notch its expecting an object
?
you can do this node myapp.js huehuehue somethinghere or even node myapp.js --option=10
No
which is not interactive
the interactive would be ```
node myapp.js
hello, chose a name:
myname
you chose myname
I want it to be so that when i run something in the app in the console( and by running smth i mean open it) it asks me "Enter smth" anf it gives the value to a variable
the interactive would be ```
node myapp.js
hello, chose a name:
you chose myname
@quartz kindle you got it now and a free p i n g for you
You want another ping or smth?
Lol
you can use process.stdin
?
