#development
1 messages · Page 922 of 1
Tags can change all the time
Ids doesn't
Ids are unique for every user, you can't get another
Oh yeah always use IDs. They never change
Ok
So can you explain to me what this does? "guildMember.roles.set(['391156570408615936'])"
Is that string a User ID?
That's a role id
Role being the Role name on my Server?
why is my bot muted?
Being the role object
@remote yacht common prefix
How do I fetch that ?
That's what's confusing me is how to catch all these things even though I know their names
Are you going to make it unique for your server?
Where that can ask people?
Or are you planning on having that feature on N servers?
@lyric mountain Well, I wanted to repurposed it for others, but I am afraid it will be complicated to make it easily repurposable
But maybe I should make it repurposable from now
If you want to make it publicly available you will need to use a webserver
With webhooks your bot will be ratelimited
For reading webhooks?
But if you want to make it only for your server, you can just hardcode the ID
It doesn't send webhooks
Well if you want to make a bot useable for different servers I'd recommend some type of DB to store the roles. The ID is going to change for each server. As @lyric mountain said, if it is only your server, just hardcode that
If you are new I would recommend not touching DBs too much or any of that until you get the gist of the d.js basics(but that is just me)
Not only a db, if he's willing to make an external integration on his bot he'll definitely need an api server
I want to repurpose the bot, but not necessarily make it public or have to worry about such limits
Yeah
Personally, I would make the bot just for your server. Get the hang of how it all works
That's what I did
It's easier to worry about those limits now than later
Ok, I will hardcode stuff, maybe use variables as much as possible to make it easy to repurpose
Sounds like a plan to me
I guess if I set variables where needed it will be easy to repurpose
About the id stuff, you'll need to learn how to manipulate arrays and objects
It's kinda different from website engineering where you have everything at hand
How i can replace text?
You gotta think in an abstract yet tangible way
@earnest phoenix wdym by replace?
Sounding like some voodoo stuff haha
@earnest phoenix string.replace(yourtext)
Can you give me some help to get my hands dirty?
Like {memberCount}
@lapis ocean just think as if everything around you are objects with their own properties
Then you just need to get those properties
Is this the so called object oriented programming?
Yep
sorry for that
This is very high level
but if i have
I don't have much of a problem understanding the high levels concepts.
let prefix = bot.db.fetch(`prefix_${message.guild.id}`)
I='ve never made a bot, and I almost finished mine in 1 day
Why dosent it work when I add let prefix = bot.db.fetch(`prefix_${message.guild.id}`) ? prefix: "db!"
Just missing this one part
it says prefix is not defined
What you're trying to do is not something a beginner would be able to
I miss mostly the low level stuff
the thing is is that it works with this let status = bot.db.fetch(`status`) ? status: "none"
Low level means that you're closer to the hardware
but not this let prefix = bot.db.fetch(`prefix_${message.guild.id}`) ? prefix: "db!"
Yes, hence why i can't do it
Or at least have a problem with
At least right now, because I need to get myself lost in documentation again
Just focus on other features for your bot, and try to always use new things
This way you'll grow with your bot
I really need this, it's the onlyu reason I got into building a bot
Honestly I would watch some TheSourceCode tutorials on D.JS. Both old or new are pretty good. It'll give you the basics of everything
I mean either did I when I started, but that's how I learned
But I needed this feature, because I didn't find a better way to onboard members
With all do respect, no one is gonna invite a bot that barely has any decent features. You gotta learn the basics first, then you can get to the advanced stuff where people will invite the bot
Then start using some kind of db
^^
And make servers configurable
Yeah. You just gotta start small
I don't really want people to invite the bot.
Then how is it gonna be on other's servers?
I can make it open source if people want to use my solution
Private invite?
Then start making some complex code, like slots game, prune command, etc
im sorry but am i in the right chat
yes
so i need help
how come this works
let status = bot.db.fetch(`status`) ? status: "none"
but this dosent
let prefix = bot.db.fetch(`prefix_${message.guild.id}`) ? prefix: "db!"
saying (node:19033) UnhandledPromiseRejectionWarning: ReferenceError: prefix is not defined
Ok, just help me get the logic for this then
guildMember.roles.set(['391156570408615936']) I need to get the ROle ID
I got that part
And then where does the UserID fit into the syntax?
@astral yoke you're giving the prefix value to prefix itself
You can't do that
You can't prefix = prefix
so what should i do?
@lapis ocean You would probably do something like .get(userID)
Idk, you haven't given us enough code
let prefix = bot.db.fetch(`prefix_${message.guild.id}`) ? prefix: "db!" let status = bot.db.fetch(`status`) ? status: "none" message.channel.send(`Howdy there. The prefix here is \`${prefix}\` \n \n Owners note is \`${status}n\`. *If null then no note.*`)
heya, i'm new here but would someone be able to help me with a kinda extraneous issue i've been bugfixing for a few hours now?
Oh my
thats what im doing it for
condition ? exprIfTrue : exprIfFalse
Maybe I will scratch my whole bot if Oauth can redirect to a link with query strings
I mean, the whole part where it generates the link
Hey quick question Kuu. Does if (!message.member && message.guild) message.member = await message.guild.fetchMember(message); account for caching or nah?
It was in a tut since I'm starting to switch over to v12
So .add would be better than .set I guess @lyric mountain
Because set would remove the other non mentioned roles
Probably, see if djs has an add
As far as I can interpret from the syntax and the documentation
Ah, you don't know!
So you use Python right?
No, I'm a java dev
Ahh java boi
That happens to code in js
Ah.
.add does work 🙂
That tells you everything about it. .add(roleID). ID otherwise known as a snowflake iirc
Thank you for the link @abstract crow
is it possible to run a discord bot app inside of an existing node process? i've been trying to run a discord bot inside of my existing js web game's server but it provides an error every time
what is the error
@bleak agate you can, but I'd recommend doing the other way around
/root/server/node_modules/discord.js/src/util/Util.js:32
);
^
SyntaxError: Unexpected token )
at Object.exports.runInThisContext (vm.js:78:16)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/root/server/node_modules/discord.js/src/index.js:3:14)
at Module._compile (module.js:571:32)
Ah
what's your nodejs version
No he put an extra ) somewhere
this isn't my code
What IDE do you use?
@abstract crow The only reason I am using DJS is because I was told the documentation is superior to Py, so I came here, Python is way easier for me
@bleak agate wait
Mistake 1 - Use your own code
Wasn't it your game
Not even a developer at all here though
like, it's reporting this error inside the discord.js module util.js
@lapis ocean Yep. Python docs are absolute shit imo for discord
It's not @bleak agate
D.JS is waaaaaay better in terms of the documentation. In terms of functionality I have no comment, but the docs are better here
I mean if you go to the file you find this: js props = Object.assign( ...Object.keys(obj) .filter(k => !k.startsWith('_')) .map(k => ({ [k]: true })), ...props, );
and that looks fine but it's not
If you're good with python go with python
That too. Depends on how good you are
JDA has absolutely NO documentation
Yet ctrl + space teaches almost everything you need
Python is a compiled lang
Someone to help me, I'm really confused
if(actual >= ammount && user_cache.missions && !user_cache.missions.includes(key))
I'm doing a mission system, and I need that when 'actual' is equal to or greater than 'ammount' and 'user_cache.missions' doesn't have the mission name, accept the mission, but I need to put 'user_cache.missions' before so that I don't make a mistake with the includes when it's empty, but I don't know how to put it to accept the mission :c
I don't know how to explain xd
JDA has no documentation?
Nope
It does have javadocs
But those can't be considered documentation
Since they are unreadable on their own
I mean sort of counts 
@lyric mountain i know
If it is, I'm sure we all have copied before. I'll be the first to admit I have. But it's a bad habit
Snippets are completely fine, but copying lot's of code is just a no no
But about the question, just do user_cache.missions.push(mission)
Push will add the mission to the array
If it's an array
Else use .assign(someid, mission)
If i put
user_cache.missions
if the user has not made any mission, take the false statement
If i put
!user_cache.missions
It passes to the next one that would be "user_cache.missions.includes(key)", but if user_cache.missions is empty, it returns an error, undefined
@lyric mountain Mission is only added when completed
What's the issue?
I can't push nothing if is not completed
So just create it then
If(completed)
It would be the same as
if(actual >= ammount)
^^
So then what is the issue
But I need to verify that the mission is not in the array so that it does not duplicate
^^^^
Just cascade two ifs
To verify that, i have
user_cache.missions.includes(key)
but
if user_cache.missions is empty. Return error
For undefined
That bit of code you've shown us will work
And... For it i have
user_cache.missions
Before
But.........
If user_cache.missions is empty, I take the statement as false
If (actual >= amount && (user_cache.missions && ! user_cache.missions.includes(key)) do stuff
I will try xd
I added the missing ")"
That code will only run if:
Mission is complete AND
missions doesn't include the mission
Your logic is right
Gotta sleep now, I'll leave the rest for u @abstract crow
:)
I will try
xD
For second time
@lyric mountain doesn't work 😭😭😭
I have the same problem
client_cache.missions
If missions is empty, makes the statement false
How can I bring users badges
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
11.6.4
@lyric mountain suddenly my mind cleared and I got a very simple solution xd
if (actual >= ammount && (!user_cache.missions || !user_cache.missions.includes(key)))
@lyric mountain thanks for help me
how come this dosent work
.addField("> Status", member.game ? member.game.name : "None")
11 is bad bro
it dosent error but it dosent get my status
it shows it as none even though one, it's on google chrome, and two my status is coding
can you send me an eval code?
bae
¯\_(ツ)_/¯
(╯°□°)╯︵ ┻━┻
im trying to make it show the members status
so if i have the status of coding
which i do
it would show it
are you on v11
mhm
im not bout to spend a few hours at 9 switching it though ill do it tomorrow or sum
ty
How can i customise background of my bot page? Can i have an example?
how to fix this error?
/root/server/node_modules/discord.js/src/util/Util.js:32
);
^
SyntaxError: Unexpected token )
at Object.exports.runInThisContext (vm.js:78:16)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/root/server/node_modules/discord.js/src/index.js:3:14)
at Module._compile (module.js:571:32)
has anyone had an error like this before
@bleak agate i think yiu have an extra ");"
this isn't my code, this is in discord js's modules
Ohh?
How can i customise background of my bot page? Can i have an example?
@earnest phoenix pls help
I thought its nothing
What problem?
i did npm init but it shows error in visual studio
operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At line:1 char:1
+ npm init
+ ~~~
+ CategoryInfo : ObjectNotFound: (npm:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
@violet nimbus help your indian brother xD
me
now npm init worked but
it asks for name
and description and all
and in the video, that guy got that automatically
how
when i try t add my bot to my server its showing this
i update v11 to v12
in the redirect option?
Np @lofty urchin
hi
can someone help me after index.js thing
thanks
in video it said
put
const Discord = require(discord.js):
const client = new client(disableEveryone): true
but its not working or i am doing wrong
oh dont watch videos about coding in discordjs
oh
then what to do
these are outdated on most occasions
oh shit
can you help me
hey can anyone tell me nekos life hug,kiss and pat endpoints are considered as nsfw?
hug and pat is sfw
@earnest phoenix because they can deliver nsfw images of minors, which is against tos
Hope do you know?
Okay
i am stuck here
@earnest phoenix i actually have never really worked on discorjs myself, i always stood with java and javacord instead of javascript
should i learn that instead?
i can only give you resources than explaining it myself https://discordjs.guide/creating-your-bot/#creating-the-bot-file
cause its my first day
i can change early
its up to you what you want to learn
how can i decide
Use a language that is beginner friendly
i dont know any of these
thats why this might be useful for getting into javascript https://discordjs.guide/creating-your-bot/#creating-the-bot-file
bruh
see
its not useful
its actually more useful than i am, and thats a fact
hmm
cant i hire someone to teach me?
fiverr?
yeah you can hire people on freelancer and fiverr ofc
what should i search
why r these so cheap lol
^
so you expect someone to pay 797$ to learn coding just for discord bot?
inst that very costly
theres people who would actually do that, learning javascript could be useful in a job career
@lofty urchin read the first line
show us your code
what's your node version?
v12
and Discord.js v12 right?
that was an issue back then with d.js v12 and node below v12
I just updated from v11
no idea why it doesn't work for you, updating nodejs should do the trick
that's your d.js version, not your node version @lofty urchin
d.js v12 requires node v12+
^
How can I make an xp system by message, without raising the ping for calling mysql so many times
yep time to update node
make it so your users can gain xp every n amount of minutes/seconds after sending the message
Anyone know what's wrong?
channel = bot.get_channel(709368750230601752)
role = await message.guild.create_role(name="{}'s Table Key Access".format(message.author.name))
await message.author.add_roles(role)
permissions = {role: discord.PermissionOverwrite(read_messages=True), message.guild.default_role: discord.PermissionOverwrite(read_messages=False)}
table = await channel.create_text_channel(message.author.name + "-table", overwrite=permissions)
await message.delete()
Things work properly, The message got deleted and create a new text channel, the everyone got overwrited to the text channel, but not the newly created role, why does this happen?
I'm also in python if you can't tell.
see?????
thanks 
I need help sijdifhdkghidfh .v,ngMItsp
you gotta wait for someone who uses python too
is it possible to make my bot edit an embedded message
again you could use javascript
what would that even be used for
see #general for context
Well once you actually get to use JavaScript on your bot page, you can do anything
I don't exactly know howy but you could
Only for certified developers though
does anyone know how I edit an embed
in which library
Just edit the message like you would normally do, though using the embed like you would in sending a message
If you're talking abou js
You would get the embed from the message (message.embeds[0]) and then copy it (new MessageEmbed(embed)) then make your changes and then edit it (message.edit(theNewMessageEmbed))
@violet nimbus Which one do you mean xD
hero.moveRight()
hero.moveDown()
hero.attack("Weak Door")
hero.attack("Weak Door")
Defeat the guard, named "Two".
hero.moveRight(2)
hero.moveDown(1)
hero.moveDown()
hero.moveRight()
hero.attack("Two")
hero.attack("Two")
hero.attack("Two")
hero.attack("Two")
hero.attack("Two")
Get the gem.
hero.moveDown()
it says it wont work
what does the error say?
that is
maybe your hero dies
The code itself may be correct, but the logic isn't
your hero is attacking a too strong enemy, you should try to avoid these enemies with your code
with so called if statements
for example this is on their docs as an example
if enemy.type == "munchkin":
hero.attack(enemy)
elif enemy.type == "burl":
hero.say("I don't think it's a good idea")
ok i did it
I created a Multi-Page Help Command, it works fine apart from the fact that you need to remove your reaction manually before reacting again to change the page. Heres the code:https://pastebin.com/Use1dTJc.
what
oh god definitely
the pages
you definitely gotta clean that up
static help commands are disgusting
yea, i havent got to that part yet
make that dynamic
okay
ok, u are good^^ didnt even think u would spend time to read the documenation$
give me any random programming language docs and i should be able to understand it on a smaller basic level
@earnest phoenix How can I start with making a Dynamic help command? Is that by using arguments?
i dont code in js, i code in java 
okay
you gotta ask someone who codes d.js bots
kk
the last thing I was doing
sadly it is in es5 :>
oh damn, picture is really small
es5 boomer
https://cdn.lumap.me/w8pt41up.png excuse me
this error only happens with loop enabled
Which framework/language
this code sucks
does anyone know why this doesn't match? lookarounds have never worked for me, idk what im doing wrong
a code
codecombat code^^
yeah
look, it isnt wrong, but u have to include the error
@tight plinth its le python
@tight plinth wym because of the !
but there's a question mark after it
meaning 0 or 1
Here. i moved it to the right, but the IDs are still not matched
What does ?= do
the error says
@burnt pecan just make a complete screenshot, then I could tell you
it depends what kind of map it is
wait it only works when it's after
what a scam
apparently js doesn't support lookbehinds
try to delete the first line
ok
i think the indentation is somehow bad. is it 4 spaces or is it a tab?
because that's what the linter highlights
you should try hovering your mouse cursor over the exclamation mark
it may tell you something useful
How to change background color of bot page kn top.gg? My css isn't working? And it shows in description
Dont use "
@violet nimbus show us your long description
or send me the bot page really quick
nvm got it myself
Hmm
can you send a screenshot of your description?
I can not see if he is using " " or
And how to change main bg colot?
it dosnt
@violet nimbus you obviously gotta put something in there
@burnt pecan https://fbi.is-inside.me/982ft6M3.png
dont use the "
But how to chante whole?
he has to, door is a string
@violet nimbus use inspect element to find the correct classes
like munchkin
yeah
uhm idk how to link the levels
you can send it in here, its alright
https://cdn.lumap.me/idbq0geo.png cmon eris
i wanna check it too
yeah,beacuse
your hero doesnt have that function yet
u need to make all the levels
ohhhhhhh
# Attack the door!
# It will take many hits, so use a "while-true" loop.
while True:
hero.attack("Door")
is there any way to prevent the Error: input stream: Error parsing config: Unexpected token ; in JSON at position XXXXX with ytdl?
that is the working code
and I guess my eris skip command is just js //code serverQueue.connection.emit('end') //code?
you can try...catch it
ok ima end it there for tonight on the codeing game
Yes yes i did
javascript is better
I would start from zero because u are at the start
again, its up to the developer and what they're more comfortable with
https://cdn.lumap.me/o0606yu9.png plz help its rly annoying
Im too stupid for Eris 
loop yea
delete loop
´´delete loop´´
also happens without
What does everyone use when they make a website bot dashboard? Not really everyone but to the people that do make dashboards I guess
dashboards?
Yeah like mee6, dyno
I’ve used react before
I use express usually
I use express as well
and react client-side
very easy
Ah gotcha. Yeah I was trying react a while ago and it just got tricky with everything
you bot
yes
I mean, doing things without react would still be way messier
i am
but I feel like I am not doing some things the way they should be done
Gotcha. I’ll have to look into it more then
yeah, that is an online idle/ programming editor-
I showd that to u^^ I think it is quite nice for a beginner to work with it
yes it very much is
also what are some things to use for a discord bot like commands
most people use discord.js . that is why it would be good for you if u play the game a little bit more and learn some basic javascript syntax
then u can start with the discord bot guide on discord.js
to create a bot
@midnight blaze creating a bot as your first programming project is a horrible idea
I dont say it is a good idea, but that person wants to do it
yeah
I am just telling him that he should at least learn some javascript before starting, but yeah
i like alot of python
creating bots without programming knowlegde is not a good idea
it seems easier
should I switch to lavalink
python
@burnt pecan trust me it is not, you will regret it
.
@burnt pecan this is the javascript version of your level
does it really look soo much harder?
yes


well, have fun with python, but one day u will regrett it :>
ive already tried java
java has nothing to do with javascript
java and javascript are completly different
i say java as in javascript
ok ok 🙂 good luck!
That's like just saying script
guys, is it possible to update only a single file in heroku?
without updating the whole directory?
I have json libraries on the host server. I dont wanna change the jason files
@indigo pond what
Oh shoot
do you want someone to make a bot for you?
do you want to use the invite manager bot?
you buy it
Can I update my bot codes on heroku without destroying my json libraries?
idk
no
Maybe
you cant get nitro for free
if you know giveaways exist why are you asking
Ты русский?
what
Nothing
Ты русский?
@indigo pond I'm not russian
ᴀᴀᴀᴀᴀᴀ
I need help guys
Translator
they werent talking to you lul
Haha haha
@sullen night dont ask2ask
i asked several times actually
Cyber

without destroying the existing json libraries there
if (message.content.startsWith(prefix + "test")) {
let a = 11;
let card = [2, 3, 4, 5, 6, 7, 8, 9, 10, a];
let playerCard = card[Math.floor(Math.random() * card.length)];
let botCard = card[Math.floor(Math.random() * card.length)];
const filter = (reaction, user) => {
return ['👍', '👎'].includes(reaction.emoji.name) && user.id === message.author.id;
};
//reacting
message.channel.send(`Your cards: ${playerCard}\n Bot's cards: ${botCard}`).then(msg => {
msg.react('👍').then(() => msg.react('👎')).then(() => msg.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '👍') {
playerCard += playerCard
if (playerCard > 21) return message.channel.send(`Your cards: ${playerCard}\nBot cards: ${botCard}\n **You lost**`);
msg.edit(`Your cards: ${playerCard}\nBot cards: ${botCard}`)
} else {
botCard += botCard
if (botCard > 21) return message.channel.send(`Your cards: ${playerCard}\nBot cards: ${botCard}\n **You win**`);
message.channel.send(`You decided to stay\nYour cards: ${playerCard}\nBot's cards: ${botCard}`)
}
})
.catch(collected => {
message.reply('you reacted with neither a thumbs up, nor a thumbs down.');
}))
})
}```
when i hit it edits but if i hit again it doesnt
@indigo pond by buying it lol
error
Unexpected string in JSON at position 1168
code:
let db = JSON.parse(fs.readFileSync("./database.json", "utf8"));
congrats you fucked up your db
json db 🤡
And how can i solve it ?
you can by using a proper database
what do you want to convert?
you dont need a converter for that
i want help
ye
then put it in
I do not understand the questions
is this banned as this has sent 2 messages on 1 command?
not really
no
why should it be
but for a kick command it's better sending one error message instead of two
it's bad practice
yeah
send one message
or merge the two errors into one message
make sure you put a return before each message.channel.send
bot.on("guildMemberRemove", member => {
const db = require("quick.db")
let chx = db.get(`leavechhannel_${member.guild.id}`);
let leavechannel = member.guild.channels.get(chx);
console.log(chx, leavechannel)
if(chx === null) {
return;
}
const defaultmsg = new Discord.RichEmbed()
.setThumbnail(member.user.displayAvatarURL)
.setAuthor(`${member.user.username}`, member.user.displayAvatarURL)
.setColor("#800080")
.setTitle("**_Un membru tocmai a parasit serverul!_**", member.user.displayAvatarURL)
.setDescription(`:wave: -> ${member.user.username} a parasit serverul **_${member.guild.name}_**!\n:wave: -> Speram ca se va intoarce!`)
.addField("User ID", `${member.id}`, true)
.addField("User Name",`${member.user.username}`, true)
.addField("Total Users", `${member.guild.memberCount}`, true)
.setFooter(`${member.guild.name}`, member.guild.iconURL);
leavechannel.send(defaultmsg);
})
any idea why my leavemessage doesn;t work ?
debug your code
try catch for exceptions
inspect your variables
https://discordapp.com/channels/264445053596991498/272764566411149314/709433421201408061 does someone know this? It's about stopping the execution of one file in another file.
hey can someone tell me how can i link my bot to my Game's server?
either establish a ws connection between your bot's process and your game's servers or integrate your bot in the game servers themselves
websocket
ty 🙂
obviously you'd need to secure it with an api key and a wss connection
who needs help with discord.py?
how can i get user avatar ejs
<%= user.avatarURL()%>
how i can get admin perm like true or false?
?
how i can get admin perm like true or false?
@earnest phoenix I dont understand
administrator permission Boolean thingy
yes
ah
basically permissions#has
wouldn't be surprising since he has 11 volts of library
lol
oldRole.hasPermission("ADMINISTRATOR");
this is ok?
dont work
lol
what is oldrole
wait me
probably an event
What are the websites to learn coding again?
newRole.hasPermission('VIEW_AUDIT_LOG')
dont work ;c
read the docs
me?
no, noah
code : ```js
module.exports.run = async(client, message, args) => {
if(message.member.hasPermission("ADMINISTRATOR")) {
let target = message.mentions.users.first()
if(!target) {
const userembed = new Discord.RichEmbed()
.setDescription(":no_entry_sign: Specifica o persoana!")
}
let fetched = db.fetch(`blacklist_${message.guild.id}_${target.id}`)
error :
```Cannot read property 'id' of undefined```

if (newRole.hasPermission('VIEW_AUDIT_LOG') !== oldRole.hasPermission('VIEW_AUDIT_LOG')) {embed.addField("Registro de auditoria", newRole.hasPermission("VIEW_AUDIT_LOG"))};
with the perm ADMINISTRATOR work
roleUpdate perms xd
wouldn't that be MANAGE_ROLES perm?
first
like, 99.999999% of server owners will NOT give admin perm to anyone
what do you mean by it doesn't work
what happens and what doesn't happen
not 99.99999% of them
wait a second
just the smart ones
mmm
if (newRole.hasPermission('VIEW_AUDIT_LOG') && oldRole.hasPermission('VIEW_AUDIT_LOG'))
bc if oldRole has the perm it'll be true and if nesRole also has it then it should be true and you're checking if they're not equal so you're basically doing: if (true !== true)
which is false
HOW TO ASK FOR HELP TEMPLATE
+ BUG: Simon falls off his horse
+ LIBRARY: Simon.js v13
-------------------
+ STEPS TO REPRODUCE:
1 - Run "Simons stays on his horse" code
2 - Use "s!rideonhorse" command
3 - Simon falls off his horse
-------------------
+ EXPECTED RESULT: Simon rides on his horse
- ACTUAL RESULT: Simon falls off his horse
-------------------
+ CURRENT CODE:
if (isSimonOnHorse) {
Simon.fallOffHorse();
Simon.rideHorse();
}
&& is the and operator
i know
if this is true && (and) this is also true
a mod could pin that
but negate the right side of the &&
add a ! before the statement on the right of the &&
wdym
regex
idk what the regex for it is
omg no lol
i was typing without thinking
Ik
this is how I check for urls on my bot:
public static boolean findURL(String text) {
final Pattern urlPattern = Pattern.compile(
".*?(?:^|[\\W])((ht|f)tp(s?)://|www\\.)(([\\w\\-]+\\.)+?([\\w\\-.~]+/?)*[\\p{Alnum}.,%_=?&#\\-+()\\[\\]*$~@!:/{};']*?)",
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
text = StringUtils.deleteWhitespace(text);
text = (Extensions.checkExtension(text) ? "http://" : "") + text;
text = text.replace("1", "i").replace("!", "i");
text = text.replace("3", "e");
text = text.replace("4", "a");
text = text.replace("5", "s");
text = text.replace("7", "t");
text = text.replace("0", "o");
text = text.replace("#", ".").replace("%", ".").replace("$", ".").replace("@", ".").replace("*", ".").replace("#", ".").replace("&", ".");
final Matcher msg = urlPattern.matcher(text.toLowerCase());
return msg.matches();
}
although I must admit
what
that's complex af
Wtf
that
Bro 😂
xdddddddddddddd
code : ```js
module.exports.run = async(client, message, args) => {
if(message.member.hasPermission("ADMINISTRATOR")) {
let target = message.mentions.users.first()
if(!target) {
const userembed = new Discord.RichEmbed()
.setDescription(":no_entry_sign: Specifica o persoana!")
}
let fetched = db.fetch(`blacklist_${message.guild.id}_${target.id}`)
error :
```Cannot read property 'id' of undefined```
Help ?
@earnest phoenix just copy the regex part
maybe cool down on the coding
.*?(?:^|[\\W])((ht|f)tp(s?)://|www\\.)(([\\w\\-]+\\.)+?([\\w\\-.~]+/?)*[\\p{Alnum}.,%_=?&#\\-+()\\[\\]*$~@!:/{};']*?)
wtf
if we gloss over that
you can see my role command not woring
which is why i came here
can anyone help me?
Give some docs for commands permission level check
if(!args[1] == message.mentions.members.first()){message.channel.send("There must be a second argument to run this command")}
if(args[2] == "admin")
{
if(member.roles.cache.has(ownerRole) || (member.roles.cache.has(adminBotRole)))
{
message.mentions.members.first().roles.add(adminRole)
}
}
if(args[2] == "moderator")
{ if(member.roles.cache.has(ownerRole) || (member.roles.cache.has(adminRole) || (member.roles.cache.has(adminBotRole))))
{
message.mentions.members.first().roles.add(moderatorRole)
}
}
if(args[2] == "trial")
{
if(member.roles.cache.has(ownerRole) || (member.roles.cache.has(adminRole) || (member.roles.cache.has(adminBotRole) || (member.roles.cache.has.add(moderatorRole)))))
{
message.mentions.members.first().roles.add(trialModRole)
}
}
if(args[2] == "tester")
{
if(member.roles.cache.has(ownerRole) || (member.roles.cache.has(adminRole) || (member.roles.cache.has(adminBotRole) || (member.roles.cache.has.apply(moderatorRole) || (member.roles.cache.has(trialModRole))))))
{
message.mentions.members.first().roles.add(testerRole)
}
}
can anyone help me?
lol
i have been
@earnest phoenix this is how you read that regex https://www.youtube.com/watch?v=IjIViETya5k
13 Sorting algorithms
Insertion
Bubble
Selection
Cocktail Shaker
Merge In-Place
Merge Out-of-Place
Gravity
Quick
Counting
Radix LSD (Least Significant Digit)
Radix LSD In-Place
Radix MSD (Most Significant Digit)
Shatter
There are so many of the same variable
skip to 1:37
there has to be a simpler solution
should i try putting all the vars in a array
and make a comment above it showing which are which?
i tried using your regex
if(/[.*?(?:^|[\\W])((ht|f)tp(s?)://|www\\.)(([\\w\\-]+\\.)+?([\\w\\-.~]+/?)*[\\p{Alnum}.,%_=?&#\\-+()\\[\\]*$~@!:/{};']*?)]/)```
but it errors
Unmatched
welp
that's because that's not how it works
no hope
im trying to make a command where if your a role for an example, moderator you can give people trial mod, member and other roles like mute @maiden mauve
you gotta use inside a String.match() method
thanks
whats itay trying to do lol
language lol
then put my regex inside /regex/g
so it'd be //[.*?(?:^|[\\W])((ht|f)tp(s?)://|www\\.)(([\\w\\-]+\\.)+?([\\w\\-.~]+/?)*[\\p{Alnum}.,%_=?&#\\-+()\\[\\]*$~@!:/{};']*?)]//g
oh
@earnest phoenix do @a role you want
because js requires those terminations
wait
that's doesn't look like it would work
could you assign each role a numeric value in order of its moderation power?
fuck
@royal laurel what? xd
// ???
it didnt show up my backslash
basically just put a backslash before the at symbol @earnest phoenix
not a forward slash
a backslash
@maiden mauve wdym buy add numeric value?
not administrator(8)
instead of hunting for all the roles they have
you mean bitewise values
just find the one that matters
I've never messed with roles/moderation code
but looking at that there has to be a better way
there is
ik
the problem is tho
i dont get any feedback
theres no erros
wait
fuck i havent tried .catch
if theres no errors then its doing what the code does
k
errors will report to cmd even without a .catch
if the code isn't performing console log the roles functions to make sure they are the correct variables you want
i fucking drank coke and made all of that code for nothign?
then double check djs documentation to see if your functions are what you actually want
i checked rolemanagers on the docs
guys
use ===
why
would u call someone who had their bot premade but u went in and fixed everything to you liking not a bot?
strict vs non strict
because if you do "123" == 123 it'll return true
your*
== will let garbage go through as an equality
for example
yes his example was good
== checks only for value
=== forces type definition
=== checks for both value and type
=== is more like C style equivalence
k
the only time you should use == is if your sniffing for undefined variables
how do i do that epic shortcut where it will highlight all the == things and change it?

