#development
1 messages · Page 1030 of 1
As that only allows a certain amount of usage per day
Usually the yt api key is used
I could use multiple API keys?
What is the max usage on it?
What would be the problem with that?
Check their tos
I could use ytdl's get basic info
Since I keep getting rate limited with lavalink
And yt-search
I might just move music back to what I had before
is there any way to change this text? https://lumap.is-inside.me/XHXu3cND.png
i want it so i dont have a cooldown
i sense copy pasted code
i sense bad code
@tight plinth do u wanna edit the text or just change the style?
it stinks
i should of asked that earlier
actually both
i sense bad code
@onyx karma ;-;
let muteRole = client.guilds.cache.get(msg.guild.id).roles.cache.find('name', 'muted');```
oof
@delicate shore ?
The sweet release of 500 lines
at Client.<anonymous> (/app/index.js:830:56)
at Client.emit (events.js:196:13)
at MessageCreateAction.handle (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/src/client/websocket/WebSocketManager.js:386:31)
at WebSocketShard.onPacket (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/src/client/websocket/WebSocketShard.js:436:22)
at WebSocketShard.onMessage (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/src/client/websocket/WebSocketShard.js:293:10)
at WebSocket.onMessage (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/node_modules/ws/lib/event-target.js:125:16)
at WebSocket.emit (events.js:196:13)
at Receiver.receiverOnMessage (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/node_modules/ws/lib/websocket.js:800:20)
(node:23194) 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(). (rejection id: 1)
(node:23194) [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.```
my error
holy fuck dude
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'roles' of undefined
yes
thats enough ^
ok
read the error?
hmm
#development message @tight plinth you can do this though
let muterole = message.guild.roles.cache.find(role => role.name === 'muted');
undefined
interesting
let muterole = message.guild.roles.cache.find(role => role.name === 'muted');
@spare mirage this is what i use
but yea thats not what i wanted
🤦♂️ check if u have the role muted else make one
i have
@solemn latch my bot says I cannot find a mute role. Make sure its named as Muted
@solemn latch can this work var role = msg.guild.roles.cache.find(r => r.name === 'Muted' || 'muted' || 'timeout' || 'Timeout'); member.roles.add(role);
or Muted
@delicate shore no
im in byethost and i get this error?
just role => ["muted", "timeout"].includes(role.name.toLowerCase())
so can someoen help with my error?
var role = msg.guild.roles.cache.find(["muted", "timeout"].includes(role.name.toLowerCase()));``` @pale vessel
im in byethost and i get this error?
#development message you had it here
hmm
var role = msg.guild.roles.cache.find(r =>["muted", "timeout"].includes(role.name.toLowerCase()));```
@quartz kindle sorry for the ping, but do you have any idea why i get this error https://lumap.is-inside.me/ciI1dyIC.png every time i try to fetch a member with discord.js-light?
Why are you trying to find a role object in an array of strings?
can someoen please help me 😦
Sure
Why are you trying to find a role object in an array of strings?
@pure lion he is trying to find a role name lol
my brain is gonna blast
Just don't ask just ask
i gotta breath
@earnest phoenix
var r = msg.guild.roles.cache.find(r =>["muted", "timeout"].includes(role.name.toLowerCase()));```
like this ? @pale vessel
You're looking for the name of a role right?
r is the role object placeholder
oh
r => r.{property}
o
i gave you an example, that doesn't mean you should just copy and paste it
Well then there's no role called muted
It's case sensative
ik
Ik
So are you looking for a role named 'Muted' or 'muted'
Muted
🤦♂️
@spare mirage ?
?
?
HASTEBIn
brvh
perms are messed p lol
stop pinging me
yes
dont use message.content
.setAuthor(‘message.guild.avatarURL()’, ‘message.guild.name()’) where the hell did you get this code
lol
that won't work lol
How can I make my embed like this in discord.py?
- you can't use
‘as quotes - you're not supposed to surround the code with quotes
- name is not a function
what is the error
@restive pebble it keeps on saying cannot find. muted role
https://hastebin.com/ivegiradon.js
@restive pebble my code
Ok
can someone help me make a coin system with MongoDB not mongoose?
and guild does not have avatarURL
- name is not a function
@pale vessel read
iconURL(), read docs
@delicate shore role.toLowerCase()
Or it can also mean there is no such roles
Use id then
Uhm
bruh
do that in indexjs
bot.on('ready', () =>{
bot.user.setPresence({ activity: { name: 'Im not idle I just like the yellow color' }, status: 'idle' })
});
what are you doing, his code is correct
Display members it's watching over ( the bot ).
Error: Cannot find module './commands/Animals'
2020-07-07T09:16:48.940871+00:00 app[worker.1]: Require stack:
2020-07-07T09:16:48.940872+00:00 app[worker.1]: - /app/Index.js
2020-07-07T09:16:48.940872+00:00 app[worker.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
2020-07-07T09:16:48.940872+00:00 app[worker.1]: at Function.Module._load (internal/modules/cjs/loader.js:842:27)
2020-07-07T09:16:48.940873+00:00 app[worker.1]: at Module.require (internal/modules/cjs/loader.js:1026:19)
2020-07-07T09:16:48.940873+00:00 app[worker.1]: at require (internal/modules/cjs/helpers.js:72:18)
2020-07-07T09:16:48.940874+00:00 app[worker.1]: at /app/Index.js:25:18
2020-07-07T09:16:48.940874+00:00 app[worker.1]: at Array.forEach (<anonymous>)
2020-07-07T09:16:48.940874+00:00 app[worker.1]: at /app/Index.js:24:9
2020-07-07T09:16:48.940874+00:00 app[worker.1]: at FSReqCallback.oncomplete (fs.js:155:23) {
2020-07-07T09:16:48.940875+00:00 app[worker.1]: code: 'MODULE_NOT_FOUND',
2020-07-07T09:16:48.940876+00:00 app[worker.1]: requireStack: [ '/app/Index.js' ]
2020-07-07T09:16:48.940876+00:00 app[worker.1]: }
``` uhh help
Display members it's watching over ( the bot ).
@earnest phoenix did you get an error? what happened?
Got this and doesn't display.
@earnest phoenix woops, you can't import folders with require
So define it as activity or? @pale vessel
fs.readdir("./commands/", (err, files) => {
files.forEach(f => {
const file = require("./commands/" + f);
if (!file.name) throw f + "does not export a name property!";
bot.commands.set(file.name, file);
if (file.aliases && Array.isArray(file.aliases))
file.aliases.forEach(a => bot.aliases.set(a, file.name));
});
});
``` my command handler and error [#development message](/guild/264445053596991498/channel/272764566411149314/)
Ahhhhhhhhhh
Got you lol
shwo your directory tree
@pale vessel It should be?.
you can just change it
Use id then
@restive pebble no
i cannot
because it's a public bo
and id is differenr
@tight plinth
remove the folder lol
bruh why you can also change the file names to
MODERATION BAN.js
MODERATION KICK.js
to have them sorted @earnest phoenix
no
fs is checking for Animals, and crashes coz its not a file
just move the file away from this folder
ypu have to check for the folder animals and then check for js files
just move the file away from this folder
@tight plinth no i dont want to tho i want to be orginised
well youre basiclly forced to move the folder lol
well
Just create more folders
in the bot folder
and run those
folders
folder
lol
u have ur bot folder
with the indexjs
and all that stuff
in there make folders
FUN COMMANDS
no
stfu
@spare mirage why does is he forced to do so?
thats way easier then making a commands folder with more folders and more folddrfess
s
why? there are mutiple ways to tide up the entrie thing. one way is a Mainfolder for the commands and inside of this subfolder for categories
why? there are mutiple ways to tide up the entrie thing. one way is a Mainfolder for the commands and inside of this subfolder for categories
@lusty quest exactly im trying to do category things like/commands/Animals/
@plush oar i think your counter is not updating
both messages show 29 users
yes but 29-1 is 28
your godbye message shows 29 and your welcome shows 29
or did you manually triggered the event? if yes then NVM
Yes
@tight plinth try .fetch({id:id,rest:true})
lemme try with rest
Can you guys check why does it ingore the first songForm object, but not after the first one after the queue for the guild gets set?
https://pastebin.com/wd3jL1mP
@quartz kindle please help im trying to categorize my files but im getting errors
thanks god i only have to edit one file
@quartz kindle any idea how to get member.hasPermission(ADMINISTRATOR) working again with d.js-light? since its not properly cached it fails even for members with a role that has ADMINISTRATOR. and fetching the member times out (probably needs intend)
aaand it seems to work now! thanks
permission checking needs roles to be cached
you can use the enablePermissions client option for that
fs.readdir("./commands/", (err, files) => {
files.forEach(f => {
const file = require("./commands/" + f);
if (!file.name) throw f + " does not export a name property!";
bot.commands.set(file.name, file);
if (file.aliases && Array.isArray(file.aliases))
file.aliases.forEach(a => bot.aliases.set(a, file.name));
});
});
``` my code and error
@quartz kindle ^^
your require path needs to take the additional folders with into account
how
Animals is a folder
yeah
if you do require("folder here") it will try to require an index.js file in that folder
?
it will not scan the folder for you and require all files in it
im confsued
you say the script to load all files that end with .js in commands
uhh do i?
but you need to tell it to load all commands in /commands/animals
and animals need to be dynamic to load all commands in the categories
uhh
i dont understand
Can you guys check why does it ingore the first
songFormobject, but not the other ones after the first is pushed to the queue?
https://pastebin.com/wd3jL1mP
Ideas?
if you want to load files from inside another folder, you need to use readdir again in that folder
how
do you even know what your code is doing or did you just copy/paste
someone made the command handler for me because the one i was using wasnt good
well, that one doesnt support folders inside folders
as i said, you need to write another fs.readdir section for each subfolder you want to load
where?
right after you load the first folder
which is?
fs.readdir("main folder", results => {
results.forEach(subfolder => {
fs.readdir(subfolder, subfolderresults => {
subfolderresults.forEach(file => {
require(`main folder/${subfolder}/${file}`)
})
})
})
})
(this is not real code to copy and paste, just an illustration of how it works)
ok do i replace with my cmd handler now?
(copying this will not work)
replace with what
read what your current handler does
my current cmd handler
and then check what is different
as i said, copying wont work
im confused again
i suggest take a break, take a walk and then read your code and the example again
ok..
this usually helps if you are overwhelmed with something or just cant make sense of it
yeah its kinda hard for me because of my ADHD so i dont understand things often
@lusty quest can you try member.permissions.has() instead of hasPermissions?
also try logging member.permissions
it works now. yesterday i added the permission caching and it wont work, then tryed to fetch the user -> timeout. now i uploaded the mainfile and the command with the issue again and it seems to work now
lol weird
i cant seem to reproduce the member timeout thing
always worked for me
i dont request the intends
but im gonna backport v3's version of members.fetch which defaults to rest mode (discord.js also uses rest mode by default when fetching a single member)
ok
its possible that i didnt realized that i forgot to upload the new mainfile for enabling permissions , was tired af
lmao also possible
wd
ok im back
just had a walk up and down the road
so where were we?
@quartz kindle
like i want my thing where i do
module.exports = {
name: "",
aliases: [""],
category: "",
run: async (bot, message, args) => {
//code
}
}
``` i want it to be the same
Oof
Guys
what's the best way to use a database in a discord.py bot? I've never had to use a db before
open one connection at startup or connect whenever someone runs a command that needs it?
depends on what database you want to use
I'll be honest, idk which to use, not even sure what types ther are
the widely known are Postgres mysql and Mongodb. Postgres and Mysql are SQL based Databases while MongoDB is No-SQL
all have theyre pros and cons
if I were to use mongo, then, what would be the best way to connect to it
with mongo you connect to your database right after declaring the client object and attach the database do it to be able to use it globally (if you use cogs)
yeah, I have a cog for each of my command categories
pymongo or Motor?
idk the difference, I'll say pymongo
One is sync and works fine I believe, the latter is outdated piece of barely working crap that claims to be async
lol
But essentially you get something like
from pymongo import MongoClient
bot = commands.Bot(...)
conn = MongoClient()
bot.db = conn.some_database # also possible to use conn['some_database']
# line below is optional because you can now just do bot.db.my_collection
bot.my_constant_collection = bot.db.my_collection # also possible to do bot.db['my_collection']```
I have used pymongo so far and haven't had problems with blocking in my discord.py bots
would i need to import it in my cogs?
Nope, you'd just need to access the bot object
which you get from self.bot usually
oh it's bot.db not just a var
mhm
bot.on('guildCreate', async guild => {
const invites = await guild.fetchInvites();
each(invites => console.log(code));
})```
Help i want server logging
On bot shutdown in the main file you can throw a conn.close() if you want
right
but yeah, that's the overall logic
Because, if somebody have an error and i see it in a console... i want to help this people
Sorry for perfect english
The errors will be output in the console and you can handle them without getting server invites
What you would be doing is not tolerable and probably most likely Discord ToS
you could provide a support server link
@finite nimbus whats your main language?
nie musisz rejestrować zaproszeń, ponieważ w konsoli pojawiają się błędy
English-only rule still applying btw
nie musisz rejestrować zaproszeń, ponieważ w konsoli pojawiają się błędy
@honest perch Uhh ok, but i want XD
That would most likely be against ToS |
it would be easier sending just the support server invite
Ehgh
@quartz kindle im back
in js, how can i make a string like `Content
Content1
` be `Content\nContent1`
wdym?
.replace('\n', '\\n')
can someone help me?
u need to show ur code, we dont know what it is
ight
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
this doesnt seem to work
it logs "Webhook running at https://0.0.0.0:5000/dblwebhook" but doenst log when users vote
how can i check if the members in a voice channnel are users or bots ?
ok
yes
@glass flare im pretty sure u need to have a actual website not one which is running on ur pc
else
if (message.content.startsWith(`${prefix} tag`)) {
client.commands.get('tag').execute(message);
}
@digital ibex what do you mean?
that makes no sense, how can it connect to smoething it has no access to
i'm not entirely sure how webhooks work, i just want to listen for votes and do something when a vote is recieved
whats the best way to do that?
then use that website
not one which is running on ur pc which only you have access to
but how?
sorry i'm new to this if i sound really stupid
but i cant really understand the docs
thats exactly what the docs say to do
you've got a website, right?
nvm i found it
and its public?
i believe u'd do shaycryptoco:UR_PORT.in/dblWebhook
i forgot which ways the port goes
how can i check a user when go offline
idk
i dont think you can @pure saddle
set a node-schedule cron interval, check every 5 seconds 😛
try the one u r running on ur website and the port ur running top.gg api thing
@pure saddle what library?
djs
1 sec
can the api work with Heroku?
yes
whats the problem?
@glass flare i need help making some sort of coin system thing like dank memer ect. im using mongoDB and i dont really want to use mongoose
else
if (message.content.startsWith(`${prefix} tag`)) {
client.commands.get('tag').execute(message);
}
i've already told u, bow pro
what?
well I use mongoose, don't see why not @earnest phoenix
u need to provide more context
well I use mongoose, don't see why not @earnest phoenix
@glass flare i dont know how to use it :/
docs are relatively easy to understand
mongoose is pretty simple,
ive literally provided the whole code
im assuming its a string
i've never used top.gg's api
or ever looked at the docs
send ur code where the new topGG thing is
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
ah
im not sure I can help u then lmao, it seems it creates it for u
shay, does the example not work? try just doing new DBL(token, discord client)
i did
?
if u look at the error stack, u only need to show 1 line of the tag.js file and where ur executing it
how r u executing other commands?
Question, if you have lets say 20000 guilds and about every couple seconds someone votes and you send a message in a channel for all the voters will that be ratelimitted?
what does upsert mean?
Is this supposed to happen when downloading Eslint or is it just my computer?
@tulip ledge if you're getting votes every couple of seconds, then likely not
Does anybody know if there's a way to check what discord badges a user has?
since the discord limit is 5 every 5 seconds
@stark vault nope, it is just lodash
Oh ok
Does anybody know if there's a way to check what discord badges a user has?
@tulip ledge which library
djs
<User>.flags.toArray()
whats wrong here?
you tell us
Error?
ye
Send
e
Uh
```if (message.content.startsWith(${prefix} tag)) {
client.commands.get('tag').execute(message);
}
Did you read the error or do we have to translate it to audio
i did
Did you read the error or do we have to translate it to audio
@pure lion ?
@digital ibex it still doesnt work
const DBL = require('dblapi.js');
const dbl = new DBL(token, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(vote);
console.log(`User with ID ${vote.user} just voted!`);
});
thats my entire code
it logs the "Webhook running" line but not the votes
Where is a good place to find someone to test your bot?
uhh .get isnt correct apparently
ok why?
.get isn't a mongoose method. findOne is..
thats how i've done it before
wait on what line?
on the let money line
ok
is that code i done correct? and easy
?
like of the ppls?
of smth
like is it good code
ya it all looks good
just intend the two awaits in the if else and unindent the if and else
so it looks cleaner
intend?
so instead of
if () {
await...
} else {
await...
}
do
if () {
await...
} else {
await...
}
it shouldnt make any difference to how it runs but its just better practice
like that?
correct
https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
@earnest phoenix this extension is good to format your code. It takes care of what ShayGaming24 said.
are you using vs code?
oh. then nevermind about the extension.
const Discord = require("discord.js")
module.exports = {
name: "work",
aliases: ["w"],
category: "Currency",
run: async (bot, message, args) => {
let money = await bot.db.collection("Money").findOne({u_id:message.author.id});
let random = Math.floor(Math.random() * 100);
if (!money) {
await bot.db.collection("Money").updateOne({"u_id":message.author.id}, {$set:{money:0 + random}}, {upsert:true})
} else {
await bot.db.collection("Money").updateOne({"u_id":message.author.id}, {$add:{money:random}}, {upsert:true})
}
}
}
$add should be replaced with $set
I think..
wdym?
okay nvm i'll use another method
if (!msg.guild.member(client.user).hasPermission("MANAGE_ROLES")) return msg.reply('I do not have the correct permissions.').catch(console.error);```
yeah i use mongodb not mongoose
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'hasPermission' of null
this is error
const Discord = require("discord.js")
module.exports = {
name: "work",
aliases: ["w"],
category: "Currency",
run: async (bot, message, args) => {
bot.db.collection("Money").findOne({
u_id: message.author.id
}, (err, money) => {
if (err) console.log(err);
let random = Math.floor(Math.random() * 100);
if (!money) {
await bot.db.collection("Money").updateOne({
"u_id": message.author.id
}, {
$set: {
money: 0 + random
}
}, {
upsert: true
})
} else {
money.money += random;
money.save().catch(err => console.log(err));
};
})
}
}
@earnest phoenix
try that
ok
hlp me
maybe you could do this inside the
} else{
const newMoney = money.money + random
await bot.db.collection("Money").updateOne({"u_id":message.author.id}, {$set:{money:newMoney}}, {upsert:true})
@delicate shore try message.guild.me.hasPermission()
msg.guild.member(...).addRole is not a function```
msg.guild.member(user).addRole(muteRole).then(() => {
🤦♂️ still stuck on a mute command
Find lol
uhhh @glass flare
idk then bro sorry
🤦♂️ still stuck on a mute command
tim time to update ur code https://lumap.is-inside.me/zgIbysFM.png
let muterole = message.guild.roles.cache.find(role => role.name === 'muted');
if(!muterole){
try{
muterole = await message.guild.roles.create({ data: { name: 'muted' } });
message.guild.channels.forEach(async (channel, id) => {
await channel.overwritePermissions(muterole, {
SEND_MESSAGES: false,
ADD_REACTIONS: false
});
});
}catch(e){
console.log(e.stack);
}
}
``` @delicate shore
can you not?
imagine not using a custom mute role
?
Lol
ok thanks
Imagine everytime muting someone creates a new role
Ya
cough
Epic
oh i do love steam summer sales 😄
💪
i already use this @restive pebble
no
Then it's not cached
wot
Abuse api
msg.guild.member(...).addRole is not a function```
@delicate shore
Then
this is the only error
i am facing
msg.guild.member(user).addRole(muteRole).then(() => {
@delicate shore
it can't find the member? most likely thats the issue
Or fetch
Oh lol
<Member>.roles.add(role)
.roles.add

So ur bot got accepted?
i still waiting
const Discord = require("discord.js")
module.exports = {
name: "work",
aliases: ["w"],
category: "Currency",
run: async (bot, message, args, err) => {
let money = bot.db.collection("Money").findOne({u_id: message.author.id})
if (err) console.log(err);
let random = Math.floor(Math.random() * 100);
if (!money) {
await bot.db.collection("Money").updateOne({"u_id": message.author.id}, {$set: {money: 0 + random}}, {upsert: true})
} else {
await bot.db.collection("Money").updateOne({"u_id": message.author.id}, {$set: {money: random}}, {upsert: true})
.catch(err => console.log(err));
};
}
}
``` guys it doesnt save the number and then add it help
What db is that
mongo
Oh
Kek
I thought mongoDB was SQL
nope
Sql good
SQL = English
so can anyone help?
Bruh
I mean
I don't see you taking the preexisting money
And adding that to the random money
And savind that
You're just saving the random money
?
mongodb is nosql
Use own logic
Use own logic
@restive pebble
Yes ok
He's getting the money @lyric mountain
But when he's saving it
He's saving the random money
Not the money they have + random
U wanna do like
wut
money: money + random
im lke tryna add money to the uhh thingy
no
dont
Bruh
Use findOneandUpdate
dude, 2 people already gave you the answer
money: money + random
help #1
I mean I've never used mongo before but it's just logic
help #2
money: money + random where?
🤦
Oh my god
where do i put
We cannot spoonfeed u
bruh i may need tho
No
I GAVE U THE ANSWER
It's rule
FFS
I wonder if you really made that code yourself
Tbh
No
I don't think so
no someone helped
Ik
no
M
help
Ut
in this server
Yt
@earnest phoenix
} else{
const newMoney = money.money + random
await bot.db.collection("Money").updateOne({"u_id":message.author.id}, {$set:{money:newMoney}}, {upsert:true})
replace your else statement with this and you should be good
no i get error when do
let me see the error

:
money.money wouldn't work
Yes
so fix it
As money is a variable
Hmmm
Variable and object has different
Money is a mongo object, no?
im confused
@earnest phoenix you said you had it on Github. Link it, please
Oh yeah
money is a key
@earnest phoenix you said you had it on Github. Link it, please
@fast yacht its private
Wow private
yes private repo
WHy use github when u set it to private?
@earnest phoenix
Code needs to public. You will never learn unless you feel the public shaming your code;D
Yeah
Isn't github ment for open source?
Why
@earnest phoenix
Code needs to public. You will never learn unless you feel the public shaming your code;D
@fast yacht mt token tho
my
My all codes are open source
Money: {
u_id: "12345678",
money: 500
}
this is his Money structure as I can see
I don't use github
process.env
Money: {
u_id: "12345678",
money: 500
}
@lyric mountain uhhh
Git hub is hot tho
@earnest phoenix
Ok. you might want to create a .env to hide your tokens.
Check out this npm https://www.npmjs.com/package/dotenv
Wow
Yas
Yeah
i need help tho ;p;
Can you send the whole file one more time here?
We literally spoonfed u
const Discord = require("discord.js")
module.exports = {
name: "work",
aliases: ["w"],
category: "Currency",
run: async (bot, message, args, err) => {
let money = bot.db.collection("Money").findOne({u_id: message.author.id})
if (err) console.log(err);
let random = Math.floor(Math.random() * 100);
if (!money) {
await bot.db.collection("Money").updateOne({"u_id": message.author.id}, {$set: {money: 0 + random}}, {upsert: true})
} else {
await bot.db.collection("Money").updateOne({"u_id": message.author.id}, {$set: {money: random}}, {upsert: true})
.catch(err => console.log(err));
};
}
}
Spoonfeed
I literally said WHAT TO DO
you could just...like...put your token in a simple js file exporting it then require it in index.js
He uses heroku lel
hold on. 1 minute
not that one ^
i tired doesnt work
Oh wait
tried
mhm
money.money + random
no
nope
that doesnt work
Hmmmm
Ur data
money isnt an object or smth
Wth
^^^
bruh
no
Tf is nosql?
im gonna do mongoDB
If u don't know how to use dbs
No
And saying bruh
0 is there cuz if money does not exist
ah
@lyric mountain So wont work
put it below then
One last thing I wanna say :
READ THE DOCS
const Discord = require("discord.js")
module.exports = {
name: "work",
aliases: ["w"],
category: "Currency",
run: async (bot, message, args, err) => {
const money = await bot.db.collection("Money").findOne({u_id: message.author.id})
if (err) console.log(err);
const random = Math.floor(Math.random() * 100);
if (!money) {
await bot.db.collection("Money").updateOne({"u_id": message.author.id}, {$set: {money: 0 + random}}, {upsert: true})
} else {
const newMoney = money.money
await bot.db.collection("Money").updateOne({"u_id": message.author.id}, {$set: {money: newMoney}}, {upsert: true})
.catch(err => console.log(err));
};
}
}
Don't listen to the gatekeepers around here. Try this. make sure that you're actually executing run and not execute as this is what DiscordJs is suggesting.
@fast yacht stop spoonfeeding
Yeah
Spoonfeeding is against the rules friend
Yikes
@fast yacht execute or run, it depends on your command handler
newMoney = money.money
You're not adding the random
Spoonfeed goes wrong
So you're just putting the money back in there
Without adding any new money
If you spoonfeed make sure the code is right lmao
Lmao
you can't
he is not in serverv
My bot isn't in here either
because it's not here yet
you cant here
And i'm sad 😦
My bot isn't in the server
i can ping him
it's not here yet
wot
all we see are numbers
Don't listen to the gatekeepers around here.
oh
This line
My bot isn't in here 😦
Because its cached in your discord
oooooooooo
Don't listen to spoonfeeders who give the wrong code either
Yea
Oh
Orelse it should see channels
Ur bot has common prefix
@restive pebble wut was that ping?
@signal cove
My bot
Oh yeah
ah
Ya
He is in here
For lvl up
Wtf is common prefix?
Ig
Like !
¯\_(ツ)_/¯
Wtf is common prefix?
@tulip ledge bots that have!*-.$+~as prefix
If its configurable tell a mod to change it for ya
Hmmm
Oh lmao
Hmmmm
so i need help so please help me
U have been helped
where
ig
The other suggestion was to get more familiar with Mongodb before implementing it.
;-;
Rtd
const DBL = require('dblapi.js');
const dbl = new DBL('TOKEN', { webhookPort: 25565, webhookAuth: 'PASS' }, client);
Why does it not auto update?
but there is already one muted role
?
how to solve
Hey Boeing know how to fix this
What
my bot creates another muted role
@delicate shore are you getting the role by ID?
Hmmm
did you got a post event?
??
if(command === "mute"){
let reason = args.slice(2).join(' ');
let user = msg.mentions.users.first();
let muteRole = msg.guild.roles.cache.find(role => role.name === 'Muted');
if(!msg.member.hasPermission("MANAGE_MESSAGES"))
return msg.reply("You need atleast Manage Messages perms to do this brvh");
if(!muteRole){
try{
muteRole = await msg.guild.roles.create({ data: { name: 'muted' } });
msg.guild.channels.forEach(async (channel, id) => {
await channel.overwritePermissions(muteRole, {
SEND_MESSAGES: false,
ADD_REACTIONS: false
});
});
}catch(e){
console.log(e.stack);
}
}
if (msg.mentions.users.size < 1) return msg.reply('You must mention someone to mute them.').catch(console.error);
const embed = new Discord.MessageEmbed()
.setColor(0x00AE86)
.setTimestamp()
.addField('Action:', 'Mute')
.addField('User:', `${user.username}#${user.discriminator} (${user.id})`)
.addField('Modrator:', `${msg.author.username}#${msg.author.discriminator}`)
.addField('Reason', reason);
if (!msg.guild.me.hasPermission("MANAGE_ROLES")) return msg.reply('I do not have the correct permissions.').catch(console.error);
msg.guild.member(user).roles.add(muteRole).then(() => {
msg.channel.send(embed).catch(console.error);
});
}
just for checking if the client is working
Uhh I don't have one, no.
and @restive pebble the new role it creates i can still talk with it i mean the user
Ok so I changed the prefix
if that role exists font create
Dont
How can I get it to not have common prefix anymore?
Muted != muted
Change the prefix
I did
beoing help





