#development
1 messages ยท Page 472 of 1
@slender thistle pls say what is wrong with that
well i know some indenting is wrong
Yeah, that doesn't look like any normal programming language syntax
- Inconsisent use of tabs and spaces, probably.
- You don't fucking do
global var = 0 global var2 = 1.
Multiple lines exist. :^)
what is global anyway
Gabe up
its probably like global.something = "uh" in js
StackOverflow will help.
const Discord = require('discord.js')
module.exports.run = (client, message, args) => {
const help = new Discord.RichEmbed()
.setTitle("Help")
.setDescription("commands:")
.addField("[Joke \n Sends a random joke")
.addField("[Help \n Shows this")
.addField("[Ping \n Responds with pong")
.addField("For people with the permission:")
.addField("[Kick @user \n Kicks a user")
.addField("[Ban @user \n Bans a user")
.addField("[Role {role} {user} & [Delrole {role} {user} \n Gives/Removes a role from a user")
.setColor(0x00ff00)
.setFooter(`Help for ${message.author.tag}!`)
message.channel.send(help)
}
module.exports.help = {
name: "help"
}``` this is the help command,
but after every field, it says undefined
why?
shit if thats how ur gonna make ur help command rip
^
So I need to add a description after title
Yes
Wait no
and yeah you need a better way of listing your commands. Perhaps build an embed from important modules instead of hardcoding it
It's already on there
.addField(title, desc)
So change \n for ,
That's how it's supposed to be in addField
@wide ruin end the string, put a comma, start a new string
Like "help", "this comamnd"
File "c:/Users/Mini David/Desktop/brute/bot.py", line 24
@bot.command(pass_context=True)
^
IndentationError: unindent does not match any outer indentation level
PS C:\Users\Mini David>```
what do i do
That's one way of interpreting it, I guess 
indentation error
for some reason i cant understand anything else about that error
Done ๐
Collecting sys
Could not find a version that satisfies the requirement sys (from versions: )
No matching distribution found for sys
You are using pip version 9.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
PS C:\Users\Mini David>```
im pretty sure to use sys you just import it
Isn't sys already installed...
correct me if im wrong
ok
Wrong channel to ask.
But well, #general got locked down.
Because of the people who kept complaining about people from here hacking their bots.
oh well shit happens
Maybe you shouldnt post your bot code with your token online
I joined from a link crewio
Stop complaining and use common sense people
From crewio *
He's trying to frame Tonukku lmao
Move to #memes-and-media, thanks.
You can add it to gitignore
I didnt start the convo??
Yeah use gitignore or just delete token from source...
Um... Why do I not have permission to send message in the general channel?
If you are going to publish the code use common sense on whether or not it will be private
Ohhh
I don't have permission either
Nobody but staff do
Apparently some wannabe hacker is fucking with leaked bot tokens which people could quickly solve...
You cannot chat in #general because it was locked down due to many people coming just to complain about hacked bots.
And people flamed the channel
Alright, alright, alright. You don't have to make me feel bad
How was I supposed to know
It was my first time creating a bot
Let's move the questions about #general to #memes-and-media, now. 
Hey shiv can you stop mini modding thx
Yeah sure np. :^)
In d.js can you say let message = client.message
use my bor
no @wide ruin
the fuck
How can you?
to get message u need the message event
Traceback (most recent call last):
File "c:/Users/Mini David/Desktop/brute/bot.py", line 5, in <module>
import chalk
ModuleNotFoundError: No module named 'chalk'
PS C:\Users\Mini David> python -m pip install -U chalk --user
Collecting chalk
Could not find a version that satisfies the requirement chalk (from versions: )
No matching distribution found for chalk
PS C:\Users\Mini David>```
hmm
who here knows how i remove a command in discord.py (async)
bot.remove_command('command_name')
Traceback (most recent call last):
File "c:/Users/Mini David/Desktop/brute/bot.py", line 5, in <module>
import chalk
ModuleNotFoundError: No module named 'chalk'
PS C:\Users\Mini David> python -m pip install -U chalk --user
Collecting chalk
Could not find a version that satisfies the requirement chalk (from versions: )
No matching distribution found for chalk
PS C:\Users\Mini David>```
ploz halp
xD
Idk
You don't have to spam that.
@slender thistle I tried that
why do you need chalk and what does it do 
Chalk allows you to print to your terminal in color. It also provides a simple logging handler and formatter for a more informative logging experience. Why print in black and white?
Discord.py lets u do this but a bit different in variable context
so chalk isnt needed..
@slender thistle That didn't work
message = ctx.author.content
hello
@earnest phoenix Looks like the thing isn't being called. :^)
what do you mean?
what does dbl do
d.js const Message = args.join(' '); this better?
Well, what command are you trying to remove, anyways?
Noo
help @slender thistle
What does dbl do
Are you trolling
no
@knotty steeple wut
he is trying to remove the help command
pls
How tf is a constant var gonna work for messages
@earnest phoenix wait for staff to approve it
<Client>.on('message', msg => {
// use msg for anything
})
``` @wide ruin thats how you get message
what does dbl do
wdym
bot.remove_command('help') right after declaring bot. It's easy to remove the in-built help command.
Using message whitespace to get messages in JS ๐คข
@topaz fjord wdym
it cant get more basic than what i said
It exposes ur bot?
yes so people can invite it
advertises ur bot
this pice of code dose not work why await client.change_presence(game=discord.Game(name=current_status)) await asyncio.sleep(5)
but people should be able to invite it already
It's a website where you list your bot so that more people could see it and decided whether or not to use it.
@open basin rewrite or async?
async
Uhh
to loop statuses
of the bot
i have
No you have not
yes
Idk
ok i will try
For loop was most relevant in my head
Hold the fuck up.
no u
Yikes
https://github.com/Rapptz/discord.py/blob/master/examples/background_task.py use this as example for your status loop.
fite me broo
Nou
thats shitpost and has to go in #memes-and-media
not trying to minimod
โค
#memes-and-media please.
Yep.
Yesh
:v)
samurai
what
;;help
Yeah, I figured that out
ffpronounce dont fuck wit me, i have the god and anime on my side! AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
.
...
Ok you can call a mod now
im gonna let @hushed berry tell you where you are supposed to be
he is cool
hey @latent heron how would i make it so users can change the prefix for their server only and not global..?
well im gonna go this is pretty offtopic tbh
Uhh
Well
You can create server files for the bot
So it opens the file in the code idk
how would i do that
I never did it
shit ok
But
database
@thorn vault Move to #memes-and-media for real. You are not discussing things that are appropriate for #development.
I would do like a database or .txt
-_-
txt would be bad if the bot is in 12k servers
then it would have 12k text files 
tts doesnt work ๐ฆ
also, how do i find out how many server's it's in so i can put it in the status..?
If command is prefix: get server name, open server name.txt, split content in file, get prefix, change to prefix
len(bot.guilds)
Idk about the global part tho
@queen sentinel 369145073989976075 (@thorn vault) shitposting in #development.
ok thanks samurai
len() gets the length of something
Hm
Length of a list or tuple.
Dont you need to list the server guild firdt
or a string. :^)
Before len?
@knotty steeple
like a list
Idk but shiv is more intelligent than me
@earnest phoenix servers, not guilds.
I dont wanna give false info
okay
oh yea async
Well servers is async, guilds is rewrite
my bad
Just remember that servers is the only thing that exists in async. guilds aren't.
@ocean current
Why is it guild tho
it's in 3 servers! ๐
Servers makes more sense
Doesn't Discord API call them guilds?
so this and my main server, but someone else got whale ๐
Ill go write a complaint to discord bout it then
I mean, you could play around with the source and call those servers.
Or do stuff like bot.servers = bot.guilds
wdym abuse api?
cough mass DM or message
Is an example
Dummies guide to getting banned on Discord
I would recommend sending into a channel but you would need to find or get yourself and then (whatever you denified it as).send(whatever here)
So how would I find myself
You could use client.fetchUser();
^
It returns a User object which you can use the send method on.
However keep in mind it returns a promise.
client.fetchUser("id").then(user => user.send());
438733159748599813
Thanks
Np
I would ask for token, but I like the server
And discord as a whole
So no
I won't ask
Huh
what
Token? What?
Selfbots need user tokens
and?
client.fetchUser("438733159748599813".then(user => user.send("text here"));
Is that right?
Yes
No.
no
Oh
O
Nvm
fetchUser is its own function.
The .then is only because it returns a promise.
Which you need to wait for.
I'm on mobile, hard to read
client.fetchUser("438733159748599813") .then(user => user.send("text here"));
Do that
I need help
help for what?
@bot.command(pass_context=True)
async def lock(ctx, channel: discord.Channel):
if ctx.message.author.server_permissions.manage_channels:
overwrite = discord.PermissionOverwrite()
overwrite.read_messages = True
overwrite.send_messages = False
await bot.edit_channel_permissions(message.channel, message.author, overwrite)
embed= discord.Embed(title="Locked channel.", description="This channel was locked by {}.".format(ctx.message.author))
@bot.command(pass_context=True)
async def unlock(ctx, channel: discord.Channel):
if ctx.message.author.server_permissions.manage_channels:
overwrite = discord.PermissionOverwrite()
overwrite.read_messages = True
overwrite.send_messages = True
await bot.edit_channel_permissions(message.channel, message.author, overwrite)
embed= discord.Embed(title="Unlocked channel.", description="This channel was unlocked by {}.".format(ctx.message.author))
"Channel is a missing argument"
hmmmm. sadly i can't help you :/
Thanks anyways :):
i use dsharp plus so sorry
;-;
(discord.py, async)
Do you have a channel variable @earnest phoenix
And then define the channel you want it to be said in
but the thing is
is that i want it to be said in any channel
and for the bot to recognize the channel
and lock said channel
Alright. Thank you anyways.
No problem
@bot.command(pass_context=True)
async def lock(ctx, channel: discord.Channel):
if ctx.message.author.server_permissions.manage_channels:
overwrite = discord.PermissionOverwrite()
overwrite.read_messages = True
overwrite.send_messages = False
await bot.edit_channel_permissions(message.channel, message.author, overwrite)
embed= discord.Embed(title="Locked channel.", description="This channel was locked by {}.".format(ctx.message.author))
@bot.command(pass_context=True)
async def unlock(ctx, channel: discord.Channel):
if ctx.message.author.server_permissions.manage_channels:
overwrite = discord.PermissionOverwrite()
overwrite.read_messages = True
overwrite.send_messages = True
await bot.edit_channel_permissions(message.channel, message.author, overwrite)
embed= discord.Embed(title="Unlocked channel.", description="This channel was unlocked by {}.".format(ctx.message.author))```
"channel is a missing argument"

is it obvious.. ๐
datboi do you know discord.py?
i know rewrite
damn, this is async
let me check one sec
I do know that you forgot
await bot.say(embed=embed)
I don't know anything else, sorryh.
when youre doing channel
did you do it like +unlock #265156361791209475
because that could be what is just simply causing it
how are you running the command then
wait
wait
wait
wait
now it's giving this
I'm just trying to edit permissions D:
(and lock a channel)
is everyone defined
where did you define it
everyone = list(r for r in ctx.guild.roles if r.id == ctx.guild.id)[0]```
this should work
How to disable it that your bot responds to other bots?
change the prefixes
d.js message isn't defined?
lemme find the code
what lib you use @ruby talon ?
async
it should be done automatically
How isn't message defined? Pls help
async def on_message(message):
if message.author.bot:
return
await self.bot.process_commands(message)
```
I use async.
Can I have help please
Message isn't defined
@fiery canyon ty.
so change the prefixes then, because it's getting called from when a bot uses a prefix, change a prefix to something semi-original such as ;- or something @ruby talon
But I have had no problems before with it
Can I invite you to the code?
d.js
o h
ah ye you said that
is it in on_message
function on_message(message) {```
?
well
Damn.
i know just a bit of python
lemme find you some help
but basically nothing
this will help
It seems so simple just to lock a channel
oh thats rewrite
@earnest phoenix my bot has multiple prefixes to make it easier for users, I won't change them and @fiery canyon already gave me a good response, I'll look into it tomorrow.
Gn ya all.
erm
you just called it not in an event
it should be in an on_message event
@wide ruin You're coding on your phone? Wait until you're on your computer to do it, much easier.
^
also
you havent even supplied a bot token yet
so dont you think something is wrong

its not even running the bot
and nothing there
There is an error
its not in an event
Can I just invite you
ok what is it
No
no like whats the problem
The code that i used has worked before
he didnt put it in an on_message event or as a command
discord.js message event is just message
hes not declaring an event or command
why are u defining args if you already have it in the run function
@earnest phoenix D#+ best lib
i making a music command in d.js and when it streams to the channel the audio is all choppy and laggy, how would i fix that?
i was gonna build a new one soon, is a raspberry pi 3 not good enough?
lol ok, would an old 2 core i3 be better
you mean your internet connection or the i3
it can't
y not
if it's a normal pc
wells its some partss from an old one i had, if it was a dedicated server would it be good?
tghe new build
ima try the command on my main build and see if that fixes it
oki
is discord ID an int or text value?
depends on lib
discord.js
iirc it's text in d.js
ffs that's why it keeps telling me it couldn't find the server in the database
thanks
one of my static files in apache has been cached and i need to update it but i cant figure out how to clean out the cache to change it
if anyone has any tips pls can you @ because i have my notifications muted. imma go fight with it some more
@brave wedge you mean it has been cached by the browser and you want to force the browser to update it?
no, its being cached on the server
i have my browser cache turned off to avoid this sort of stuff
oh wait does cloudflare cache stuff?
yes
there you have it, clear the cache or enable dev mode temporarily. if you want it permanently you can either do it via page rules (for specific stuff) or globally by cache settings
christ that was more painful than it had to be. thanks.
still not working though but i think this is on me. websockets and stuff, ill figure something out
how do I make this like ban perms or administrator
if (!msg.member.hasPermission('BAN_MEMBERS')) return msg.channel.send(`You don't have permission to run this command!\nMissing Permissions: \`BAN_MEMBERS\``)
node.js?
@earnest phoenix When you check perms, if someone has the admin perm, it will always be true for every permission node
๐ค
@bot.command(pass_context=True)
async def info(ctx, user: discord.Member):
if discord.Member:
embed = discord.Embed(title="User Info", description="The user's username is: **{}**\nThe user's status is **{}**".format(user.name,user.status), color=0x234D87)
embed.set_thumbnail(url=user.avatar_url)
await bot.say (embed=embed)
else:
embed = discord.Embed(title="Hmm", description=":thinking: I can't find that user...", color=0x234D87)
await bot.say (embed=embed)```
@knotty steeple do you see any problems with this?
no cuz i dont py
I'm not sure if color=0x234D87 is legal
that's just a hex literal
Natan what do you mean?
idk then
ah
how do you have it richtext enabled?
I need to do more Python :^)
plugin
rich presence*
like i'm chilling in visual studio code but it doesnt show mine ๐ฆ
you need to install a plugin
for some reason this bit of code client.channels.get('473694816190988288').send('test') works on my eval command but not on the bot, any ideas?
you need an extension
There's a plugin for VS Code too
how do i install it lmao
got it
vscode-discord is one i also have if i want to customise certain stuff
for some reason this bit of code client.channels.get('473694816190988288').send('test') works on my eval command but not on the bot, any ideas?
@viscid falcon are you getting any error in particular?
we already saw your message
no need to keep asking it
sure, gonna take a minute since i cant copy paste
take a screenshot 
cant, seperate computer
rip
const Discord = require('discord.js');
const client = new Discord.Client();
module.exports = {
name: 'bug',
cooldown: 2,
description: ''reports a bug',
execute(message, args) {
client.channels.get('heres my channel id').send('worked')
},
};
You're not logging in?
And itโs: client.channels
Why are you instancing another client?
well thats your issue
your making another client
that isn't logged in
has no commands or channels
its worked for other commands
its a new bot literally
You are creating a new instance
If you're going with a modular command design, take a look at discord.js-commando
how would i not do that
Because you're doing it wrong
message.client
ew
Won't work
but then client wouldnt be defined
commando is fucking gross
its a seperate file
Client not logged in = no channel cache
just pass it through
Just module.export your real bot instance
client is a property of the message object.
global.client = client even
Ew
What's wrong with commando 
its commando
so what would it be message.client.get...
yes
thanks!
Yes but that still won't work
How will it not? That returns the client who received the message.
but it just did
If it doesnโt work, just require your main instance and call an exported module of the discordjs bot instance
<message>.client.[whatever]
you have a diffrent set up then i do jokerus
He instantiates a new client, and does not log in
it doesnt mean me or u are wrong
That's not the issue
go to #commands and do _bug, you will get no errors and i recieve the message
it works
actually
it will since you're passing a message object, my bad
But
const Discord = require('discord.js');
const client = new Discord.Client();
There's no need to create a new client here
ik that now, it just thats how i used to do it
now imma go cuasae my dad brought home chinese food
I assumed you were using properties of the new client 
that literally all the code for that command
its just a bug reporting command
may add 1 or 2 more lines though
Node.js ( Discord.js )
How would I make my bot join voice channels and play music?
google is nice this time a year
Get a Voicechannel (https://discord.js.org/#/docs/main/stable/class/VoiceChannel) and use the join method. To play music you have to download the mp3 and play that. There are libraries for this.
Where would I get the mp3 file
Youtube is one of the most popular and has an api for it. (TOS allows it unlike spotify.)
mb
Alrighty, then
- Computers don't have mp3 files unless downloaded manually
- I don't trust websites.
- you cant get one then
then where will you get the music from...
if you "dont trust websites"
also u know discord is a website
you think youtube is shady???
lol
so then get it from youtube
Many sites are shady
You only have to trust YouTube
is there a way to get an html element from a specific website, like if i wanted to get the pokedex entry from this website and send it to the user https://www.pokedex.org/#/pokemon/1
A mini-encyclopedia of Pokรฉmon species, types, evolutions, and moves.
You could scrape it and scan ids.
how would i scape it?
Yeah, but most websites don't like it
https://pokeapi.co/ This would be a better choice though.
Pokeapi The Pokemon RESTful API
thanks
You're using JS, right? Look into request and cheerio
if you want to scrape
oh well
ill just use the api lol
Yeah api is the best option
and is there a way to download discord.js docs, im going to be on a flight in the near future and i wouldnt mind having that handy
if you download d.js itself, i think the docs are generated from the source
It's totally possible and a simple google search could find you a tool.
The docs are generated from JSON files on the docs branch. https://github.com/discordjs/discord.js/tree/docs
why i cant get banned=
?? can you be more clear?
is english not your native language? try asking to see if anyone speaks it
Off topic, and if you're trying to trigger auto ban mechanism of a bot by cussing, it won't work
y
That was for nomnom 
if (message.content.includes('frick')) {
message.author.ban //forgot the ban method
}
ok
ban is a member method, not user
message.member.ban
message.member.ban() is the correct usage
but why wouldnt auto banning work for swearing
@viscid falcon pls no swear christian server
srry
I don't think bots here have permissions to ban
oh i thought u meant it wouldnt work in any servr
ok lets try again "fuck, shit, bastard" and let's try german "scheisse, fick" and turkish "siktir, orospu" and TA DAA no ban
magic
then prob a collection and while loop
let me show u a similar thing ive been working on
ok
this follows the same concept
var BugNames = ['bug', 'error', 'glitch']
while(i--) {
if (helpRequest.includes(BugNames[i])) {
if (helpRequest.includes('report')) {
console.log('success')
message.channel.send('To report a bug use ;bug <bug> in any channel or server')
return;
}
}
}
you would prob only have 1 if statment
but auto banning for cussing is a bad idea
please tell me you defined i somewhere before that
xD
linking this here for anyone on d.js that wants help w/ sharding: https://discordjs.guide/#/sharding/
its a useful guide
A guide made by the community of discord.js for its users.
and kinda detailed
isnt that only for external sharding?
Internal sharding is still in early development
@fiery canyon ur bot was "hacked"?
yeep
people are still asking
btw, convo is in #memes-and-media mainly
Was the recently-deleted bot in Turkish?
most probably
yes it was
in d.js, how can you make the bot change from playing to watching, listening and streaming?
Are we allowed to use .css and html on detailed description or just html?
Anyone knows how to do this with YAGPDB? That after every message, it sends automatic response
I couldn't find their official server 
Wait nvm found it 
I Wouldn't Really Know Where To Send This In The Server But I Recently Had My Discord Bot Rejected For A Reason I Have Now Fixed And I Was Wondering If I Can Re-Submit It On To discordbots.org I Have Re Submitted It And Hope It Doesnt Get Re-Declined Again
yes, resubmit it and wait
Who develops py-js bots? dm me
py me
py-js? like mixing both?
Probably someone who knows js and py
@oak sentinel 
lel
I can help with discord.py :^)
I mean i succ at it
so
I succ at both languages
I don't learn from both online tutorials, so im looking for a human
(;
3 2 1
i can help with js, but not with private lessons (unless there is $$)
There is so many D:
rip
Back at mini-modding ofc
Does Anyone Know How To Check For A Command Being Requested In A NSFW Channel Since I Have To Make My Urban Command NSFW
lib?
I Have Tried This But According To My Bot And To The Source Code Of Discord.py is_nsfw() Doesnt Exist In The Code
which version of discord py?
0.16.12
cant find anything in the docs
Thanks For Your Help But Ill Just Remove That Command From the Bot
i think its not available in that version
Attempt 3 Of Submitting My Bot
good luck
Yep. is_nsfw() doesn't exist in 0.16.x
ive got gunicorn, flask and nginx. something is redirecting to https://cards.jellywx.co.uk,cards.jellywx.co.uk/game?id=11 (rather than just https://cards.jellywx.co.uk). has anyone had this before?
Is it possible to multiple language bot?
when you say language what do you mean, programming or spoken
i guess they mean programming 
yeah lol, just depends if its worth it
nope
speaking language
English, Turkish etc
Is there any tutorial for this? I can make different commands for each languages but its look so noobish xd
@foggy oak set per server and get cmd responses from a file
so like java?
function functionname(){
// code state here...
}
what
why dont u make a java bot 
what are you even trying to do
i use node.js 0-0
so why did you say like java
trying make is as function or external code
im very confused
i though node.js same as java
fine~
LMFAO
sorry for your time
js = Java
@night bridge Can you speak turkish?
love it
Nope. sorry >_<"
oh ok
i own a domain..
ok
gg
js / node.js = javascript (ECMAScript)
java = java
@night bridge
id recommend storing commands in some sort of Object
then checking to see if there are any keys in said object
that match the inputted command
if so
run the associated value
smth like
let commands ={kek: function () {}}; if (msg.content == "/kek") return commands.kek();
this is a TERRIBLE example but this should give you a basic idea
or if(commands[commandname]) { commands[commandname].run() }
so u dont need a big if statement lmao
i do ```commands = ["cmd1","cmd2","etc"];
if (commands.indexOf(msg.content) > -1) { eval(msg.content) }
function cmd1() {}
//etc
xD
yea
well i usually load all the plguins from a directory
parse the msg (meaning break it up into 3 parts, trigger command and parameters)
How do I do serverjoin messages with an image
which lib?
const client = new Discord.Client();
const token = ('lol not stealing today')
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', msg => {
if (msg.content === 'ping') {
msg.reply('Pong!');
}
});
client.login('token');```
but
at WebSocketConnection.client.ws.connection.once.event (C:\Users\Mini David\Desktop\brute\node_modules\discord.js\src\client\ClientManager.js:48:41)
at Object.onceWrapper (events.js:273:13)
at WebSocketConnection.emit (events.js:182:13)
at WebSocketConnection.onClose (C:\Users\Mini David\Desktop\brute\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:390:10)
at WebSocket.onClose (C:\Users\Mini David\Desktop\brute\node_modules\ws\lib\event-target.js:124:16)
at WebSocket.emit (events.js:182:13)
at _receiver.cleanup (C:\Users\Mini David\Desktop\brute\node_modules\ws\lib\websocket.js:220:12)
at Receiver.cleanup (C:\Users\Mini David\Desktop\brute\node_modules\ws\lib\receiver.js:535:15)
at WebSocket.finalize (C:\Users\Mini David\Desktop\brute\node_modules\ws\lib\websocket.js:206:20)
at TLSSocket.emit (events.js:187:15)
(node:1696) 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: 2)
(node:1696) [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.```
@thorn vault token = variable, 'token' = string
ok

else you're giving it literally "token" as the token
PS C:\Users\Mini David\Desktop\brute> node bot.js
(node:3636) UnhandledPromiseRejectionWarning: Error: Incorrect login details were provided.
at WebSocketConnection.client.ws.connection.once.event (C:\Users\Mini David\Desktop\brute\node_modules\discord.js\src\client\ClientManager.js:48:41)
at Object.onceWrapper (events.js:273:13)
at WebSocketConnection.emit (events.js:182:13)
at WebSocketConnection.onClose (C:\Users\Mini David\Desktop\brute\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:390:10)
at WebSocket.onClose (C:\Users\Mini David\Desktop\brute\node_modules\ws\lib\event-target.js:124:16)
at WebSocket.emit (events.js:182:13)
at _receiver.cleanup (C:\Users\Mini David\Desktop\brute\node_modules\ws\lib\websocket.js:220:12)
at Receiver.cleanup (C:\Users\Mini David\Desktop\brute\node_modules\ws\lib\receiver.js:535:15)
at WebSocket.finalize (C:\Users\Mini David\Desktop\brute\node_modules\ws\lib\websocket.js:206:20)
at TLSSocket.emit (events.js:187:15)
(node:3636) 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: 2)
(node:3636) [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.
PS C:\Users\Mini David\Desktop\brute>
BUT WTH
then your token is wrong
you didnt add a catch with async in it
im on js
yeah, you can do async and catches on js
oh
catches make it so if the command fails its like "eh whatever"
and async lets you do like client.say("heck")
it will still fail because the token is wrong, but it wont crash/exit the bot if you catch it
^
const Discord = require('discord.js');
const client = new Discord.Client();
const token = 'no honey'
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', msg => {
if (msg.content === 'ping') {
msg.reply('Pong!');
}
});
client.login('token');```
thats what i meant but im too lazy
how
^ i was just about to say that
you're giving it literally the words token as the token
dont i take the ''
Logged in as Brute#3467!
if you use "" or '', whatever you put inside it becomes literally that. it will not get the value from anywhere
for example
Tim he's got it xd
No, Tim is helping me
var abc = "test"; //test
var abc2 = abc; //test
var abc3 = "abc" //abc
if(tomute.highestRole.position >= msg.member.highestRole.position) return msg.channel.sendMessage("You cannot unmute a member who is higher role than you.");
i have this error even i follow the tutorials
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'position' of undefined
that means "highestRole" is undefined/wrong
DM me if u can help me with a discord.js bot
just say what you need ffs
dm means private lessons / private help which people are not willing to do for free
and i have dms disabled
how to check if user we tag is bot
look at the user property
if a bot doesn't have access to any channel, will it still receive member join/leave events?
@ruby dust i think so
oops i forgot i can use that method
as long as the guild is cached
anyway thanks for answer
sryy i thought i posted it there
how to make an async in function?
oops I forgot the syntax
ok thanks i trying it now
how 2 make discord moderation bot pls explain
give token to me first thx
how would i get the uptime of my bot in async py?
Main file:
Some datetime.datetime.now() var called uptime attached to Bot/Client instance right after declaring it
Then basically do datetime.datetime.now() - bot.uptime on command usage
And strftime the result
Ignoring exception in command mute
Traceback (most recent call last):
File "C:\Users\Nero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 50, in wrapped
ret = yield from coro(*args, **kwargs)
File "bot.py", line 116, in mute
await bot.add_roles(member, role)
File "C:\Users\Nero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 2915, in add_roles
new_roles = utils._unique(role.id for role in itertools.chain(member.roles, roles))
File "C:\Users\Nero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\utils.py", line 232, in _unique
return [x for x in iterable if not (x in seen or adder(x))]
File "C:\Users\Nero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\utils.py", line 232, in <listcomp>
return [x for x in iterable if not (x in seen or adder(x))]
File "C:\Users\Nero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 2915, in <genexpr>
new_roles = utils._unique(role.id for role in itertools.chain(member.roles, roles))
AttributeError: 'NoneType' object has no attribute 'id'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Nero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\bot.py", line 846, in process_commands
yield from command.invoke(ctx)
File "C:\Users\Nero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 374, in invoke
yield from injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Nero\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 54, in wrapped
raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'id'```
@bot.command(pass_context = True)
async def mute(ctx, member: discord.Member):
if ctx.message.author.server_permissions.manage_roles:
role = discord.utils.get(member.server.roles, name='Muted')
await bot.add_roles(member, role)
embed=discord.Embed(title="Success!", description="The user **{}** has been muted.".format(member), color=0x77B255)
await bot.say(embed=embed)
else:
embed=discord.Embed(title="Oh no!", description=":no_entry: You don't have permissions to use this command...", color=0xe74c3c)
await bot.say(embed=embed)
idk what's going wrong
@bot.event
async def on_server_join(server):
embed = discord.Embed(title="Whalebot", description="Thanks for inviting me to your server!\n\nMy prefix is **;;**.\n\nTo see all available commands, type **;;helpme**!", color=0x234D87)
general = discord.utils.find(lambda x: x.name == 'general', server.channels)
if general and general.permissions_for(server.me).send_messages:
await bot.send_message(general, embed=embed)
author = ctx.message.author
await bot.create_role(author.server, name="Muted")
await bot.edit_role("Muted",send_messages = False)```
oh wait
its basically "cannot read id of null" from js but the py equavalent
so hard to figure out 
author = ctx.message.author
but it's not a ctx command
lmfao
just wondering
are there any advantages for writting a discord bot in python
rather than nodejs
or is it purely a preference thing
Yes, but not for Discord bots.
have u been on the internet lately? 
true
*


