#development
1 messages · Page 652 of 1
also, you have to first check what kind of command was executed
you cant check if cooldown for command 5 exists if you dont even know yet if its really command 5
so your structure should look like this on message -> check if its not a bot -> check if channel is correct -> check which command it is -> check cooldown according to which command it is -> do the command
you should not use ```on message
-> something
on message
-> something else```
checking of which command it is should always come after, because why bother checking if the channel is wrong anyway?
unless you have different channels for different commands
@earnest phoenix What exactly do you want?
https://i.imgur.com/yoBu2Zm.png I am trying to make a counting system but the bot its deleting my messages
cause msg.delete() targets the bot's message?
no
what
msg.delete(message.author)
I'm sorry, what are you trying to do?
or other
that is for time
it's up to you
msg.delete(5000) - it deletes the msg in 5 seconds
uh k
msg is my message from bot.on('message...
.then
Oh, I see what you're doing.
thx but it doesn't help
how would that help lol
yes
what are you trying to do
counting system
it reads the last message from the channel
then checks if the sent message is bigger than the last one with 1
if not, it deletes the sent message
you need to put your entire logic into the promise response. lastNum is undefined outside of it
or use await instead of .then()
since you're using an async function
ah
let messages = await msg.channel.fetchMessages(...)
let lastNum = parseInt(messages.first().content) + 1```
console.log(lastNum,msgNum)
also, channel checking should be done first, else you're doing unneeded operations when you get messages from other channels
increase the message limit to 2, then if you have only two, you can use .first and .last lul

unless you mean something else
How could I do something like
-help <commandname>
oof didn't mean for that to happen
-help <commandname>
what lib
@spare goblet Okay, so let me explain the bot. When a command doesn't work, it's probably something to do with the arguments. Arguments can be seen with /help. The bot doesn't collect data anymore. Errors are not sent in chat, so you don't know when it breaks.
If something goes wrong, DM me.
@wheat flame This chat is for chatting about development and not bot declines, you can pop into my DMs if you want to discuss the decline
@twilit rapids JS
client.loadCommands = (callback) => {
client.commands = {};
fs.readdir('./commands/', (err, files) => {
if (err) {
client.log(`Error loading commands : ${err}`);
return;
}
files.forEach(file => {
require(`../commands/${file}`).load(client);
});
// console.log(Object.values(client.commands))
callback();
});
};
Just so you know
that is how I load commands
You probably have args defined somewhere
then use those
use args
any idea how to use multiple command prefix, like 'lr>' or 'LR>' or 'Lr>', using python 3.7
yes
commands extension?
how?
Are you using the commands extension or on_message for your commands?
commands.Bot has command_prefix kwarg that accepts either a string or an iterable (or list/set, not sure) object
pass a list of your prefixes and you good 
5|ti84 | at resize (C:\Workspace\node_modules\vegaexp\node_modules\vega\build\vega.js:12884:26)
5|ti84 | at CanvasRenderer.prototype$J.resize (C:\Workspace\node_modules\vegaexp\node_modules\vega\build\vega.js:12927:5)
5|ti84 | at CanvasRenderer.prototype$H.initialize (C:\Workspace\node_modules\vegaexp\node_modules\vega\build\vega.js:12496:17)
5|ti84 | at CanvasRenderer.prototype$J.initialize (C:\Workspace\node_modules\vegaexp\node_modules\vega\build\vega.js:12922:28)
5|ti84 | at initializeRenderer (C:\Workspace\node_modules\vegaexp\node_modules\vega\build\vega.js:29994:8)
5|ti84 | at C:\Workspace\node_modules\vegaexp\node_modules\vega\build\vega.js:30098:18
5|ti84 | at processTicksAndRejections (internal/process/task_queues.js:86:5)
5|ti84 | (node:828) 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)```
I keep getting this error, judging by the prototype runs, its from this bit of code
```js
new vega
.View(vega.parse(chart))
.renderer('none')
.initialize()
.toCanvas().then(canvas=>{
canvas.MoreData = valueForChart
resolve(canvas)
})```
this seems to have stopped working since I moved to a different machine, I looked it up, I installed `canvas` and thats all good but it just doesnt want to work?
getContext is NOWHERE in my code so
did you install vega?
yea
vega seems to use canvas, it should install it automatically
i reinstalled just in case but still no
you can try npm rebuild vega
you can also check if there is any changes to vega since you installed it in your last machine, maybe there was an update with breaking changes
the thing is it seems to be an error within the package so wth
post an issue in their github
or try to install an older version
ie: the same version you had on the old machine
fetch the message
then edit it
what lib
discord.js I see
what version
master?
or stable
Yeah .fetchMessage()
fetchMessage() resolves a promise
so either await or use .then()
and then edit the fetched message
if you want to edit the message you just sent (not some message you sent earlier), you can use the promise returned from the .send() method
Why aren't some emojis getting converted into Twemojis?
How do I know in what servers my bot is?
eslint some of those emojis may just not exist like the brain one. As for the gear, idk
@opaque eagle there is no twemoji for brain, maybe you got a funky gear?
What about the gear tho
idk
How do i turn this stupidity off?
Settings
How do I know in what servers my bot is?
^
What is the setting called
Lib? @earnest phoenix
@native crown press f1 to be taken to the discord help desk
Loop through all servers
@loud salmon im on a phone
Never knew that was possible rofl @loud salmon
@opaque eagle I use dbd app so idk
dbd?
oof
So how do i remove that?
@native crownSettings>Overview
@opaque eagle dbd app is an app that turns developing a bot easier
Ah i see thx m8
easier?
Ye
if by easier you mean you don't have to write code, then its not easier
Spider is righ ye
it just cant do stuff that should be super simple
the code to do what you want can be less than 5 lines of code
in any language
@earnest phoenix
but also wrong lang
HAH

No clue how to help you there
Hmmm
maybe ask the app support desk
Ok, thank u
if they have one
Ill ask them
@earnest phoenix you want to see the servers your bot is in? which library are you using?
I am using the dbd app :/ @quartz kindle
What is this?
Is an app
To android
Can you send more details like how the app work?
It has its own code type, so per example if you want it to not ping people when the command is sent u do $nomention @earnest phoenix
does it have documentation? is there a link?
What is a documentation?
a website that teaches and shows all the possible commands
do they have a website?
then we cant help, you have to ask them
They finnaly answered me. I know how to see servers. Thx to u bcs u tried to help
Really kind
if message.content == 'Poll Test':
await message.add_reaction('')
File "/home/runner/.local/lib/python3.6/site-packages/discord/http.py", line 222, in request
raise HTTPException(r, data)
discord.errors.HTTPException: 400 BAD REQUEST (error code: 10014): Unknown Emoji
that emoji exists
idk why it doesn't work
i try to use the same code with other bots and it works
Remove the <>
is your bot in the server where that emoji comes from?
👍
ok now it works
how to load database before on_ready() for discord.py?
You... just put it above it
Or if it's one you constantly update you can define it and use a asyncio loop
ok trying
should I put the function under client.event()?
@client.event
async def loadData():
data = connectdb.getData()
print('collecting data...')
@client.event
async def on_ready():
await client.change_presence(status=discord.Status.online,activity=discord.Game(name='RPG Help at >help'))
print('Logged in')
print('...')
I was trying like this,but not working
ohk, fixed. thanks
return basically means stop/cancel
you have a condition, and if its true, you stop/cancel the code, and return something
so you need to change it to js if condition -> send to author -> send to channel -> return (if you need to cancel something that happens later)
P much
if(condition) {
action1;
action2;
}```
css*, and css is farily simple, it takes 3 minutes max of research to get how it works, basically you put every bit of css you want into a <style></style> in your big description
Yeah, if you are familiar with html a bit this is no problem for you, https://www.w3schools.com is not 100% accurate but for what you are trying to achieve more than enough
you dont "learn codes", you learn a language/environment/system
yeah, but "codes" suggests learning bits and pieces of a language, which can sometimes confuse you instead of pointing you in the right directions
agree, but in this case a simple html code doesn't confuse anyone in my opinion
@client.event
async def on_reaction_add(reaction, user):
async for user in reaction.users():
await message.channel.send('{0} has reacted with {1.emoji}!'.format(user, reaction))
``` how can the bot send the message if `message` can't be put?
plssssss help
reaction has the message attribute
can someone tell mr github my repo is locked?

Hi, can I get some help? I got my raspberry pi ordered in a week ago and I was setting up the discord.py module for my bot, but when I run it it says AtributeError: ‘Bot’ object has no attribute ‘send_message’ even though when I’d run this on my laptop it’d work just fine?
That's from the old discord.py version which is no longer supported I think
Ok
Do you know how I can get the new one
I tried just using the one from my laptops libraries, but that gave me an error with create_task = asyncio.async
does anyone know how much it costs to host a discord bot on aws?
Just_aliex the docs tell how to install
https://discordpy.readthedocs.io/en/latest/intro.html#installing
@indigo geyser https://discordapp.com/channels/264445053596991498/272764566411149314/598564070202802206
So, reaction.message
(rtfd.)
@sudden geyser I tried the command on the doc page, same error happening, is said requirement already satisfied, skipping upgrade:
When i tried to upgrade
@earnest phoenix for your long description you can use html or markdown. but you should not use <head> or <body> tags
also the type="text/css" isnt needed
just use
<style>
put css here
</style>```
Just_allex I think it just means you already installed it. Try uninstalling and re-installing maybe?
Thanks to all
@sudden geyser I have been uninstalling it, but whenever I re-install it, it installs from a cache which means it’s not actually getting the upgraded version
I don’t know how to un-cache it
does a lot of user data inside a json file corrupt?
@halcyon nymph pip?
json is a bad db but it works
how big would the json file have to be to corrupt
I mean, I doubt one specific channel for my bot will get popular anytime soon
it can be 2 lines
It cant write/read twice at the same time
oh, so a big bot will kill it hard
I make a random number generator to wait to write until all other things are done
if every time someone does a command an update is done to the file
And store as a temporary string
Yeah
For example I did define[word],[def]
It would write "word":"def" to the json
But I have it wait until it's done to write the strings to it
So a RNG sleep string could work
If you want
oof alr
@west spoke yeah, I’m using pip
What permissions does my bot need to send PRIVATE messages? Send_Message does not seem to be enough, the error "missing permissions" appears
permissions don't exist in dms
criteria to message a user in dms is to have at least one shared guild with the bot and for the user to have their dms enabled
try catch it
discord.js, is there any way to react to a message with a unicode emoji without including the unicode in the code?
nope
crap
you have to send the unicode, the api doesn't map :emoji: to a unicode char like the client does
@mossy vine you can just send it like :emoji: and it works
hm lemme try that
the client handles it the same as the unicode
that is for sending messages, not for adding reactions
and how would i get the unicode of the emoji?
yeah
I can not do what I want, I would like to hide the error "missing permissions" from the console of my Bot.
Python3
put a backslash before sending it, e.g 😃 => \:smiley: => \😃
oh yeah i was talking about sending messages
yeah but i need the unicode code/name
which emoji are you trying to react with?
like \usomething
@latent river use try except
for example, the emojis for the numbers are special cases: js reaction_numbers = ["\u0030\u20E3","\u0031\u20E3","\u0032\u20E3","\u0033\u20E3","\u0034\u20E3","\u0035\u20E3", "\u0036\u20E3","\u0037\u20E3","\u0038\u20E3","\u0039\u20E3"]
you can just google the escaped emoji and most search results will return the code
look it up on emojipedia
oh an that would be \u1F603?
yup
ah okay, thanks
without the 1 i think, unicode usually only has 4 digits
unless its like extended unicode or something
try both ways
everything says unknown for me
same
my terminal really doesnt like that lol
in what way? during logging?
no, it just cant render them properly and instad makes them semi-invisible, fucking up many things next to it
yeah but why doesnt it need to work in your terminal?
oh
when i paste a unicode emoji
konsole gives me a warning that it doesnt like that
then renders as a ?
then breaks everything next to it
on linux? sure
i guess i could always just use vscode for this one project
vscode's remote development is nice
it can connect to a server via ssh and u can directly edit
yeah
i do that with sublime
I just edit locally 
with my trusty jetbrains products
wait
I didn't realize jetbrains products actually have remote editing
@quartz kindle the 4 character escape codes aren't defined by unicode
they're just how you'd encode the characters in whatever encoding you use (eg js/java use utf16, so escape sequences are two bytes aka 4 hex digits)
yeah i always forget that unicode and utf are not the same thing
can my bot get ratelimited in the process of adding 5 reactions to a message
yes
mostly because reaction ratelimits are a meme
it's 1/0.25
but ratelimit headers work in seconds so that breaks it
most libs should handle it for you
will dbl.hasVoted() return true if the user has voted within the last 12 hours or 24 hours?
12
also why isnt it instant and people have to wait like minutes
ill vote, and it wont return true until maybe like 3-5 minutes after
ok
Anybody here know any bit of CSS cuz I've been trying to fix this for quite a while now
yo guys I have a question. My Discordbot is just crashing before playing something in voice
Well ur connection timed out
yeah but why
how's ur internet connection doing
it's a windows server with 1 gbit
so uhm
don't think that it makes problems xd
ok
firewall maybe?
anywho I need help with my problem, I have a site that I want to look like this (background is an svg file)
but when I shrink the width the image goes small height wise too
well I disabled the firewall and tried again
but still same error
also: he joins channel but print this: https://i.imgur.com/7CJRx95.png
You're probably sending the channel object itself
add media queries @scenic kelp
I think most of the pain is working with SVG
I don't see how I would implement it since the svg is the background image @topaz fjord
specify a fixed height?
to resize it
media queries allow you to change an elements styling depending on screen width
I know that
I don't know how to resize it vertically while keeping it 100% width
since it's a background image
background-size: 100% 200px?
or the other way around, i dont remember
ie, fixed height and percentage width
If it were me I would set it as a background image
are you on localhost or could i take a look?
It's entirely within a folder
@pale marsh I do not because it's working on my local pc
i'll zip it 1 sec
ere @quartz kindle
Maybe I resize the svg and make multiple versions of it and use media queries?
I can not do what I want, I would like to hide the error "missing permissions" from the console of my Bot.
Python3
try except doesnt works for me
yeah apparently svgs are not stretchable by default
I think you are asking if you can make the SVG to distort and stretch like a PNG would do. This is unfortunately not impossible unless your SVG codes themselves are set up that way (say if your SVG are generated by illustrator, they simply won't do it).```
Also for most modern browsers, you can simply add preserveAspectRatio="none" attribute to the svg tag.
@scenic kelp
That's a bummer. Thanks for the help. I'm presuming some fancy css or a plain image are my options now?
Or the resize idea might still work
it says you can just do preserveAspectRatio="none"
also, if all you need is a green bar like that
you can simply use background-color with css clipping
or even transforms
guys, how can i hide this: https://i.imgur.com/mlp9S4F.png
python
trying to send PM
the user probably has dms disabled
Yes, I understand that, but is there any way to hide the error in the console when the bot can not send the private message?
await message.edit(??)
``` What I heve to put into () ?
“<Message>”
What ever you want your bot to say
Put it in “”
Example
await message.edit(“hi”)
"Server.js"
read the stacktrace

I've went through all my commands three times now, and I don't know what the problem is
props.help is undefined, just like the error says
uhh no that error comes up when the name of a command isn't listed
Then you should check if the command exists or not before setting it as I assume you’re using a loop
That or log the file name before setting it
how i can sort a json file ?
define sort
I have tried that but only show one people ```const test = require('../test.json')
for(var i in test) {
var myArray = [test[i].points];
myArray.sort((a,b) => b.points - a.points).map((a, i) => "[" + (i+1) + "] - " + 'lol' + " (" + a + ")").join('\n')
}```
Can someone help
idk whats going on here but the first thing i see is that your myArray variable is assigning itself within the loop
basically it's not outside of the for loop block so it's running as many times "test" appears
what could make this a lot easier is if you stored data as an array of JSON objects, and that would look something like this:
var test = [{}, {}, ...];
var myArray = test.sort((a,b) => b.points - a.points).map((a, i) => "[" + (i+1) + "] - " + 'lol' + " (" + a + ")").join('\n');
}
also var myArray = [test[i].points];
sorting that has no effect
it has a single element
it's always sorted
@valid frigate i have that in my json file
{"id1": {" points ": 100}, "id2": { "points" : 104}}
Idk how i can sort that by point
everytime u .sort the array, it is replaced by the latest sorted array
so you need to .push the output to a
new array just after sorting it
wth
const test = require('../test.json')
let output = []
for(var i in test) {
var myArray = [test[i].points];
output.push(myArray.sort((a,b) => b.points - a.points).map((a, i) => "[" + (i+1) + "] - " + 'lol' + " (" + a + ")").join('\n'))
}
you can use Object.entries and Array#sort
^
Ohh
Object.entries(obj).map(
> const data = {id1: {points: 100}, id2: {points: 200}}
undefined
> Object.entries(data).sort((a, b) => b[1].points - a[1].points)
[ [ 'id2', { points: 200 } ], [ 'id1', { points: 100 } ] ]```
@vague chasm
Can someone help me in #topgg-api?
It sends 2, OK, but the thing we want is that it sends the level in a precise order, from the highest level to the smallest
People for us help?
i need help making a bot called RadicalBot
it replies to any message containing the words (Rad, Radical, Awesome, Nice, Great) with "Totally Radical!"
which lib are you using
and randomly says not to do drugs
and
i have no clue
im
not really that far into the process

@manic skiff do you know a programming language?
ahaha no
English
uh
^not that
ok so first, learn a programming language
like javascript
then look at https://anidiots.guide
I recommend Python because it is very friendly
how do i get
python is not good
python
for beginner
javascript is better than python imo
Nah
i request a VERY beginner friendly one
ok
wow
ok
introduce yourself with typed languages, you're probably going to be using them more often anyways
have you tried google
https://www.google.com/amp/s/amp.reddit.com/r/discordapp/comments/5zpwec/javascript_discordjs_disocrd_bot_if_message/ @manic skiff
0 votes and 5 comments so far on Reddit
@manic skiff try w3schools
ok
yes w3school is very good @bright spear
what
How can i fix this issue? It's definitely caused by the fact that the host computer is in another country, but is there a way to make it like gmc offset so that its the right time for anyone viewing it?
timestamps are always supposed to be utc
doesnt matter it still says it sent tomorrow 👀
Well that happens idk why tho
But theres no way of making it dependent on where the actual person is?
discord accepts timestamps in utc
then it's calculated locally
you're supposed to send the utc timestamp, not your local one
(new Date().getTime() - (new Date().getTimezoneOffset() * 60000)) i gotta do this
for all the djs nerds whats wrong with this? client.user.setActivity('Boss and !help', { type: 2 })
@ember atlas that code is correct and it works when i run it
then why are my logs being spammed?
with?
/home/boss/assistant-2/events/ready.js:6
0|index | });
0|index | ^
0|index | SyntaxError: Unexpected token )
0|index | at createScript (vm.js:80:10)
0|index | at Object.runInThisContext (vm.js:139:10)
0|index | at Module._compile (module.js:617:28)
0|index | at Object.Module._extensions..js (module.js:664:10)
0|index | at Module.load (module.js:566:32)
0|index | at tryModuleLoad (module.js:506:12)
0|index | at Function.Module._load (module.js:498:3)
0|index | at Module.require (module.js:597:17)
0|index | at require (internal/module.js:11:18)
0|index | at files.forEach.file (/home/boss/assistant-2/index.js:13:19)
PM2 | App [index:0] exited with code [1] via signal [SIGINT]
PM2 | App [index:0] starting in -fork mode-
PM2 | App [index:0] online
Spans my console with this
I've got this error. My bot just sleeps all the time. Doesn't come online. Any reason?
error? @warm marsh
boy that's a syntax error
@ember atlashas nothing to do with the line of code you provided
if(client.commands[prop]){
let cmdHelpEmbed = new Discord.MessageEmbed()
.setTitle(`${client.commands[input].name}`)
.addField(`Description: ${client.commands[input].desc}`)
.addField(`Usage: ${client.commands[input].usage}`)
.setColor("BLURPLE")
.setTimestamp()
.setFooter(`Requested By: ${message.author.tag}`)
message.channel.send(cmdHelpEmbed)
}
I have this so far but I can't figure out how to define prop or what to define it as more or less
Anyone got any ideas or hints as to the answer
@amber fractal then what does it have to do with
It says that you have an unexpected )
My code.
Delete that
Why?
Nice token
Your token
Regen it
My token?
Doesnt matter if you delete
Dude i could run any code as your bot rn
wtf
me too
So i suggest you delete it
It will be in #265156361791209475 forever
@warm marsh why tf did u post your token...
you need to delete that post, and regin your token
I didn't realise
Delete that message and regen your token
dothatthing
Lol
"token:" "token"
}
client.login(config.token)
🤦
are you following a tutorial?
Example
Okay?
Ok, so if you can
What about this image is wrong
It works?
Make a new file called config.json @warm marsh
and we can store things in there that we can access later, token, prefix, etc
^
How?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
go to the app you are
woah!2
wtf
Bruh
Bruh
xD
delete it and regen
My bad
This guy
quick, everyone zombify his bot.
Go to the developers site and regin your token
I'm new, but really feel like i belong.
then sleep
YOU ABSOLUTELY NEVER, EVER, POST YOUR TOKEN. I CAN LITERALLY RUN CODE VIA YOUR BOT, AND GET IT BANNED FROM DISCORD. NEVER POST THAT ANYWHERE EVER AGAIN PLS
@𝓓𝓲𝓵𝓵𝓸𝓷.#7249
Just a warning for the future
A sleepy programmer won't get much work done
Thanks
pls be careful
confirmed, he changed it
Show error
@ember atlas have you tried using eslint
Wait what am I doing
SyntaxError: Unexpected token )
0|index | at createScript (vm.js:80:10)
0|index | at Object.runInThisContext (vm.js:139:10)
0|index | at Module._compile (module.js:617:28)
0|index | at Object.Module._extensions..js (module.js:664:10)
0|index | at Module.load (module.js:566:32)
0|index | at tryModuleLoad (module.js:506:12)
0|index | at Function.Module._load (module.js:498:3)
0|index | at Module.require (module.js:597:17)
0|index | at require (internal/module.js:11:18)
0|index | at files.forEach.file (/home/boss/assistant-2/index.js:13:19)
and not really
module.exports = (client) => {
console.log(`Online!`)
client.user.setActivity('Boss and !help', { type: 2 })
});
``` here is the code
yes
no
No
the ) shouldbt be there
oh
just remove the )
i see
just the ) on that line
advaith boyo
wanna help me with something?
xD
if(client.commands[prop]){
let cmdHelpEmbed = new Discord.MessageEmbed()
.setTitle(`${client.commands[input].name}`)
.addField(`Description: ${client.commands[input].desc}`)
.addField(`Usage: ${client.commands[input].usage}`)
.setColor("BLURPLE")
.setTimestamp()
.setFooter(`Requested By: ${message.author.tag}`)
message.channel.send(cmdHelpEmbed)
}
I have this so far but I can't figure out how to define prop or what to define it as more or less
{ conf:
{ name: 'Cuddle',
desc: 'Allows you to give cuddles!',
usage: '-cuddle [@user] or @Clap Bot cuddle [@user]',
guildOnly: true },
run: [AsyncFunction: run] }
this is how the commands are structured if this info is needed
but not all the commands use conf
some use music, mod, nsfw
How would I be able to make a exec command
what does that even mean
Well you cant help me if you dont know what it is so 
Its executes commands in the terminal via your bot
which lang
djs
How to see how much Commands were ran?
you have to keep track of that when executing commands yourself
if(client.commands[prop]){
let cmdHelpEmbed = new Discord.MessageEmbed()
.setTitle(`${client.commands[input].name}`)
.addField(`Description: ${client.commands[input].desc}`)
.addField(`Usage: ${client.commands[input].usage}`)
.setColor("BLURPLE")
.setTimestamp()
.setFooter(`Requested By: ${message.author.tag}`)
message.channel.send(cmdHelpEmbed)
}
This isn't working, it doesn't send the embed and it doesn't error
it just does nothing
Discord.RichEmbed()¿
No error?
@earnest phoenix r u joking?
i'm not
@earnest phoenix Nope no errors
@lusty dew did you try console logging
and see if the code reach that?
no errors means its possible that code doesnt even execute
check your logic and put console.log on every if statements you can thiink of that might bug
It reaches all the way until the if statement
the your problem most likely lies on client.commands[prop]
check if that is not outputtiing undefined or null or whatever falsy values
Okay
@jagged ether Just use JSON.stringify() to preview the object lol
@sinful lotus Nothing logs
what nothing logs?
client.commands[prop]
no undefined or null?
nope
then your code doesnt reach that
that clearly states that you only thought it reaches the IF statement
but in reality it dont even execute there
I suggest to backtrack the code more
gson
@stray garnet does discord.js use restactions?
@lusty dew Wdym?
None of my code is working now
switch(input){
case "Mod":
let modEmbed = new Discord.MessageEmbed()
}
is is supposed to be like that or
switch(input){
case "Mod":
let modEmbed = new Discord.MessageEmbed()
}
Like that?
Unless I'm not fully awake yet, the only difference in those 2 is indentation which shouldn't matter in js
But preferably the 2nd option as it'll allow you and other devs to easily see the different cases and their respective statements
Okay
@late hill Question though, how could I make it so they don't have to type something a specific way, cause not all mobile users type with a capital letter at the beggining
so the word isn't case sensitive
(also soz for ping)
You can use .toLowerCase()
Put the word you check for in all lowercase or all uppercase
And then do the same to the input
^^
Ah
Ez fix
didn't think about that
let input = args[0].toLowerCase()
So like that basically
@glass nova
How do I add roles in d.js master
isn;t it like
mMember.roles.add(role.id)
mMember being guild member
read docs
I have AWS Educate account. Am I able to host my discord.py bot using AWS? if yes how?
I got it to add the roles
but now
message.guild.channels.forEach((channel, id)=> {
channel.overwritePermissions(muterole, {
SEND_MESSAGES: false,
READ_MESSAGE_HISTORY: false
})
})
this part isn't working
and it throws no errors
.catch((error) =>
@vague chasm Nothing console logged
it's only my user id that does this. what did i do wrong?
@somber verge remember to convert it to an int (if you use rewrite)
the problem is, that every other member works fine
Hm
@somber verge Are you sure i is integer
How the f
Would you not just use message.mentions?
instead of splitting the message to get the id and then getting the member from the id
Tbh just use discord.py converters
is there a way to do like a array.includes() to an array like [1,2].includes([1,3]) would still be true. obviously this doesnt work but is there a thing that would provide this functionality rather than having two of the same statement
message.guild.channels.forEach((channel, id)=> {
channel.overwritePermissions(muterole,{
permissionOverwrites: [
{
deny: ["SEND_MESSAGES", "READ_MESSAGE_HISTORY"]
}
]
})
}).catch(err => { console.log(err) })
This is not doing what it should be doing, channging the role perms for every channel in the server.
Not even erroring
How to make a bot hosted on a VPS online 24/7. I downloaded pm2 but apparently that didn't work, because my bot went down in less than 12 hours.
make sure that you added your bot to pm2 and started it over that
pm2 should auto-restart your bot if it crashes
Uh I did pm2 start server.js which is my main file, but today this morning the bot was offline, but in pm2 status it said online.
Have you checked logs?
pm2 logs <name> --lines=300
How to do this?
wdym
I mean, display how much gulids the bot is in and the same with users
what lib
d.js
Use the documentation
<Client> has the property .guilds which returns all the guilds the bots in
<Client> also has the property .users which returns cached users only
To find all the users you will have to filter through all the guilds and add up their member count
Anyone know the answer to my question above?
uh that just means nothing printed if there's nothing under it
go to the error log file and see what's in there
I don't think that makes a difference
usually does for me
Shouldn't make a difference^^
It's probably because the name has a space which is messing up the args
Put quotes around the name or use the id instead and it should work
@earnest phoenix
I'm trying to download a dependency for my go project and i keep getting this error: build RPCClient: cannot load github.com/ananagame/rich-go: cannot find module providing package github.com/ananagame/rich-go
what's life
Okay two things
One both the Help menu and Module should not be sending at the same time
Two at the very bottom I have a check
These two lines of code are in it
and the way client.commands is structured is
{ name: 'Cuddle',
desc: 'Allows you to give cuddles!',
usage: '-cuddle [@user] or @Clap Bot cuddle [@user]',
guildOnly: true },
run: [AsyncFunction: run] }```
Like this
but conf isn't the only tag the bot uses
it uses nsfw, mod, music, conf
but to get the name, desc, and usage i'd have to specify which tag I want to get it from but since there is multiple I can't just specify one tag or else it'd only get info about the commands using that tag
ping me with a response cause I may fall asleep soon
One message removed from a suspended account.
One message removed from a suspended account.
Okay, i installed the new discord but I’m still having problems, it’s having problems with create_task=asyncio.async
One message removed from a suspended account.
One message removed from a suspended account.
Apparently I was on an older version that didn’t have send_message
Discord.py I mean
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.

One message removed from a suspended account.

One message removed from a suspended account.
@halcyon nymph await client.send_message(channel, message, embed=None)
That's the synatax
One message removed from a suspended account.
Replace None with whatever embed you are using (optional)
Yeah, it’s having a problem with importing discord.py
It runs into an error where it wasn’t before
What version are you using
Asyncio or discord.py?
I got arsed with using pip so I just copied it off my computer with a USB stick
Post full traceback please
Idk how to screenshot the pi
You are trying to install a 0.16.12 version with python 3.7 installed
@halcyon nymph pip install discord==0.16.12 if you are using CLIENT
Any version above it wont work.
What
Ok I’ll try that
The error is because they are trying to run a 0.16.12 version on python 3.7
One message removed from a suspended account.
How do I get python 3.6.6
Anyways now to tear apart nintendo swi--
One message removed from a suspended account.
^
One message removed from a suspended account.
Then don't say anything
Same
One message removed from a suspended account.
what
One message removed from a suspended account.
what the fuck happened to the app
One message removed from a suspended account.
I would use js, but my python code uses tuples and specifically the .update feature in python, and js doesn’t have that
Honest to god I would used js if I knew it was gonna be this much of an arse in python though
- DV, they reserve full rights to use whatever they want. If they want to use it, you should help if you can, and if you can't, remain silent, please.
- Neko, #memes-and-media, thank you.
- Allex, your best bet is to either use the latest (discord.py 1.2.3) and update your code to it or downgrade your Python version to 3.5+ (3.6+ include f-strings, if that might interest you).
@slender thistle I was wanting to take apart a app but its gone
How do I downgrade my python, the python website is littered with downloads for windows but I can’t see anything for Linux
One message removed from a suspended account.
My pi came with Python2IDE and python3.7
@halcyon nymph what version of python do you need?
What distro
And that
@amber fractal I used python 3.6.7 but I’m told python 3.6.6 will work fine, but honestly anything that can run discord.py
@sage bobcat YOu don't know what break is in switch statements
One message removed from a suspended account.
3.5+ versions work with 0.16.12 version of discord.py
One message removed from a suspended account.
One message removed from a suspended account.
What’s distro?
One message removed from a suspended account.
Linux distribution
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I think debian
One message removed from a suspended account.
One message removed from a suspended account.
Then probably not that
One message removed from a suspended account.
One message removed from a suspended account.
He's prob on raspbian
One message removed from a suspended account.
One message removed from a suspended account.
I think that's the default rPi distro
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Ahh kill me
I got python3.6.8
And now I’ve got an import error, can’t import sysconfig even though when I open python3.6 import sysconfig works fine
hi
Semi-colon doesn't do the same thing as break, and break is a fundamental js thing... maybe you need to look into some basic JS @sage bobcat
How come .toLocaleString() won't work when I write to a JSON file?
I don't get an error, it just doesn't separate numbers with ,s.
Example: 1000 should be 1,000.
Ping with response please
Ok
Setting the user balance
game.user[memberID].money.cash = args[2];
fs.writeFile("./gameData.json", JSON.stringify(game), (err) => console.error);
Reading from the file
message.channel.send(game.user[memberID].money.cash.toString().toLocaleString())
Output:
1000
Wanted output:
1,000
Why does bot.guilds.size don't work in embeds?
Well but not for me.
module.exports.run = async (bot, message, args, options, client) => {
new Discord.Client(options);
let bicon = bot.user.displayAvatarURL;
let embed = new Discord.RichEmbed()
.setAuthor("Info", "https://cdn.discordapp.com/attachments/592578056166703104/598752176709435446/IMG_20190709_091228_344.jpg")
.setColor("BLACK")
.setThumbnail("https://cdn.discordapp.com/attachments/592578056166703104/598752176709435446/IMG_20190709_091228_344.jpg")
.addField("Bot Name", bot.user.username)
.addField("Created On", bot.user.createdAt)
.addField("Gulids", bot.gulids.size)
message.channel.send(embed)
}
module.exports.help = {
name: "info",
aliases: []
}```
Yes @floral bloom
Do client.guilds.size instead and see if it works
Nope dont works
What's the error?
You spelled it wrong
wa, wait what?
gulids
oh i see
Usually all you need is bot, message, and args
One message removed from a suspended account.
One message removed from a suspended account.
Have fun
One message removed from a suspended account.
That doesn't deny the fact that break; is simple js logic
One message removed from a suspended account.
One message removed from a suspended account.
Dude ur taking this to such an extreme lol... i just said maybe u should search up what it is
Also pls don't say you "know" a language... that's never true for any dev on any lang
One message removed from a suspended account.
what’re you supposed to say? I’m experienced with js?
I wouldn’t say knowing a language is knowing every nook and cranny, but you know a majority of the language and it’s functions. There’s always libraries and stuff to discover and new things to learn.
imagine making a bot
Actually coding a bot does mean you know the lang quite a bit
Http requests arent easy
Hi guys
its code is on github tho
I’ve only made one extensive bot so far, but I’m happy with the results. We won third place in discord hack week.
however, the mods here denied it, I need to fix the -help command lmao
It’s mostly used for music bots, you can get music from a call on youtube search Api.
I’ve only used it for testing, but I’m not sure if it’s practical for larger bots
It essentially is a download
Assuming so
Are raspberry pi good for discord bots?
yeah but a server would be better
Alright, How come?
well they'll have faster internet and itll be more reliable
i dont mean a server in your house
^
Yeah I know.
Check pins
but yeah raspberry pis should work fine
Pi 4 would be best
Thanks!
yw
Pi4 has faulty USB c but that's a minor thing
One message removed from a suspended account.
Discord.js and JSON
Why won't this split the output making it have a comma between 3 zeros?
Setting the user balance
game.user[memberID].money.cash = args[2];
fs.writeFile("./gameData.json", JSON.stringify(game), (err) => console.error);
Reading from the file
message.channel.send(game.user[memberID].money.cash.toString().toLocaleString())
Output:
1000000
Wanted output:
1,000,000
Ping with response please




