#development
1 messages ยท Page 1660 of 1
maybe instead of trying to fix this error... try to fix the npm install quick.db one?
Codding language
I use node.js
Help with
i created my first bot now i need to make commands ,I want to make a command were the bot dm the mentioned user a message sent from the person used the command
etc.+dm @breadlife#7389 hi man
Y as the opetion
yes
y
your VPS' internet?
home
That doesn't stop the installation
Codding language
I use node.js
Help with
i created my first bot now i need to make commands ,I want to make a command were the bot dm the mentioned user a message sent from the person used the command
etc.+dm @breadlife#7389 hi man
first of all, you need to make that command opt-out
how
as in, the user can choose not to receive messages
whats the permission required to fetchInvites?
MANAGE_INVITES iirc
in the dev portal
manage server maybe?
like, think as an user
what perm would allow you to access invites page?
i got this error now:
@cinder patio All i had to do was npm uninstall quick.db
and npm i quick.db
how can i do something like this
Using CSS & HTML
You don't, the white text over the white background is unreadable
lmao yeah
Here is a guide of sorts https://custom.discord.re/
lol
text is #FEFEFE
laughs
Error: Could not locate the bindings file. Tried:
First step:
- Delete node modules.
- Delete package.json .
- Delete package-lock.json
After
- Type npm init to create package.json file
- Run the bot and load all modules
(i did this)
also boy, imagine using those commands without turk keyboard
you dont need to delete package.json lol
uninstalling and re-installing worked
I know I did that and it was solved :D
That's the first rule of life.
phew
just finished creating a 2800 question set for animal crossing
that was hard work
breh
can someone please help me? I am coding a command which sends the deleted message and if that deleted message has the image in it, The bot will set that attachment as an image.
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.
guild.leave() ๐
not with a command
idk then
How then
Oh, that's... uhm... super bad.
have fun having 4 total guilds
Alright well, just get guild.me on guildCreate and check its permissions
wat
read messages*
on the guildCreate event, you get a guild object. That object has a me property which is your bot's member on that guild
Check that member's permissions. if it doesn't have the ones you want, call guild.leave()
lets just not do that
Ok so what do you want then
problem solved
Oh yes, remove the problem completely, alright. 
eval(code)
hello I'm looking for a developer to make an economy bot (more details in mp) against money
please read #general message
??
lmao
Should'nt this work?
im italian i dont even know if what i said is an actual sentence
Use !== not ===, otherwise everyone except you can access your eval
sit and wait
For How Much ?
an hour minimum
;_; Really
the request returned a response that isn't valid json
Ok Fixed
read the link I sent
You made that? @umbral zealot
the link
it uses your id so ig
wait what is config?
im italian i dont understand everything
Yes, I wrote most of that entire guide
oh wow
config is like the imported module that have the bot's owner id
I did learn the basic from it, yes
well then we should all thank hindsight :DDDD
The parent of the text needs to be a block
<div style="text-align: center">
<b>Text</b>
</div>
y e s
import discord
from discord.ext import commands
import json
import os
import random
os.chdir("C:\\Users\\ravi_\\Desktop\\Discord Bots\\Mail")
client = commands.Bot(command_prefix = m!)
@client.event
async def on_ready():
print("Ready")
@client.command()
async def balance(ctx):
await open_account(ctx.author)
users = await get_bank_data()
wallet_amt = users[str(user.id)]["wallet"]
bank_amt = users[str(user.id)]["bank"]
em = discord.Embed(title = f"{ctx.author.name}'s balance", color = discord.Color.red())
em.add_field(name = "Wallet balance",value = wallet_amt)
em.add_field(name = "Bank balance",value = bank_amt)
await ctx.send(embed = em)
@client.command()
async def beg(ctx):
await open_account(ctx.author)
users = await get_bank_data()
user = ctx.author
earnings = random.randrange(101)
await ctx.send(f"Some gave you {earning} coins!!")
users[str(user.id)]["wallet"] += earnings
with open("bank.json","w") as f:
json.dump(users,f)
async def open_account(user):
user = await get_bank_data()
if str(user.id) in users:
return False
else:
users[str(user.id)] = {}
users[str(user.id)]["wallet"] = 10
user[str(user.id)]["bank"] = 0
with open("bank.json","w") as f:
json.dump(users,f)
return True
async def get_bank_dat():
with open("bank.json", "r") as f:
user = json.load(f)
return users
client.run("Token")
``` My error ``` File "C:\Users\ravi_\Desktop\Discord Bots\EconomyManager\main.py", line 9
client = commands.Bot(command_prefix = m!)
^
SyntaxError: invalid syntax
``` I want my prefix to be m! so tell meh how to do that without an error
you can't compare a string with m!
because m! don't exist
what exists is "m!"
remember:
quoted = string
not quoted = variable/method/class/whatever
KEKW
oh I have to quote m!
KEKW
for this
Hey guys! I just got into coding, and I have no knowledge on an error that I'm getting. Can someone shoot me a dm?
just show the error here
if your not using vscode to do it then procced but if yes then idk
That's a yes.
I did.
Should I be good?
yo that's not necessary
you do'nt need a 30GB install shit just to run a node-gyp build
Run npm i -g --add-python-to-path --production windows-build-tools in an admin command prompt or powershell.
that should fix it.
I run that in powershell?
Gotcha.
Guys how to make a shutdown cmd?
could this work?
if(message.author.id !== config.ownerID) return;
client.destroy()
client.login(config.token)
}```
after you destroy, why you want to login again?
my bad
my brain was thinking about shutdown and restart at the same time
im stupid
It's either process.exit(0) or <client>.destroy() will do
to reboot it you can do with pm2 module and such
yeah but i am on replit.com, and this site literally gives you a button to make it run
im trying to pass it
on vsc
yeah it works on vsc
i think im going to use vsc forever.
users = await get_bank_data():
^
SyntaxError: invalid syntax ```
```js
import discord
from discord.ext import commands
import json
import os
import random
os.chdir("C:\\Users\\ravi_\\Desktop\\Discord Bots\\Mail")
client = commands.Bot(command_prefix = "m!")
@client.event
async def on_ready():
print("Ready")
@client.command()
async def balance(ctx):
await open_account(ctx.author)
users = await get_bank_data():
wallet_amt = users[str(user.id)]["wallet"]
bank_amt = users[str(user.id)]["bank"]
em = discord.Embed(title = f"{ctx.author.name}'s balance", color = discord.Color.red())
em.add_field(name = "Wallet balance",value = wallet_amt)
em.add_field(name = "Bank balance",value = bank_amt)
await ctx.send(embed = em)
@client.command()
async def beg(ctx):
await open_account(ctx.author)
users = await get_bank_data()
user = ctx.author
earnings = random.randrange(101)
await ctx.send(f"Some gave you {earning} coins!!")
users[str(user.id)]["wallet"] += earnings
with open("bank.json","w") as f:
json.dump(users,f)
async def open_account(user):
user = await get_bank_data()
if str(user.id) in users:
return False
else:
users[str(user.id)] = {}
users[str(user.id)]["wallet"] = 10
user[str(user.id)]["bank"] = 0
with open("bank.json","w") as f:
json.dump(users,f)
return True
async def get_bank_dat():
with open("bank.json", "r") as f:
user = json.load(f)
return users
``` The error above and code
Remove that :
Lul
yes hello
File "C:\Users\ravi_\Desktop\Discord Bots\EconomyManager\main.py", line 35
users = await get_bank_data()
^
IndentationError: unindent does not match any outer indentation level``` Now what
yes the basics
clearly not the basics
lmfao
Nice
What should I add to the top row?
what
oh
well what's that supposed to be
also you definitely need more padding on your elements
make it less dense
๐
Yes
File "C:\Users\ravi_\Desktop\Discord Bots\EconomyManager\main.py", line 35
await users = get_bank_data()
^
SyntaxError: cannot assign to await expression ``` What to do
how to make this in discord.js?
I know its not that new, but I cant find it in the docs
It's not in v12 yet, it will probably be released with v13
ok and with an other discord api?
idk
code ```js
import discord
from discord.ext import commands
import json
import os
import asyncio
import random
os.chdir("C:\Users\ravi_\Desktop\Discord Bots\Mail")
client = commands.Bot(command_prefix = "m!")
@client.event
async def on_ready():
print("Ready")
@client.command()
async def balance(ctx):
await open_account(ctx.author)
users = await get_bank_data()
wallet_amt = users[str(user.id)]["wallet"]
bank_amt = users[str(user.id)]["bank"]
em = discord.Embed(title = f"{ctx.author.name}'s balance", color = discord.Color.red())
em.add_field(name = "Wallet balance",value = wallet_amt)
em.add_field(name = "Bank balance",value = bank_amt)
await ctx.send(embed = em)
@client.command()
async def beg(ctx):
await open_account(ctx.author)
await users = get_bank_data()
user = ctx.author
earnings = random.randrange(101)
await ctx.send(f"Some gave you {earning} coins!!")
users[str(user.id)]["wallet"] += earnings
with open("bank.json","w") as f:
json.dump(users,f)
async def open_account(user):
users = await get_bank_data()
if str(user.id) in users:
return False
else:
users[str(user.id)] = {}
users[str(user.id)]["wallet"] = 10
user[str(user.id)]["bank"] = 0
with open("bank.json","w") as f:
json.dump(users,f)
return True
async def get_bank_dat():
with open("bank.json", "r") as f:
user = json.load(f)
return users
client.run("NO-NO-MY-TOKEN")
Can ya help meh with my problem?
your indentation couldn't be wronger
I set up my bot so that it will insult me when this section of the code starts working properly
So far, it has not insulted me
lol
Hey, a small question: I've just started my bot with MongoDB Atlas and wanted to migrate the data I had into more collections. I backed up the data as JSON Files and kinda f*cked up, because all my primary keys got changed, what made me lose about 400 user-ids. Is there a way to recover old data or at least view a history of what I did?
?
Well, my bot works now, and it insulted me
....
Consider writing a script to change the keys back, if possible
But first, mongodump your database to create a backup
The primary keys were the user-ids, there are no more relations to the users
Oh, ok
Hello everyone, does anyone know if there is an easy way in the discord library to track if someone have 2 open instances of the same command or prevent them from opening 2 active instances of the same command? e.g. if a command uses **bot.wait_for **, and i dont want same user to open same command twice, i know there are multiple ways i can implement this, i was just was wondering if the discord library had something made already
ok thanks guys ๐
yea i was gonna implement it my self, but i thought, that if discord has something already implemented, then it would have been better
?
that doesn't come with the lib and no, there's no easy way
like, it is easy as in "the implementation is easy", but hard as in "the concept is hard"
is there any opensource command handler for discord.js that you guys would suggest
some people use comando
although I suggest doing one yourself
it's not that hard
yeah
can i know how to return http status 200 to the webhook?
res.sendStatus(200)
so should i send it at last?
ok
well, its better than JSON
anythings better than json
its a good DB itself but the deployment in free versions is pretty weak

paid version though is powerful
yeah paid version isnt really an option for now :c i will eventually get paid version probably
you could just buy a vps and host both
is there some sort of event that fires in nodejs when a new thing gets printed to the console?
would be cheaper and more performant
not an event tho
but you can put that in a loop to listen to any newline
read stdout
stdout returns Stream which implements EventListener
has a data event
what can i do for this
what even is that-
do you even eye?
Are you hacking someone or something ( อกโข อส อกโข )
obviously
nop
Do you guys have online school?
I go to school every weekday
yh same lol
I think I will just make an event emitter and make my code emit the log event and stuff everytime it wants to log something
sounds easier to me
that would be the "proper" way of doing it anyway
you can even take a design approach where you emit an object that contains the data necessary
i.e.
//take it that priority is an enum that scales up
//INFORMATION | WARN | ERROR | CRITICAL...
{
priority: 0,
source: "penis.js#run()",
message: "Hello!",
error: null | an Error object
}
you can even add a toString method in that object that would combine all of that into a single string
can webhooks add emojis to their own messages?
reactions?
yes
nope
webhooks aren't actually users
yeah
ima add a bot that adds reactions on a message that gets sent in a specific channel
or maybe just do it manually tbh

what should I add to a bot (As in economy)
games
coronavirus
no
Bitcoin miner
blackjack 
I might actually do that
overpriced hardware
No premium 
guys quick help
???
guild.owner
that'll give you the owner member object
not the id
the owner is not granted to be in cache
guild.ownerID
^
k ty
Why doesn't my code print anything on a vote?
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print('Vote recieved!')
print(data)
message.author.JoinedAt Is that a thing?
no, but message.member.joinedAt is
Oh, thanks.
does anyone know how to solve asyncpg.exceptions.InvalidTextRepresentationError: invalid input syntax for type json errors? i have no idea why theyre popping up as all my json is valid, and it appears at random occasionally, as far as i can tell
apparently your json is invalid 
but whyyy ....i ran the exact command that caused the error and it worked fine, yet when another user did they got the error qwq
well what's your json
if you want the date that the author was created then its message.author.createdAt

that's english
not a good question
whats the difference between .avatarURL() and .displayAvatarURL()
read the docs
A link to the user's avatar if they have one. Otherwise a link to their default avatar will be returned.
and avatarURL() is just "A link to the user's avatar."
ok cool
css is being a pain right now lol, need help aligning divs in the center of the page like the following
div1 div2
div3 div4
div5 div6
etc
Any reasons not to use a framework like bootstrap or tailwind?
flexboxes!
One of the reasons that flexbox quickly caught the interest of web developers is that it brought proper alignment capabilities to the web for the first time. It enabled proper vertical alignment, so we can at last easily center a box. In this guide, we will take a thorough look at how the alignment and justification properties work in Flexbox.
i dont use bootstrap for my websites

i make a bot to
most websites i make are small anyways
yea
maybe its something about making all the code myself or having full control of it lol
let me post the bot
and proper design language
chances are that your site doesn't follow consistent design language and/or looks like crap
you should only really separate from frameworks when you've had a few years of uiux experience and have "the eye" for it
ugh
whats wrong
nothing
but it's genuinely just skill, you just have to practice ui/ux to become good at it
found a way to convert objects to binary
I mean
um
well technically they were in binary in the first place
what you're probably doing is stringifying the object and then converting the text to binary
which is inefficient
I was working on a function, but it was making the code very sl0w:
applyText(canvas, text, defaultFontSize, width, font, option){
const ctx = canvas.getContext("2d");
do {
ctx.font = `${(defaultFontSize -= 1)}px ${font}`;
} while (ctx.measureText(text).width > width);
if(defaultFontSize > 100 && option) ctx.font = `${100}px Gagalin`;
return ctx.font;
}
``` any idea if there is alternative?
hm
good alternative lol
Very
it takes 2 secs
how do i add a gif on a image
like a welcome image with animated avatar
how you usually would

am i wrong tho?
if message.content == message.content.upper() and len(message.content) > 5 and not profanity.contains_profanity(message.content):``` this is correct no?
the contains profanity part?
py ofc cuz other langs for nerds
AttributeError: module 'profanity' has no attribute 'contains_profanity'```
that library is 7 years old
and abandoned
also don't bother with profanity filters
read from here
yeah i dont care that much
i just wanna block like normal cuss words
eh ill just use a txt
Hey I feel stupid for asking this but how would I make a countdown to 30 using a for loop?
anyone know how to do this reply thing with d.js?
Discord.js didn't release it yet. They're replacing message.reply with it in version 13. You'll have to code your own way by forking the project.
you can install from the github repo
i figured so. i await that.
is it stable enough to use for a bot with ~100 servers?
Most likely.
cuz i rlly wanna add that to my bot
yeah you can just install from the repo
be aware there might be some breaking changes
๐
if you're going to do it, make sure to fork it then install from your fork
this way you can control upstream changes
i don't think this has changed but i'll check the source just to make sure
okay it hasn't
it'll take a while, i'd rather wait myself
dont have github 
but send me link and ill run a test bot w/ it
just search for djs github
first thing on google
im on mobile so it's a pain in the ass
search through the pull requests section
replies were merged a looooong time ago
really?
yes
what?
Co-authored-by: Jan 66554238+Vaporox@users.noreply.github.com
wasn't it only that ^
sec let me get on my laptop
i just wanna download the v13 code 
https://github.com/discordjs/discord.js/commit/60e5a0e46f57cf297b66f1a940d24a20f46b5319 merged almost 4 months ago
had no clue
how the fuck do i get d.js 13 
its not on the internet
aaaaa
i give up
bots automatically reboot themselves right?
there is no v13
not yet at least
๐
i want to do inline reply ๐ฉ
you can try using master
thats v12
in some cases, yes
most likely not tho
how do i get master? do i get it from the github?
that moment when i wish i was on linux rn
whelp i need to be able to fetch members so
breaking changes

not broken changes
The other changes, not really sure
alr im on 14.5 so should be decent
still wish i was on linux rn
yo tim i kinda am liking the looks of d.js v13
wat about when it crashes?
to make it do that run it within a batch script like the following: bat :loop node index.js goto loop
oh yea that is right batch scripts
ye

npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno -4058
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/discordjs/discord.js.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Joseph Winkie\AppData\Roaming\npm-cache\_logs\2021-03-19T22_10_11_921Z-debug.log
PS C:\Users\Joseph Winkie\Documents\discordbot\invite-count-bot-v1.0.0> ```
wouldn't it crash from it trying to run over and over again
nah, it waits till the node index.js is done exectuing, and because d.js is async mostly, its not done till crash or process.exit()
you need to have git installed in your system
to install packages directly from github
that moment when i wish i was on linux
know what
fuck it
laptop time
you can easily install git on windows
is there a way u can do a java version
tbh im looking for an excuse to install linux on my desktop

then do it lul
just replace node index.js with however you run your bot from cmd
I figured
not familiar with the java d.api wrapper
use a process manager
Im just using java because it is easier to import and export files on it
keeping a process running is not the program's job, it requires an external mechanism or tool
but i have to go in and clean up all my files n shit
dual boot
tbh i use js because its what i learned, and its rlly better imo for parcing strings to have other data (bc dynamic typing)
yea it does have some really cool string features
thats not almost full lmao
c: is an ssd and your supposed to keep those mostly empty i heard

๐ฉ choices
the only issue is aur is nonexistent on debian
im on ubuntu rn but i feel like switching to debian at some point, if i ever get another vps
i personally prefer Ubuntu over debian
i prefer debian over ubuntu
ยฏ_(ใ)_/ยฏ
how so?
but ubuntu is nice bc you can just boot installer, and let it run and its more ready to go than windows
well im talking about mostly for servers
For me its mostly because of python work and Rust
oh uhhhh i dont have a server aka i use my main desktop to host my disc bot
Ubuntu is easier for me to setup with py3.8 pre-installed on 20 and rust installs considerably easier than debian which for some reason installing can be a real pain
although i use docker for everything i occasionally still need it
i wanted to give arch a try, but i heard it has issues with jemalloc
i gave arch a try but it has problems with my laptop because hp
tho i think it might work on my desktop bc i built it so generic intell chipset right?
perhaps
arch is pretty nice tho ngl
drivers in general are a pain in most linux distros
aur is like a selling point
good thing you dont need drivers for servers
ngl debian non-free installer kinda works
sharex wyd
bre
lol
nice pfp (;
LOL thanks u too

i just do a batch script and process.exit() to restart
hey
hey Awsome
let filtered = allItems.filter((x) => x[1]);
let final = filtered.map((x) => x[1])
console.log(final)
if(message.content.includes(final)){```why is this not triggering my message.channel.send code?
i am typing hello guys, one of the words in the array
but it doesn't trigger it
can you help me with mine ๐
Use <Array>#some()
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some
The some() method tests whether
at least oneย element in the array passes the test implemented by the provided
function. It returns true if, in the array, it finds an element for which the provided function returns true; otherwise it returns false. It doesn't modify the array.
content is a string so do js array.some(a => message.content.includes(a))
have it run js process.exit() on a restart command and launch bot using bat :loop //launch bot goto loop to start bot
i made a reload command but for some reason other people are able to use it too
if(!message.author.id === "560282666361159690") {
return;
}
else{```
i did that but still
oops lemme bin that

3 equals is same type so your asking if their id is a string. try 2 equals to see if its equivalent
okay
and also you can leave out the ! and use the else as the inverse
do !== for NOT operations
okay
- if (!yourVariable === yourOtherVariable) // !yourVariable is coereced to a boolean value
+ if (yourVariable !== yourOtherVariable) // checks that one is not equal to the other
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Comparison
This chapter describes JavaScript's expressions and operators,
including assignment, comparison, arithmetic, bitwise, logical, string, ternary and
more.
thanks voltrex and jj33
but its an if else so you can just swap places and not use a not
imma do if(message.author.id !== "userid)
if(message.author.id !== "560282666361159690") {
return;
}```
this basically ^
as to why, the inverter at the beginning is converting the id to a boolean (truthy/falsey values)
which will obviously never be true
yes that's correct
okay lemme ask my freind to test it out
true dat
k it works
so that would mean if its not that user id
yea
shouldnt != work
sure
use a process manager
like pm2
and then process.exit()
just process.exit() and have a auto restart bat script
tell him not me
im not good at those ๐ญ
lmao
i said use a process manager, literally the easiest thing to set up
pm2 is a bunch of overengineered garbage

cron jobs and you're done (on linux)
fs?
message.channel.send('Restarting...').then(m => {
client.destroy().then(() => {
client.login('token');
});
});
``` would this work?
no
because the client will be destroyed
you're effectively doing nothing with that
and it won't even restart probably
if(message.author.id == "560282666361159690") {
await message.channel.send("๐ | restarting.")
process.exit()
}``` @earnest phoenix and then launch the bot using ```bat
:loop
node index.js
goto loop```
that wont reload the files
oh i got one
this
(message.content === 'restartthebot') {
if (message.author.id !== 'Owners ID') return; message.channel.send('Restarted.').then(() => { process.exit(1); }) };```
^ ?
yes but you need a process manager or cron job
but the cmd name is too long so yes it will be restart not restartthebot
Doing any of that doesn't restart a process
process managers are easy to setup: https://npmjs.com/package/pm2
remove the !== because that means only non-owners can run it
Manage your applications state so you can start, stop, restart and delete processes dynamically:
https://discordjs.guide/improving-dev-environment/pm2.html
okay
but otherwise that will work @earnest phoenix and just launch it using bat script
How do I import it
amogus
but you haven't even tried..

import am0gus
One day I'm gonna sell an API endpoint service that sends you random among us fanart pics
What the hell
Just you wait
yes
now im intrigued
Also make a limit to query those
This is #development what the hell
amogus.sus/api/pics?search=query&limit=number
I know that it gets off topic sometimes but Jesus
}else if (message.content.startsWith("+eval") && (message.author.id == ownerID))){
message.channel.send("`` `" + JSON.stringify(eval(message.content.substring(6, message.content.length))) + "`` `")
}``` remove the backticks
No spoon-feeding

๐
Nah that's lame
Wow I always wanted to execute 1832 lines of code before running the command
yea
jesus
js allows beautiful patterns and yall come up with... if else ๐ญ
if else if else if else if else if else if else if else if else if
You'd better be trolling or we're gonna have a biiig problem
import util from 'util'
function clean (text): string {
if (typeof (text) === 'string') { return text.replace(/`/g, '`' + String.fromCharCode(8203)).replace(/@/g, '@' + String.fromCharCode(8203)) } else { return text }
}
...
{
...
exec: async (ctx) => {
if (ctx.message.author.id !== '142408079177285632') ctx.send('error message')
const worker = ctx.worker
try {
const code = ctx.args.join(' ')
// eslint-disable-next-line no-eval
let evaled = eval(code)
if (typeof evaled !== 'string') { evaled = util.inspect(evaled) }
void ctx.embed
.color(0x28bf62)
.title('Eval Successful')
.description(`\`\`\`xl\n${evaled}\`\`\``)
.send()
} catch (err) {
void ctx.embed
.color(0xdb0b0b)
.title('Eval Unsuccessful')
.description(`\`\`\`xl\n${clean(err)}\`\`\``)
.send()
}
}
}```
what i do
Not trolling at all
lol
I even copy pasted all my commands, because I use them for two different versions
Ew imagine using else if
ctrl + a + backspace
Yanderedev, is that you?
Just use fs or something
Resolve the promise of your evaluation stinky
What is ctx
if (evaled instanceof Promise) evaled = await evaled;```
I only heard ctx in python before
nah yandredev did if() {} if(){} not if{}elseif(){}
context
i do that too
Yandev stinky
ok
Smelly

i just removed a bunch of stuff cuz its a bunch of cross cluster options and stuff
context in all libraries is just a plain ass object wrapping all the properties you get from the message event and your args and shit
aka sane people organization
Actually just go straight to the discord ASM lib
U good?
Where are your semicolons bro
so 2017
i use standard
Just like your mom
๐ฟ
๐ฟ Not using semicolons
floor gang stinky then
Lewd
hey guys i have a little question.the first words in each line are the keywords. The 2nd are the roles.
right now it does indeed check for the message that has been sent and it does indeed compare it with the keywords
however
it does not ping the right role
let final2 = filtered.map((x) => x[2])
i am pretty sure it is this one line
as it only gets the 2nd string
how would i code it so that it will get the exact role corresponding to the used keyword?
why do u keep just talking in codeblocks
imagine not talking in code blocks
i used it wrong
nvrm i was thinking of someone else mb
any tips?
why not just use JSON for this type of configuration
if this is for a database you're about to get slapped to mars
Ummm, Slash commands hate me
Code:js client.api.applications(client.user.id).guilds(guild.id).commands().post({data}); Output:```
UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Access
Is there more output than just Missing Access?
A stacktrace for example?
Maybe it doesnt have send perms or something
i am storing 8 words in total
(node:2490) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Access
at RequestHandler.execute (/home/runner/DeSync/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async RequestHandler.push (/home/runner/DeSync/node_modules/discord.js/src/rest/RequestHandler.js:39:14)
(node:2490) 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: 1)
(node:2490) [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
I gave all of the perms lol
ah well, I was hoping for something else
client.on("guildCreate", function(guild) {
doslashcommand(guild, "test", "test", "Bugs", "Command used to test stuff", 6, false);
});
function doslashcommand(guild, name, description, optionname, optiondescription, type, required) {
const data = {};
data.name = name;
data.description = description;
data.options = new Array();
const option = {};
option.name = optionname;
option.description = optiondescription;
/*
* type list:
* 1 = SubCommand
* 2 = SubCommandGroup
* 3 = String
* 4 = Integer
* 5 = Boolean
* 6 = User
* 7 = Channel
* 8 = Role
*/
option.type = type; // 6 = User
option.required = required;
data.options.push(option);
client.api.applications(client.user.id).guilds(guild.id).commands().post({data});
}```
const allItems = fs
.readFileSync("./keywords1.txt", "utf8")
.split("\n")
.map((x) => x.split(/ +/))
let filtered = allItems.filter((x) => x[1]);
let final = filtered.map((x) => x[1])
let m = final.some(a => message.content.includes(a))```how do i store the keyword that was used in the senetence?
Bots needs the applications.commands scope to be authorized when inviting it to the guild to access, create or update slash-commands in it
It does...

That's a permission, not a scope
thank you
What are you trying to do
If you're trying to get the word corresponding to the keyword, just use a json
works like a charm thank you @earnest phoenix
๐
https://srcb.in/5D1vDoWAA2 im making a reload command. it was working before now its not
no error is logged though
Hi, I had a problem. The problem is
An error has occurred while validating your input:
The "Servers this bot is in" section is formatted incorrectly.
nvm i got it
can you help me
scroll down to that part
What have you written in "Servers your bot is in"?
That's the problem
and btw #support
this is development not top.gg support channel
ask in there
ty
Try adding a space after the commas
and yes, any further questions about this should be in #support
Bot.api.applications(Bot.user.id).guilds(733437879933599866).commands.post({
data: {
name: "e",
description: "lol"
}
});
Bot.ws.on('INTERACTION_CREATE', async interaction => {
const command = interaction.data.name.toLowerCase();
const args = interaction.data.options;
if (command === 'e') {
Bot.api.interactions(interaction.id, interaction.token).callback.post({
data: {
type: 4,
data: {
content: "E indeed!"
}
}
})
}
});
```Hi! I'm making slash commands with Discord.js, but I keep getting this error: `DiscordAPIError: Missing Access.`. What am I doing wrong?
thanks for your help
Oh! Where may I find the scope? I had no clue about this.
Found it. Thanks for the help!
is it possible for me to work on the voting api system before my bot has been accepted?
Hi, how do I get my bot to ask users for moderation permissions?
Pretty sure the API won't send any payloads since your bot is not approved yet, but the webhooks are always available so go ahead, you can also test it easily, as there's a Test webhook button @earnest phoenix
no one can vote for your bot before approval
What library are you using?
Js
JavaScript is a programming language, not a library
Idk
Hey! The error is still appearing... even when I reinvite the bot!
I'm going to try finding a dependancy.
Discord.js? Eris? Detritus?
Use <GuildMember>.permissions.has() to check if they have a specific permission
Did you try inviting the bot like this?
https://discord.com/oauth2/authorize?client_id=Your client ID&scope=bot%20applications.commands&permissions=0
Iโm learning c++ and Iโm like ๐ฉ
I would like to learn how to make a bot which logs top.gg votes, gives roles on it etc... where do you recommend me to start?
do you have any coding experience?
pick a programming language and look into beginner courses like udemy or codecademy
popular beginner languages include javascript, python, C# and more
import discord
from discord.ext import commands
import random
import json
client = commands.Bot(command_prefix="!")
@client.event
async def on_ready():
print("Ready")
@client.command()
async def balance(ctx):
await open_account(ctx.author)
users = await get_bank_data()
wallet_amt = users[str(user.id)]["wallet"]
bank_amt = users[str(user.id)]["bank"]
em = discord.Embed(title=f"{ctx.author.name}'s balance",
color=discord.color.red())
em.add_field(name="Wallet's balance", value=wallet_amt)
em.add_field(name="Bank's vault", value=bank_amt)
await ctx.send(embed=em)
@client.command()
async def beg(ctx):
async def balance(ctx):
await open_account(ctx.author)
user = ctx.author
users = await get_bank_data()
earnings = random.randrange(1000001)
await ctx.send(f"Someone gave ya {earnings} coins!!")
users[str(user.id)]["wallet"] += earnings
with open("bank.json", "w") as f:
json.dump(users, f)
async def open_account(user):
users = await get_bank_data()
user = ctx.author
if str(user.id) in users:
return False
else:
users[str(user.id)] = {}
users[str(user.id)]["wallet"] = 10
users[str(user.id)]["bank"] = 0
with open("bank.json", "w") as f:
json.dump(users, f)
return True
async def get_bank_data():
with open("bank.json", "r") as f:
user = json.load(f)
return users
client.run("Token")
help meh with my error for balance command
the error says it all
How do i do to call the Data collection of MongoDB, this image could help
What that image represents?
This image would be the databases of mongoDB
anyone know how to code a football fusion bot?.
nope
yeah ig its tuff i find No tutorials
There won't be a tutorial for everything, that's why it's good to practice making your own projects without any help
You pretty much should learn a language enough to use your imagination to create a bot for that topic.
Exactly, there's nothing wrong with using a tutorial, but eventually you'll learn how to do things on your own
how can I broadcast eval to a shad on a different physical server?
import kurasuta from 'kurasuta';
import config from '../config.json';
import { join } from 'path';
import chalk from 'chalk';
import { Creative } from './Creative';
const sharder = new kurasuta.ShardingManager(join(__dirname, 'main'), {
token: config.token,
client: Creative,
clusterCount: 3,
clientOptions: {
partials: ['MESSAGE', 'GUILD_MEMBER', 'CHANNEL', 'REACTION', 'USER']
},
guildsPerShard: 800
});
then I should switch to kurasuta
kurasuta is pog
does it have multi server boradcast?
like broadcast to a different shard on a different physical server?
Do you need help with mongo still?
Yes
I may be able to help you out because I use it myself?
What are you trying to achieve?
I trying to make a set prefix command
So your just trying to change the value?
Yes
I'd recommend making a document for each guild the bot is in and then a value inside named prefix which is a string
Do you need help with that?
I think i can handled
Ok.
what is shards
is there an efficient way to audit logs other than in DB?
my DB data occupied legit increased to 8GB in 2 days
i tried prometheus. but im kinda confused about how you log from files
the grok_exporter seemed kinda confused :c


the fuck you storing thats using 8GB in 2 days?
why?
i mean, it was a case of urgency
why you logging so much?
command logs etc
commands should take up that much space my dude
so that players dont scam and claim they never ran the command
i mean i dont thing its efficient
im at 4GB, 4 months of data, and this is also including a shitton other data
not only the logs
the logs table is probably at max 500mb
thats why im asking
what in the flying fuck you logging
to use 8GB
command logs, when peeps type a command
and the update logs. when a user does something and their data gets modified
to keep track
im sure im doing it inefficiently
yeah but if someone loses something at a point
or claims that they never did something
it would be hard to find
without those logs
then create weekly datapoints
instead of logging everything
its absolutely dumb to do that
yeah, backups
and then ditch it after 3 backups
give you a scenario
lets say user 1 has 500 gold, he transfers using the command give <user2> this command is logged. there are 2 uses for this, 1 is if they are using alts or doing something else like cross trading. it can act as evidence. so now. the second use case. is once the gold gets transferred the user data changes logs should reflect the changes. if the guy tries to say he never received the gold or tries something. these logs would help
im mainly using these logs to find alts
and prevent scams
and this has worked
so far
i thought of creating checkpoints
and clearing older ones
try ELK then
i thought its not open source anymore?
elastic search, logstash and kibana
ah
thats the proper procedure for logs
yeah i read that elastic search revoked their open source license or something. the OS contributors receive nothing and they just claimed it?
okies
what about grafana + prometheus?
im just confused about how to log data into prometheus.
for now i used grafana to check logs directly from DB but that was just useless and kinda like a "getting used to grafana" thing
i see
while its absolutely hypocritical to tell you this, cuz i do just that
but its the do what i say, dont do what i do sort of deal
i know its bad but i do it regardless cuz it has a few perks
mainly helps me being lazy and only need to have 1 tab open

xD
prometeus is a time series database, you just query on a selected event to it, depending on the driver it will create a timestamp for you on query
yeah i figured that out heuehu
so you want to have a way to log stuff?
just ssh into your server tbh
here
read this
so you want to keep transaction logs?
tbh i would just use a database for keeping logs
probably a stupid way but way less overkill than starting a ELK stack for logging transactions of a Bot
someone said overkill?
well i did the same and my DB racked up 8GB in 2 days
elk shouldnt be that hard on your hardware tbh
you could just dump shit onto elasticsearch tbh
ye some tutorial dude, went on saying you need 12cpus and high memory ;-;
The Elastic Stack is a great platform for various data analytics use-cases. But how do you get started? This video goes beyond a simple default installation of Elasticsearch and Kibana. It discusses real-world best practices for hardware sizing and configuration, providing production-level performance and reliability.
Short-form instructions an...
how do i make all these files run in one go?
12 cores probably if you do some ballin stuff with it, like logging 100k transactions per hour
you want to run all of them? just call them in your index.js or so

my eyes






