#development
1 messages · Page 1744 of 1
Let me grab my code
It's toLowerCase()
.toLowerCase()?
Yes
java script
.toLowerCase()
javaScript
I'll try
ecmaballs
still no
Has to
skill issue
its correct lmfao
Yeah
@pale vessel I think im just about done, my english file is 200 lines
const command = args.shift().ToLowercase();
what, english?
en-US.ts
Bruh
wait wtf
didn't you start with english?
const command = args.shift().toLowerCase()
@glad cobalt
GUYS PLSSSS HELP
well
my bot dm-ed me with something horror Pls Help
Hai
Regen your token
no I mean I used to have it cmd.description and now its CMD_${cmd.locale}_DESCRIPTION @pale vessel
i did that
Could anyone help me with the CSS on the site?
he is acting strange
what's the issue?
I've done that no errors, but it doesn't shift into lowercase or delete the -
so the command doesn't work
oh so you meant that you migrated those into the en-US file?
background-repeat: no-repeat; iirc
yes
Then you're handling the command the wrong way, show code
so thats why its 200 lines
Ill try it thx
ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
i seeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
ye
eg
client.on("message", async message => {
if(message.author.bot) return;
if(message.channel.type == 'dm') return;
if(message.content.startsWith(prefix)){
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
const commandToRun = client.commands.get(command)
if (!commandToRun) return;
try {
commandToRun.run(client, message, args);
} catch(error){
console.log(error);
}
}
})
the } are in right place
just the copying was trash
The code looks fine, if it doesn't execute any of the commands, it can't find that command in the collection, try logging command
And format your code, my god 
LOLOLO
Hey can we make a command in which messages by specific user gets deleted
Using discord.js in nodes.js
Check the author ID
is it possible to use thread locks with asynchronous methods?
for python
threads arent really the same but is there possibly a similar concept that would work for asynchronous methods
asyncio locks?
The second one would set A to a tuple
does that exist in python?
>>> a,b,c ,= 1,2,3
>>> a
1
>>> b
2
>>> c
3
which is literally the same as a,b,c = 1,2,3
Well, sort of. ,= errors if there's too many or too few values to unpack
then what actually is ,= operator.
ok
and is there any easy way to fetch all the messages, in certain period of time? in djs
i thought this would of worked:
client.on("channelUpdate", function (channel, oldChannel, newChannel, oldtopic, newtopic) {
let message = channel.guild.channels.cache.find(
(ch) => ch.name === "logs"
);
let embed = new Discord.MessageEmbed()
.setTitle(`Channel Updated`)
.setColor("ORANGE")
.setDescription(`A Channel Has Been Updated: \nOld Name: ${oldChannel} Old Topic: ${oldtopic}\nNew Name: ${newChannel} New Topic: ${newtopic}`).setTimestamp()
message.send(embed)
});
o
These parameters will be undefined
In your case, channel is the old channel and oldChannel is the new channel
You should rename those and use oldChannel.topic and newChannel.topic
o
Could anyone help me with the CSS on the site
I have this
<style>
.body {
background: url('https: //i.imgur.com/Uqdu35r.png');
background-repeat: no-repeat;
}
</style>
And it repeats the image
if(message.content === "/hi" {
return message.channel.send({
embed: {
description: `Hi Voltrex`
}
})
}```
here you go
if(message.content === "/hi") {
return message.channel.send({
embed: {
description: `Hi Voltrex`
}
})
}```
Mashallah, much better
try adding !important
!important?
custom.discord.re is outdated
Hi, a few days ago my bot started using shards, the problem now I have a lot of problems with counting for users or servers, is there a way to merge all members / servers of a shard into one count?
To see the servers count I use
$ {client.guilds.cache.size}
Below I leave 2 photos of the server count from 2 different shards
Lang: Javascript
https://cdn.discordapp.com/attachments/622379620674830346/840976774036324392/unknown.png
https://cdn.discordapp.com/attachments/622379620674830346/840976826213203979/unknown.png
Sharding is not necessary atm for your bot. It is needed from 2.5k servers
he has at least 1650 servers, which is a fine time to start sharding.
Oh I see. I thought to start at 2.5k lol
2.5k is when your bot will stop working
if you let it go to 2.5k youll have some serious issues to fix
2k is generally my recommendation, but for fast growing bots 1.5k is fine too.
Oh Ty!
Make a script which collects data after intervals like 60 secs from all shards and use that data
can someone help me with my nickname changed it doesnt seem to log if someone changes there nickname
client.on("guildMemberUpdate", function (oldMember, newMember) {
let message = oldMember.guild.channels.cache.find(
(ch) => ch.name === "logs"
);
let embed = new Discord.MessageEmbed()
.setTitle(`Nickname Changed`)
.setColor("ORANGE")
.setDescription(`Member Has Changed Their Nickname: \nOld Nickname: ${oldMember.nickname} \nNew Nickname: ${newMember.nickname}`).setTimestamp()
message.send(embed)
});
Does the logs channel exist?
yes
Also try logging anywhere in between just to check if the code gets executed
Also any error?
no errors, tried under a random channel didnt send anything
Try logging stuff
Hey I use PIL and I am attempting to paste a vector image over another image, but when the image is pasted the part that is supposed to be vector is black. Anyone know how to fix this?
thanks anyways
thanks man
i think it was intents not being enabled tried on my bot with it on it worked but shows the same name as the b4 and after so i tried with .displayname and this shows instead
sup
Any web dev here who want to work on a project ?
Figured it out I think
how to use get_channel
do you guys know any website, api or lib that encrypt and uncrypt codes in Js?
What do you mean by "encrypt codes"
I finally switched from json to mongodb, after 8 hours of changing code (I was working kinda slow, but okay..). Really happy that it is done, However my bot now takes longer than usual to respond to the command handlers. Is that normal?
Using mongo can be a little slower, but it shouldn't be that noticeable
alrighty, thank you!
I'm also SUPER proud of you for taking the step by the way
I want you to know that ^_^
like, to hide a code
you know when it is messed up
you cant understand anything
By "a code" do you mean javascript itself, or do you mean data like text
text
let me send you for example
Ok well there are quite a few encryption/decription methods
const _0x5383d1=function(_0x300d11,_0x536269,_0x4acf75,_0x2be0a6){return _0x2eae(_0x536269- -0x2e8,_0x2be0a6);},_0x1b7849=function(_0x7e6e7c,_0x282b8e,_0x2316bd,_0x59c574){return _0x2eae```
this is a part of a code
really?
can I send you the whole code in your DM?
cause I think this is encrypted
I cant understand this
Can you guys help me i want to if user don t have item in bag he can t use it and it said taht message and it didn t work because veryone can use command even if they don t hvae item in bag/inventory
the rest are variable names
@commands.cooldown(1,20,commands.BucketType.user)
async def fish(ctx):
item = "fishing pole"
res = await check_item(item)
if not res[0]:
if res[1]==1:
await ctx.send("You don't have :fishing_pole_and_fish: Fishing Pole. You can buy it in **shop**")
return
await open_account(ctx.author)
users = await get_bank_data()
user = ctx.author
earnings = random.randrange(420)
em = discord.Embed(title=f":fishing_pole_and_fish: You caught a fish and sold it for {earnings} :coin:", color = 0xf9b9ff)
await ctx.send(embed=em)
users[str(user.id)]["wallet"] += earnings
with open("mainbank.json","w") as f:
json.dump(users, f, indent = 4)
async def check_item(item_name):
item_name = item_name.lower()
name_ = None
for item in mainshop:
name = item["name"].lower()
if name == item_name:
name_ = name
break
if name_ == None:
return [False,1]
return [True,"Worked"]```
js?
Your inability to recognise hex-obfuscated javascript does not mean this is encryption. Encryption cannot be undone. This can
and hpw can I undo this?
thats what I want .-.
I thought this was encryption
no paython
No what you want is to have access to the code of someone who does not want you to read their code
The snippet above cannot be undone without any context
so idk, srry
And we're not here to teach you infosec
no
help--
what do you mean "no"
my friend sent me this and asked me to teach him how to uncrypt it
Is this your code?
but idk how to do this
no
Ok well he doesn't either
how do i dm someone with there name and tag? and without ID
idk what is it about
and we're not going to tell either of you how to do it
can you help me with my trouble? please
........
let validcolors = ['`Light Green <@>`\n', '`Light Blue <@>`\n', '`:star: Omega Almighty Booster Color <@>`']
i want to list this in an embed, how would i have it join and remove the , from it
why the hell do you think I can help you though
because you helped me last time
I can't help you with your code. I don't actually know python.
okay, but thank you for try to help me
i know a little bit of python, what is your issue?
this is my issue
....
validcolors.join(" ")?
Only way you could do that is to find the user in your caches. But... if you don't have them cached, it's not possible. you cannot get a user from their username or tag.
I send you my issue
even if they are in the same guild as the bot?
Can you gus help me with this - python
why do you check the mainshop
seems like an strange name for inv
so whjat I have to check? If I want to check bag
Well it is your code i guess
idk what your data structure is like so I can't help you with that
okay I am gonna try
okay thank you for that I don t knew about i have mainshop instead of bag
if not res[0]:
if res[1]==1: why does this look so strange?
The fact that you're still stuck on use JSON as a database like a caveman trying to beat rocks with a stick to communicate is the only thing that's really sticking out to me
(speaking to solic this time lol)
It does, a little bit. but it might also be perfectly fine. depends on context.

@commands.cooldown(1,20,commands.BucketType.user)
async def fish(ctx):
item = "fishing pole"
res = await check_item(item)
if not res[0]:
if res[1]==1:
await ctx.send("You don't have :fishing_pole_and_fish: Fishing Pole. You can buy it in **shop**")
return
await open_account(ctx.author)
users = await get_bank_data()
user = ctx.author
earnings = random.randrange(420)
em = discord.Embed(title=f":fishing_pole_and_fish: You caught a fish and sold it for {earnings} :coin:", color = 0xf9b9ff)
await ctx.send(embed=em)
users[str(user.id)]["wallet"] += earnings
with open("mainbank.json","w") as f:
json.dump(users, f, indent = 4)
async def check_item(item_name):
item_name = item_name.lower()
name_ = None
for item in bag:
name = item["name"].lower()
if name == item_name:
name_ = name
break
if name_ == None:
return [False,1]
return [True,"Worked"]```
IKR, I finally got you to relent after half a damn year but there's always another noob that really does NOT want to accept that using JSON is fucking stupid.
whahahahahah
how do i check if a user has a specific role
thanks for convincing me
It's a nonstop battle with idjits.
finally realized how easy it is with mongo, like reading and writing wise
if(message.member.roles.has('id')) {
would this work
can you guys help me with thjat it didn t working how I want
Hear this @zealous egret ? Stop using JSON. USE A DATABASE
I got this guy to move after 6 months, please don't take that long to smart up.
No my bot si small for that
No, it's not.
database cost money?
Use SQLIte, it's perfectly suitable for your purpose.
no, it's literally free
No, they're free. 100% free.
You could not be MORE free than using sqlite.
you just pay for extra storage
also why don't you just do this
item_name = item_name.lower()
for item in bag:
name = item['name'].lower()
if name == item_name:
return True
return False
okay i will but now I want help with that
or other addons
okay I am going to use
no. the help you get is use a database
that is your solution
and what is good or better on database?
easier
also I have no idea what the heck your code structure is so don't just copy pasta
The problem you are having right now, and all your problems, are 100% specifically due to you using JSON.
Use SQLite.
if not res[0]:
// your code to for users that have the fishing pole
else: ctx.channel.send(...).
return;
``` wait i mixed js with py
doesn't work how?
as she is already checking and awaiting the role to variable res
ôlike that?
if the user has a role, log 'yes' otherwise log 'no'
doesnt log anything
wait does member require an ID or just message.author
wut
member is a GuildMember, or it should be
if(colorchoice.toLowerCase() === 'light green') {
if(message.author.id.roles.cache.has('id')) {
console.log('ya')
}```
i tried msg.author.id, msg.author, and member
neither work
what to do with this?
item_name = item_name.lower()
name_ = None
for item in bag:
name = item["name"].lower()
if name == item_name:
name_ = name
break
if name_ == None:
return [False,1]
return [True,"Worked"]
item_name = item_name.lower()
for item in bag:
name = item['name'].lower()
if name == item_name:
return True
return False```
can you guys reedit it please
I'm just wondering why you need the name_ variable, just return once you find the item you want
your code is wonky imo
async def check_item(item_name):
item_name = item_name.lower()
for item in bag:
name = item['name'].lower()
if name == item_name:
return True
return False
if (message.member.roles.cache.some(role => role.name === 'Green')) {
console.log('ya')```
sadly doesnt work
also what the hell is bag
no you didn't put any indentations
therefore it won't work
also why do you return a list
in the old code
why do you need that
i found my issue i used args(1) instead of (0) 
if you're just checking if something is true just return a bool
can you reedit please
I have no clue
async def check_item(item_name):
item_name = item_name.lower()
for item in bag:
name = item['name'].lower()
if name == item_name:
return True
return False
essage.member.roles.remove(role => role.name === 'Green')
async def check_item(item_name):
item_name = item_name.lower()
name_ = None
for item in bag:
name = item["name"].lower()
if name == item_name:
name_ = name
break
if name_ == None:
return [False,1]
return [True,"Worked"]
can i remove a role with a role name, if so how
please rewrite
i tried this
message.member.roles.remove(role => role.name === 'Green')
I'm not gonna rewrite your code for you
no rewrite but say what to do
because I still don t understand what replace
aren't you just checking if an item is in the bag?
yes I am or?
item_name = item_name.lower()
name_ = None
for item in bag:
name = item["name"].lower()
if name == item_name:
name_ = name
break
if name_ == None:
return [False,1]
return [True,"Worked"]```
just iterate until you find the item, if you find it return True, if you don't find it return false
or store stuff in a dictionary so it does it O(1) time
and how to do that?

bento u do js?
message.member.roles.remove(role => role.name === 'Green')```
if so, how come the above doesn't work?
do js is an overstatement of my abilities
well code in js
know a very small amount would be better
ah ic
yeah i can't help you samm, sry
ah i figured out how to do it, no worries
okay
# this code is wack
item_name = item_name.lower()
name_ = None
for item in bag:
name = item["name"].lower()
if name == item_name:
name_ = name
break
if name_ == None:
return [False,1]
return [True,"Worked"]
# this code is a not wack version
item_name = item_name.lower()
for item in bag:
name = item['name'].lower()
if name == item_name:
return True
return False
@commands.cooldown(1,20,commands.BucketType.user)
async def fish(ctx):
item = "fishing pole"
res = await check_item(item)
if not res[0]:
if res[1]==1:
await ctx.send("You don't have :fishing_pole_and_fish: Fishing Pole. You can buy it in **shop**")
return
await open_account(ctx.author)
users = await get_bank_data()
user = ctx.author
earnings = random.randrange(420)
em = discord.Embed(title=f":fishing_pole_and_fish: You caught a fish and sold it for {earnings} :coin:", color = 0xf9b9ff)
await ctx.send(embed=em)
users[str(user.id)]["wallet"] += earnings
with open("mainbank.json","w") as f:
json.dump(users, f, indent = 4)
async def check_item(item_name):
item_name = item_name.lower()
name_ = None
for item in bag:
name = item["name"].lower()
if name == item_name:
name_ = name
break
if name_ == None:
return [False,1]
return [True,"Worked"]
yeah okay that's your weird code again
okay, that s fine but I want to it works now to it will b simple
i don't know what that sentence means
I mean i want to it will works when you have fishing pole you can use fish and when do not have it you can t
easy
Yeah ik that
Do you understand how to search through an inventory
Or an array in this case
I don t know how so I am asking
You don’t know how to search an array...
You might want to go learn some basics in coding before trying to make a bot
I know basics but don t know that one thing
so please send a doc of it or say how to do it
Of how to find if something is in a list?
yeah
Vps
how though
Uhh
Just go watch a YouTube video or smthn there are a lot on hosting bots
That’s also a decent source of info
dafuq is that
what language is that even
is that supposed to be javascript/discord.js?
Oh jesus god almighty
is there any free vps?
pythonscript.net on rails
Please read:
#development message
No
I know Js, but I just forgot how to do this😐
... no sorry kid you clearly do NOT know javascript
Ok then 👍
I host from ionos
A linux Server with ubuntu costs about 1€ per month with Full Access
like 99% of everything everyone recommends thats not an actual VPS
Do you know what is the name of the NPM module to get information about an NPM package?
you know what's funny? Doing a search for search npm packages through nodejs reveals absolutely no useful results because that's like googling for google
I mean, you could always scrape the page
I mean I know there are packages
but no sweet easy package for that
show models/premiumKey.js
const { Schema, model } = require("mongoose");
module.exports = model(
"premium-keys",
new Schema({
Key: String,
})
);
@quartz kindle
dont you have to instantiate the model too?
ill send everything related
if key is "create", you make a new premKey
if key is not "create", premKey is never instantiated
the command im running is c!premium create
that should make the key no?
does this even work?
you export an empty collection, because the function is not run
does running the function afterwards actually affect the exported collection?
this looks weird af
no i dont even have something in mongodb yet
also, the function is completely async with no way to wait for it
even if the collection worked, you'd have to guess when its ready
can you fix it @quartz kindle ?
welcome
every teacher ever be like
lol

if (message.content == "https://images-ext-1.discordapp.net/external/8b2pWECsnPiAoTIi4YFcunJ0f-0p3tuN2tfWecRtZDg/http/images.mewbot.xyz/img/sprites/282-0-.png") {
return message.channel.send("Gardevoir");
};
or
if (message.content == "https://images-ext-1.discordapp.net/external/8b2pWECsnPiAoTIi4YFcunJ0f-0p3tuN2tfWecRtZDg/http/images.mewbot.xyz/img/sprites/282-0-.png") return message.channel.send("Gardevoir");
no difference
if char count is something you have an orgasm over
use whatever you prefer
using brackets is usually recommended to avoid confusion
an if without brackets only works if you have a single expression, anything more than that it wont work anymore
if(a) something; is the same as:
if(a) { something; }
but
if(a) something; somethingElse; is the same as:
if(a) { something }; somethingElse; and not:
if(a) { something; somethingElse; }
One message removed from a suspended account.
One message removed from a suspended account.
no u
Or just use prettier https://prettier.io/
I hv a string like, "some34more9andmore78"
And I want to convert this string in an array like this
["some", 34, "more", 9, "andmore", 78]
What be the best approach to tackle this in js?
Been playing around with a permissions API for slash commands. I think I have something I like now lol
commands
.guild({
name: "admin-only",
description: "A restricted command",
default_permission: false,
permissions: async (guild) =>
guild.roles
.filter((role) => BigInt(role.permissions) & Permissions.ADMINISTRATOR)
.map((role) => ({
id: role.id,
type: ApplicationCommandPermissionType.ROLE,
permission: true,
})),
})
.pipe(
RxO.flatMap(({ respond }) => respond({ content: "You are the special." })),
)
.subscribe();
Creates a command like this:
or just treat semicolon as a wall
everything after it IS a new line, independently if you broke it or not
Regex
Anyone know why have (promise) ? It cause my bot not work ig
guys, is there any docs that talks about how to make slash commands on d.js?
oh wow, can u paste the code here
which is another confusing point that is resolved by always using semis
semis for life
it's technically a colon, but still not a colon - it's a semicolon
Promise's need to be awaited, or use .then()
meanwhile pythoneers: "Where tf I missed a tab???"
lmao
ty
you can find this easily with google
yeah, I couldnt find ;-;
Hmm those docs definitely over-simplify it. You need to keep slash commands in sync. If you decide to rename a command for example, the old command won't get removed automatically.
idk, I write in python
oh gosh, that's hellot of work done there
so it seems, regex is way more perfomant
in ts, can I grab, constructor parameter types directly from class itself
that would be the same as getting a function's inputs probably
guys, im having a problem here with the guildMemberAdd on discord v12
Are you having troubles receiving events or using them? Did you enable intents?
a lot of tutorials send text with the following:
client.on('guildMemberAdd', async member => {
//if he is not in a server
if (!member.guild) return;
let guild = member.guild;
//find my server ID
let channel = guild.channels.cache.get("836374069985280032");
//find my channel ID from server
let welcomeChannel = channel?.guild.channels.cache.get("836374070642999327");
let membercount = guild.members
if (!channel) return;
console.log("new user detected");
console.log(`username: ${member.user.username}`);
let embed = new MessageEmbed()
.setColor("GREEN")
.setTitle("New Server Member!")
.setDescription(`Welcome, ${member.user.tag} to **${guild.name}!**`)
.setThumbnail(member.user.displayAvatarURL())
.setFooter(`You are the ${membercount}th member to join`);
//send message as EMBED
(welcomeChannel as TextChannel).send(embed);
});
yes, i have enabled
On the developer portal and when initializing the client?
i cant find a way to send a message to the desired text channel
developer portal only
i just want someone to help me confirm something, so im looking at applying join roles that people didnt get from my bot due to it being offline
You'll need to enable them when initializing your client so you receive them from the gateway.
- https://discordjs.guide/popular-topics/intents.html#problems-in-version-12 (how to set it in the client)
- https://discord.js.org/#/docs/main/stable/class/Intents (the intents class to pick and choose what intents you want)
final List<Long> joinRoles = JoinRoleCache.get().getEntity(guild.getId());
if (!joinRoles.isEmpty()) {
LOGGER.info("Applying join roles in guild {} for {} members.", guild.getName(), guild.getMemberCount());
for (final Member member : guild.getMemberCache()) {
final List<Long> roleIds = member.getRoles().stream().map(Role::getIdLong).collect(Collectors.toList());
joinRoles.stream().filter(roleId -> !roleIds.contains(roleId)).forEach(roleId -> {
final Role role = guild.getRoleById(roleId);
if (role == null) {
LOGGER.info("Got null as a result for role ID {}", roleId);
} else {
LOGGER.info("Attempting to apply role {} to user {} in guild {}", role.getName(), member.getUser().getAsTag(), guild.getName());
guild.addRoleToMember(member, role).queue(null, ex -> LOGGER.info("Failed to apply role to member", ex));
}
});
}
}
``` just to clarify this should be adding all the join roles to the member
joinRoles being a list of configured roles for people to not get on join
can you add syntax highlighting pls
It looks like so, but the best way to tell is to test it. Though, it looks like you'll run into rate limits given your implementation.
it doesn't spam it
if it runs into a rate limit
it'll just wait for that period to be over
Yeah but that would accumulate rate limits
cant really think of any other way to avoid that
Though you could use methods like modifyMemberRoles to minimize it
So it sets all the roles for a single member in one API request as opposed to an API request for each role to add
yah
thanks
Can I stop prettier to format my empty functions like this?
function () {}
i hate this format.
I'm fine with this
function () {
}
Prettier has configuration options you can apply, but I don't know if they have one for formatting empty function bodies as so.
I've only used ESLint in the past.
@sudden geyser theres a warning on the doc of modifyMemberRoles, it says it shouldn't be used more than once within 1 event listener cycle, i take it that just means that it shouldn't use it twice in the same listener?
The full warning:
This may not be used together with any other role add/remove/modify methods for the same Member within one event listener cycle! The changes made by this require cache updates which are triggered by lifecycle events which are received later. This may only be called again once the specific Member has been updated by a GenericGuildMemberEvent targeting the same Member.
It basically means you can't call another one of the update member role methods (though I don't know what "cycle" refers to in this context). It would only be safe to call other methods if a GenericGuildMemberEvent event was received later (which you probably can't time efficiently).
The goal of prettier is not to please everyone 🙂
So after you call modifyMemberRoles, you can't call the same method or an add/remove method either.
thanks for the links, i have enabled the desired intents but the bot dont recognize the function guildMemberAdd
Are you getting an error, or is nothing happening?
Nothing happening
not even entering on console.log()
And you have definitely enabled this?
yes
Can you copy paste your new Client(...) code?
//Enable some intents to collect data from guild
export const client: Client = new Client({
ws: {
intents: [
"GUILDS",
"GUILD_MESSAGES",
"GUILD_INVITES",
"GUILD_MEMBERS",
"GUILD_PRESENCES",
"GUILD_VOICE_STATES",
],
},
});
Hmm looks good.
And this does nothing?:
client.on('guildMemberAdd', (member) => console.log(member));
java smelly
Java's ok.
PHP gang
tries not to vomit
i'm like one out the only 5 here who codes php in top.gg
bruh
it worked
im gonna look at code step by step again
funny enough it started to print the values from console.log() now but its not sending messages yet
thanks @prime mist
i commented my code, compiled the one you sent and then it started to work like wtf
In Postgres, how would you insert a date into a column with only its year?
dont insult me, im high 
BLOODY MARIADB as i should swear
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
virtual colum that does a divide by zero brings down the ENTIRE server on debian 10.
as in the entire database daemon, boom, poof, gone
"what, you wanted to do this thing that should be trivially handled? fuck you, developer. im gonna crash instead!"
so much for mature and stable software 
anyone have a list of preferred_locale options for discord
guys..
I randomly get an error
saying module pack utils was not found
I never mentioned utils in any of my code
or ever enev created/needed one.
(ping if going to help please)
@quaint wasp Check the call stack of the error and see which file is using a module that imports util
<?php for($i=0;$i<100;$i++){if(!($i%3)&&(!($i%5)))if(!$i)0;else echo"FizzBuzz\n";elseif(!($i%3))echo"Fizz\n";elseif(!($i%5))echo"Buzz\n";}?>
@quartz kindle im trying to learn how to write PHP 1 line code for the first time
any advice/thoughts/feedback?
cyanide pills are always an option
One message removed from a suspended account.
this is another masterpiece of mine, the fibonacci sequence
<?php $x=$z=0;$y=1;$n=8;for($i=0;$i<$n;$i++){$x=$y;$y=$z;$z=$x+$y;echo$z."\n";}?>
loops aren't meant to be a one-liner, yours is more like "making code more unreasable"
mimified code looks more readable than that
you should obfuscate it
it is minified though
dont make me take the Google™️ route of minifying my code
i'll turn this shit into alphabet soup code
is there a way to pass in everything in an SQL statement?
invot VALUES()
INSERT (c1, c2, c3, c4) VALUES($) => [1,2,3,4]```
something like that?
instead of
INSERT (c1, c2, c3, c4) VALUES($1, $2, $3, $4) => [1,2,3,4]```
Its because you didn't trigger it when nich was updated.... it gets triggered even if any pther property such as roles or etc are updated
what really?
Anyone know how to make a bot looking to get one made
Everyone with the badge "Bot Developer", knows, how to create a bot.
ok thank you
how can I declare a type in ts, that accepts all the instantiable Child classes of a abstract Base Class?
I give it the first day they're introduced to have JS newbies ask here about tuples
I like the Records more
There was this deno lib that already supports them
Don't remember exactly which
hello
What are Records, again?
f wait
Because you are not important enough
and when i refresh the page i get error 400
500 means server error
bruh ill just dm u @slender thistle
So that's issue with topgg
I doubt that statement
y, thts what that role is for
It's for whoever owns a bot that's approved on top.gg
And that doesn't always equal knowledge.
Your bot needs uptime but uptimerobot is running ?
whaaaaatttt ?
The bot not running ?
You can't host bot on Glitch anymore
Well, this hurts
imagine paying 10$ on Glitch for a bot when you can get 2 (isc 4) VPS with the price
i second that, after i saw some of people with that role haha
When you live long enough in this channel, as other say, I can certain your view will differ.
hey!
Typescript kinda has tuples [123, "thing"] as const
I have this function which adds the coins to 'final': ```js
module.exports.addCoins = async (guildId, userId, coins) => {
return await mongo().then(async (mongoose) => {
try {
console.log('Running roulette
')
const result = await profileSchema.findOneAndUpdate(
{
guildId,
userId,
},
{
guildId,
userId,
$inc: {
coins,
},
},
{
upsert: true,
new: true,
}
)
coinsCache[`${guildId}-${userId}`] = result.coins
return result.coins
} finally {
mongoose.connection.close()
}
})
}``` how do i do the opposite? So removing the amount 'final' from the total amount
it's gonna be const result -= await profileSchema.findOneAndUpdate() maybe?
embed.set_image(url = 'attachment://Suitsaur #33.png')
This is not working, any idea?
The gap where r and # will void try making the file have - (if it’s not that try hosting the image on a website)
Uhm not working either by changing the name.
I got bunch of images and hosting it will mess up the the names for a specific conditions.
How I connect a discord collection to my mongodb database?
How can I do like the the name of replied person?
Like
-upto
And then they mentions the person @lavish bramble
What lang are you using?
Javascript
How long needs a bot to be approved?
//make an embed
const m = await message.channel.send(`<@${message.author.id}>`)
setTimeout(function() {
m.edit(embed)
},100)```
This is my code for my private bot. It works.
You have already asked in #support know. Why are you asking again?
Sir
I didn't get a answer
By using message.mentions.members.first()
Can it work like when I reply to you
i don't understand
Yes
I will show my ss wait a sec
@lavish bramble
Spaxter already explained you everything. No need to ask again.
So how can I get the message id also?
collection.filter(user => user.username === 'Bob');
These is the docs
I get results but my bot is not one of the results...
what are you trying to do
He is asking when will his bot will be approved lol.
oh
guys in the docs I dont find how to delcare a connection and connect it to a database
let collection = new Collection(ProfileModels);
collection.filter(ProfileModels => ProfileModels.serverID === message.guild.id);
I tried this but it gives me this error UnhandledPromiseRejectionWarning: TypeError: function is not iterable (cannot read property Symbol(Symbol.iterator))
idk what is going on but i hope that i will be able to authorize soon
in top gg site
you cannot do that
store ids of the entities you need in your database
then using that piece together the data you need
in your code
In my database I have already a lot of documents I want to take them from the database applying a filter
okay
that is by serverID
but you can't do what you're trying to do
but y
because it doesn't work like that
you cannot store a full ass discord entity in your database
a) property recursion
b) you're going to have stale data
you only store ids in your database
pull those ids
then you fetch/get the entity in your code via that id
how I pull the ID's?
🤷♂️
because I assume I pull the ID's and put them into the collection
and after that I filter them
right?
How do I make a purge command for my discord.py bot?
i want myself to be able to login / authorrize
in top gg site
i can't use a bot without voting it
pls i hope someone workin on it
how I connect my daabase to a collection, I'm gonna cry because I found nothing
I've watched discord.js docs and nothing, Map.js docs and nothing
tysm to everyone lmao
exports.run = async (client, message, args) => {
if (args) {
var amount = Number(args[0]);
}
else {
return message.reply("Please specify a bet.");
}
const guildId = message.guild.id
const userId = message.author.id
const bal = await economy.getCoins(guildId, userId)```why is this still giving me an asyc -await error?
mean isn't it already in my exports.run...
no
where did the error actually come from
that code is giving me headaches
some stuff have semi colons, some dont
the return is in brackets
theres no indentation
var
extra newlines for no fucking reason

its a 10 line snippet, why so much pain?
i just noticed
wtf
@eternal ospreyjesus christ add a linter
exports.run = async (client, message, args) => {
let amount = 0;
if (args) amount = Number(args[0]);
else return message.reply("Please specify a bet.");
const guildId = message.guild.id,
userId = message.author.id,
bal = await economy.getCoins(guildId, userId)
}```
and check if args[0] is a number
otherwise NaN

he legit used var just to abuse scopes
Erwin: screaming
inb4 Erwins 5am washing neighbour kills Erwin before Erwin kills the 5am washing neighbours
I'd say it's too early
TypeError: Object of type datetime is not JSON serializable
woohoo!
To verify a discord bot do you need to be above 18?
16+
Ahh ok cool
that means i can 😎
Noice
@slender thistle can u tell me if in a running loop an error comes, how to ignore it and continue the loop in Python. should i give code
>>> for i in range(10):
... try:
... print('Result: ', (i + 1) / i)
... except ZeroDivisionError:
... continue
... print(i)
...
Result: 2.0
1
Result: 1.5
2
Result: 1.3333333333333333
3
Result: 1.25
4
Result: 1.2
5
Result: 1.1666666666666667
6
Result: 1.1428571428571428
7
Result: 1.125
8
Result: 1.1111111111111112
9
await member.send('Hellooo see i sent u a DM')
except (HTTPException, ValueError):
pass```
i did this
can someone help me
To continue to next iteration use continue
hello
no, i want to ignore the exeption, and continue the loop
Hi state your issue before asking if anyone can help
ohhh, ok
Then use continue in the except branch, yeah
How are you trying to log into a bot
top dot gg
Can you provide a screenshot
That happens when you try to submit a bot, correct?
Sure
Guys how I connect my collection to my database? IDK how to do it, and in docs I cant find it,also googling it
async def accept(ctx, *, msg):
ok = msg.split(' ')
for each in ok:
webhooks = await ctx.channel.webhooks()
webhook = discord.utils.get(webhooks, name='SVRP OP')
if webhook is None:
webhook = await ctx.channel.create_webhook(name="SVRP OP")
await webhook.send(f'{each} ||. Your application has been **Accepted for the Interview**. You will get notified about the time of interview at #interview-announcement.', username=f'{ctx.author.display_name} .SVRP', avatar_url=ctx.author.avatar_url)
member = each.strip("<!@>")
member = await client.fetch_user(int(member))
try:
await member.send('**Congratulations!!** Your application for SVRP Whitelist has been **Accepted for the Interview**. You will get notified about the time of interview at #interview-announcement.')
except (HTTPException, ValueError):
continue```
This is the error : `Command raised an exception: ValueError: invalid literal for int() with base 10: ''`
I did continue, but..... still is giving error @slender thistle
i really need to fix this i can make another accont but i handle lot of server with this account this is really important
In one or multiple iterations member is either literally <@!> or an empty string generally
And you try to convert that into int
?
how can i do that
she telling me
That aside, are you aware of how try-except works?
ohk
yes a little
It's an issue with top.gg
You'll have to wait until it's fixed
can u login shivacco
Guys how I connect my collection to my database? IDK how to do it, and in docs I cant find it,also googling it
have u tried to lgin
So, what you are doing is handling only the message sending. The rest is not caught in a try branch, therefore it's erroring out and stopping
Honestly though, I advise using if statements instead of relying on exceptions
how??
he
shivaco
reply
have u tried to login
and aftermath wut happens
send a pic
of that

In your case you can either:
- Wrap your entire loop body in a try-except. Example:
for each in ok:
try:
# yada yada
# something causing an error
except HTTPException, ValueError:
continue
- Use an
ifstatement tocontinueifmemberis empty. Example:
for each in ok:
member = each.strip("<!@>")
if not member: # member will be a "falsey" value, in this case an empty string
continue
# do other stuff
My laptop doesn't like it when I run PyCharm 🤷
yes, actually i also got it becoz when the bot was tring to get the id it was no int, but a blank space so the loop broke and putting the member fetcher line under try, it will work, let me check it, Thank you veryyyy veryyy much sirr..

what you use to record
ShareX
u r soo fast u even added music to it...., hats offf
I installed OBS yesterday but recording kept lagging and idk why
Nah that's me listening to music and being lazy to turn off virtual audio recorder
OBS ain't a thing I wanna use KEKW
sounds like fucked up settings
waaaaah waaaah NOICE
probably but idk
would guess way to high bitrate
its autoset to 2500 Kbps
@slender thistle thank you sir 😘😘 it worked
@slender thistle when i used anime girls pfp on my id, ppl thought i was a girl, and same goes for u also, i also thought u were a girl 😂😂
i wrote mam
and then i read ur name carefully
then wrote sir...
It happens, no worries
did you try to stream or record?
just record
how much FPS did you use for recording?
I put it to 60
@pale vessel tomorrow, u gave this snippet. "some34more9and+more78".match(/[a-zA-Z]+|[0-9]+/g).map(elem => isNaN(+elem) ? elem : +elem)
But now I want this string "long12+krt89df-efdhjj67nmn" to give this array,
["long", 12, "+kr", "t", 89, "df", "-ef", "dhjj", 67, "nmn"]
Basically, if there is + or - I want to extract its next two characters separately
try 30 FPS and see if its better (youtube anyways tends to set it to 30 fps)
ok
read the database stuff and push it into a collection
but hoooow
idk what database did you use, what language did you use, what lib did you use
You using js? If so, string.split() might work
mongodb
did you know how to read stuff from mongoDB?
If u mean how to output datas , I know a kinda way
but only for the profile
IDk how to explain it
but beg, bal, dep works
yea 30fps runs better
if you call .set(key,data) on your collection you can add stuff to it
let leaderboard = new Collection();
console.log(leaderboard);
for the moment this is my code, I know thath the declaration is made in the right way because I have the log Collection(0) [Map] {}
collections are mostly like maps
so you can use most methods that maps support also on collections
I know this
then where is the issue?
and I have already read this
maybe because I'm stupid, or maybe because I'm blind I dont find anuthing about pushing database inside collection
what does the database return? if its a object you can store objects inside a map. if you want to store mutiple documents in the map, use a loop to set the stuff to the map
maybe this is what you want..
const database = await <mongo schema>.find()
for(let data of database) {
<collection>.set(anything, you want from data)
}
leaderbord.map(function( serverID, UserID, bank)
forEach could cause issues bcs it does not respect async behavior
for in would be way better
so use for?
for with the profileModel (my database name).lenght()?
hey is there any way to get names of all commands a bot has
i mean i'm running bot on two different hosts
one with all cmds
yeah
and other with no cmds
so what i wanna do is retrive all cmd names from that other instance of the bot
But why
i'm using one instance for webpage
to show the details of number of servers
channels and all
You can do that in one instance though
umm.. heroku sucks
console.log(leaderboard);
const database = await ProfileModels.find()
for(let data of database){
leaderboard.set(serverID, userID, bank)
}
console.log(`dopo il push del database ${leaderboard}`);```
I've tried this but error
With slashs commands ?
?
serverID not defined, but It Is a field of my db
Ah
So you have one instance on some host and the webpage on Heroku?
do you mean like, a field in your schema/structure?
the code takes the varailable serverID.. not soms sort of field...
but how I can extract Only the three fields I want
so basically something like
the bot post data to webpage
when requested isn't there any other way round?
i mean
You can make the API send and receive data just fine 👀
well oke
i have 0 idea what your doing... can you give some context ._.
dont kekw me
I want to do a leaderbord of my coins system
dumb me thought i could fetch the cmds from discord API or something
Nah
makes sense
Commands are what your bot does when receiving message events
It's all local unless you use slash commands, and even then I'm not sure you can fetch that 
you are using mongodb right? how do you store the coins?
lol oke i get it
So what you very possibly want is to have your bot host an HTTP/websocket listener that's attached to your bot object (which can be done via the superior aiohttp)
and then your API sends a request to that listener and receives a list of commands
Very possibly in a JSON format
yes, I'm using mongo, wdym about storing coins
I believe you know how you can implement that for your own use case
like are you doing something like
userid => amountOfCoins
or something likd
userid => {
...
amountOfCoins
}
etc
sorry i suck at explaining/teaching
definetly lol
but I want to filter First by the serverID (guild.id) and after the userID (Primary Key) and the coins connected to userID
Sorry I suck in Reading comprehension
hm
data from your database
i quit, my brain fried. sowwy.
so it'll be like:
let leaderboard = new Collection();
console.log(leaderboard);
const database = await ProfileModels.find()
for (let data of database) {
if (!leaderboard.get(data.serverID)) {
leaderboard.set(data.serverID, [{ userID: data.userID, bank: data.bank }])
} else {
const struct = { userID: data.userID, bank: data.bank }
leaderboard.get(data.serverID).push(struct)
}
}
console.log(`dopo il push del database ${leaderboard}`);
you can get all the stored user data by leaderboard.get('guild id here')
pog
weakling
How do I make it show voted user avatar using top.gg/sdk
sorry i can only withstand lowdb and minecraft protocol 😔
cough #topgg-api cough
In SQL and javascript, when i select in my table, how can i get true (if record exist) or false (if record not exist)?
I do this but my send send me always « no » if record exists or no..
let antiFullCaps = options.database.promise().query(`SELECT * FROM antiFullCaps WHERE guild_id = '${message.guild.id}'`); antiFullCaps === true ? antiFullCaps = "yes" : antiFullCaps = "no";
Cause it's a promise, first thing
SELECT COALESCE('yes', 'no') FROM antiFullCaps WHERE guild_id = :id
there's no true/false in sql
only 1 and 0
ok thx
not only that, === true a boolean true doesn't exist anyways, js converts anything to a string... dumb js
oops forgot to disable the mention
what
Well, that makes more sense 
or... what you fetch, he/she/it ... err whatever, leave me alone

I'm done and being just here to fuck up KuuHaKu
just because he's a good guy

don't even understand myself the shit I'm talking... god
running more bots with 300+ servers under the same ip can cause issues?
can't imagine the bandwidth limit would be an issue, so probably not
no u are the good guy
also shit this is disgusting
This is most likely slow (since it uses regex AND reduce because I'm dumb), but here it is anyway. I've been trying for the past hour now and I'm fucking done lmao. Not that good at regex
Honestly that sounds pretty easy to do with a single for loop
wtf is that doing?
I feel like that's literally overcomplicated beyond all recognition lmfao
like, if it was to extract 2 letters preceeded by + or - it'd be just (?<=[\+-]).{2}
omg, that so much appreciatate, thanks.
But how it took only 1.34ms to run?
because regex
console.log gives me [object Map]
what do you want to log?
Regexes in small cases are fine, but large-scale you want to avoid them
I want to check if data is stored inside
and after that the sort thing etc
just console.log(leaderboard)
[object Map]
hmm, sus
amongus
but tomorrow, the stats were different, around 150ms with simple regex
you logged an empty collection
r u sure?
const profileSchema = new mongoose.Schema({
userID: {type: String, require : true, unique : true },
serverID: {type: String, require : true },
coins: {type: Number, default : 10 },
bank: {type: Number, default: 0 },
tier: {type: Number, default: 0 },
nlavoratori: {type: Number, default: 1 },
});
const model = mongoose.model('ProfileModels', profileSchema);
module.exports = model;```
did you want to log here?
this is the schema
yup. and it gave me the object map
nono, I've deleted the first one, now in the code I have only the second
it shouldn't give object map tho if you use console.log
that second shouldn't (can't) show [object Map]
afaik it'll be object map if it's on string
it shows exactlly that
it'll be dopo il push del database [object Map]
2021-05-12T12:37:04.844212+00:00 app[Worker.1]: dopo il push del database [object Map]
with only console.log(leaderboard) shuld work?
yes
I'm not sure it'll work
most likely it'll convert the collection to string and result in the same thing
"""shorter""" one
I have no idea what I'm doing
Well, I do but
yes
I still don't get it, what's the goal?
only bank is declared as a number, ID's are string
and I'm not using a for loop
Literally this #development message
yeah, but, what's the goal? extract 2 letters preceeded by + or -?
He wanted to separate the numbers and non-numbers
2021-05-12T12:46:28.176720+00:00 app[Worker.1]: { userID: '658234646932357140', bank: 20000 },
this is mine profile and i see a lot of others
it worked
but then he needs to split a part of the string that starts with either + or -, followed by 2 characters next to it
nice
I see
I'll be back for destroy your mind with the sort
Can't you just do that with a for loop
Definitely
but I'm too used to reduce()
@rocky hearth Use #development message instead if you would actually use my code
Hi, I've some questions related to the ShardingManager of Discord.js:
- Can the number of shards evolves at runtime?
- Can a guild change shard at runtime?
ok thx
ezpz
that's not the goal
else this would suffice
if I understood right, it must:
A - separate strings from number and
B - separate pairs that are preceeded by + or -
tbf, a loop would still be easier for that
for loop way
just fulfill B then check for A on the remaining string
Ya well I cba to do that in Python
wait why isn't 12 a number
ah I see
there
yeah there's def a better way to do it with a for loop
^ And it takes 0.07 milliseconds
leaderboard.filter(data => data.serverID === message.guild.id);
Why this doesnt filter?








