#development
1 messages · Page 433 of 1
if message.author.bot:
return
then you need to check for bots in there too
Py is on a different pc

The issue is is that discord.py has an automated help message that I don't know how to edit code for
do you know where the code is located?
Do you need help with making your bot not respond to other bots or?
No that is the problem
async def on_message(self, message):
if message.author.bot:
return
await self.process_commands(message)```
I will send the code that I have for it
@slender thistle @quartz kindle @solid cliff
what is it
this is all i got
@mental willow
trying to stop this .py part of my bot from responding to bots including the hidden help command
is there a way of stoping it from sending the help message altogether
what
This part of my bot responds to bot triggering messages. This is made worse when you can't edit the help message that is sent out when you type .help
@mental willow Find async def on_message(message): somewhere and tell me if you manage to actually find it.
oh
do you wanna block bots from responding to your bot
so it only listens to users
I want my bot to not respond to others bots
right
Ah
yeah, you wanna do user-bot checks in your onMessage
i'd use if ctx.author == user.bot: return
did a one-liner
Or, as ReKT said before:
@bot.event
async def on_message(self, message):
if message.author.bot:
return
await self.process_commands(message)
dunno what process_commands is for async 
root@ip-172-31-46-23:~# sudo service mysql restart
root@ip-172-31-46-23:~# mysql -u sql -h redacted -p
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on 'redacted' (111 "Connection refused")
love how my SQL still doesn't like me
Let's just say it processes commands.
Think you just sent ip...
welp
eek
Look for that stuff before sending
yeah
https://discordpy.readthedocs.io/en/latest/faq.html?highlight=process_commands#why-does-on-message-make-my-commands-stop-working and add a if message.author.bot: return before process_commands
@mental willow
like this
YEAH
yuck
ok async is good in terms of stability, but rewrite is better if you're looking for more features
await message.messageevent(self, ctx) is unrelated, thats just one of my functions
ah ok
Use what I (originally, ReKT) sent.
^
i am getting
TypeError: on_message() missing 1 required positional argument: 'message'
Read my last message.
i put yours in
@bot.event
async def on_message(message):
if message.author.bot:
return
await bot.process_commands(message)
Okay thanks, I was lazy to edit it.
works
🤢
i dont get it, when is "servers" ever populated?
you have var servers = {}
yep
i need to delete the "id" ?
you're trying to give the variable "server" something that doesnt exist
or at least im not finding it
I don't know what to do I'm stuck
i havent done voice functions so i cant help you
but you need to do something about the var servers = {}
Create a variable, then once someone plays something store it
Otherwise it'll be empty or undefined
Has anyone used Dialogflow2Discord?
is Client a global var?
it seems like when the loop reaches setTimeout, a new play function is executed, while the old Client.broadcast.on('end') is still listening to more events
Hi I'm needing some help with discordjs and node
Like I have a main index JavaScript file for basic stuff like constants and variables and all that stuff
But i want to be able to separate my ready and message events and such
I mean separate them into multiple files
modules
Well yeah i tried that
module.exports i guess
But its not working
idk i dont use modules
Show code?
other file
for some reaosn its working now
weird
this is my other file code
const cli = index.clientS;
module.exports = {
one: function() {
cli.on("ready", function() {
console.log("ok");
});
}
}```
now this is my main file
const discord = require("discord.js");
const client = new discord.Client({
disableEveryone: true
});
module.exports = {
clientS: client
}
// Import command modules
const ping = require("./commands/ping");
ping.one();
// Login token
client.login("token");```
now its logging properly
maybe i had a typo somewhere
idk
bot.on("message", function(msg) {
if (msg.author.equals(bot.user)) return;
if (!msg.content.startsWith(prefix)) return;
var args = msg.content.substring(prefix.length).split(" ");
switch (args[0].toLowerCase()) {
case "8ball":
if (args[1]) {
//message.channel.sendMessage(fortunes[Math.floor(Math.random() * fortunes.length)]);
msg.channel.send({embed: {
color: "RANDOM",
title: "Hmmm...",
description: (fortunes [Math.floor(Math.random() * fortunes .length)]),
}});
}
else {
msg.channel.send({embed: {
color: "RANDOM",
title: "Oops...",
description: "L'utilisation de cette commande est: ***8ball [Question]**",
}});
}
break;
var fortunes = [
"Oui.",
"C'est faux.",
"C'est vrai.",
"Sans aucun doute.",
"Non.",
"Je ne c'est pas.",
]}
}); ```
error is :
if (!msg.content.startWith(prefix)) return;
^
TypeError: msg.content.startWith is not a function
startsWith
also add so that it doesn't respond to other bots
yeah
or send an error if it's in dms
why is it better to ignore dms?
yeah
@inner jewel is not this if (!msg.content.startWith(prefix)) return;
^
TypeError: msg.content.startWith is not a function
startWith is not a function
you have startWith
you're missing an s
it's startsWith
!msg.content.startsWith(prefix)
s
description: (fortunes [Math.floor(Math.random() * fortunes.length)]),
^
TypeError: Cannot read property 'length' of undefined
lol a other problem ....
i try to code a 8ball lol
that means you have not defined fortunes
no is defined
case "8ball":
if (args[1]) {
//message.channel.sendMessage(fortunes[Math.floor(Math.random() * fortunes.length)]);
msg.channel.send({embed: {
color: "RANDOM",
title: "Hmmm...",
description: (fortunes [Math.floor(Math.random() * fortunes .length)]),
}});
}
else {
msg.channel.send({embed: {
color: "RANDOM",
title: "Oops...",
description: "L'utilisation de cette commande est: ***8ball [Question]**",
}});
}
break;
var fortunes = [
"Oui.",
"C'est faux.",
"C'est vrai.",
"Sans aucun doute.",
"Non.",
"Je ne c'est pas.",
]} ```
downstairs
@gilded blaze
Don't define it in a case
Define it before
and it would be a constant?
But that isn't a problem
you have to define fortunes before you try to access them
👍
Hiii, someone would know how to remove the messages of SLF4J in JDA ? I tried several methods but it doesn't work ^^ http://prntscr.com/jvzefs
did you try opening those links?
how can I put that "<mine_number>" into text in html?
html thinks that is code
and not text
Im trying to run my bot with Eris but after all shards fully connect a minute later they restart. These are the client options im using
{
disableEvents: {
TYPING_START: true,
PRESENCE_UPDATE: true,
},
maxShards: 'auto',
defaultImageFormat: 'png',
compress: true,
connectionTimeout: 60000,
}```
Would anyone know why this is happening
exactly a minute?
well not exactly but around there
i used the debug event and every shard says Queueing reconnect in 1000ms | Attempt 0
@vestal grail anything, if the problem is resolved, you can use "you're welcome" or "no problem" XD
mmm I used to say no problem, but now I doubt which one I should use
What about no worries
and cheers
xD
I can't even use that one :angeryBOYE:

that's a little bit too bright for my liking
#00FFFF
lol nice
So I have a command handler and I want to know how to make my prefix 2 prefixes one the original and another a mention but when I try I get a error help?
umm send the command handler?
Ye hold on
you only need to check if the message starts with the prefixes
Can someone help me with my bot please?
@knotty kayak language?
What?
jesus
I don't know anything about java or javascript or anything. But while I was doing the ROBLOX Creator Challenge, it taught me nothing but it said something about Java or Javascript when I was taking one of the test things.
do you have a bot that you are coding
I'm confused
ok so what do you need help with
So you have a bot that you need help with but you don't know how to code?
Is it really that hard to understand? I NEED HELP WITH EVERYTHING (With Discord Bots)!!!
I recommend learning a language to code with. JavaScript/node would be the easiest
Are you looking for help on how to develop a discord bot using Javascript?
I guess.
https://goo.gl/K8RkLg
Learn JavaScript for beginners | Udemy
https://goo.gl/A0d4Xi
The Complete Node.js Developer Course (2nd Edition) | Udemy
If that is one of those stupid boot camp things that I found when I was looking for how to code, I am not going!
Udemy costs money though
Like 10$
There are some free learning sites online
I'm not paying anything.
@knotty kayak it is 10$. No one is going to help you if you aren't going to learn
BTW how old are you @knotty kayak
@tall falcon he needs to learn the language before starting
@night imp I got muted for ranting someone out, but I figured out a way to get unmuted. :p
I think he just wants to go straight into development and learn that way
So stfu.
You are admitting to avoiding a mute?
and also @knotty kayak stop being such a dick towards people for asking a question
Ok was confused when he told me to stfu
just kindly tell them to leave you alone
lol
Okay.

But seriously you need to learn the language.
@night imp Sthu
Ok can't help you 👌 bye gl
or jump straight into and learn as you go
@night imp don't spark something
roblox
he got muted again lol
hes not in the server anymore
gets muted then leaves
cant help you if you dont say what is your problem
How to like "photoshop" or likely in discord.js?
congrats 
after 3 times of uninstalling
Help
[0230:2530][2018-06-18T05:01:07]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{a9528995-e130-4501-ae19-bbfaddb779cc}, resume: ARP, restart initiated: No, disable resume: No
[062C:2BF8][2018-06-18T05:01:07]i399: Apply complete, result: 0x0, restart: None, ba requested restart: No
------------------- Python --------------------
Successfully installed Python 2.7```
i see no problem
Windows build tools's installation is currently frozen
I cannot get complete msgs
reinstall
So I installed build tools 2017 and using
python isn't installed?
installed
it takes time 
superagent.get('https://api.apixu.com/v1/current.json')
.query({ key: 'My key was here'})
.query({ q: nyc})
.end((err, res) => {
const embed = new Discord.RichEmbed();
embed.setTitle(`Weather In ${res.body.location.name}`)
.setThumbnail(`http:${res.body.current.condition.icon}`)
.addField("Name", res.body.location.name, true)
.addField("Region", res.body.location.region, true)
.addField("Country", res.body.location.country, true)
.addField("Local Time", res.body.location.localtime, true)
.addField("Temperature", `${res.body.current.temp_c}° C | ${res.body.current.temp_f}° F`, true)
.addField("Feels Like", `${res.body.current.feelslike_c}° C | ${res.body.current.feelslike_f}° F`, true)
.addField("Wind Speed", `${res.body.current.wind_kph} KP/H | ${res.body.current.wind_mph} MP/H`, true)
.addField("Wind Degree", `${res.body.current.wind_degree}`, true)
message.channel.send({embed})
});
I am trying to do a weather command it works with location I set in the code, how do I do it with args...? like !weather canada and if no arg was provided so it will say "Please specific location"
i dont see the part where you define the arg
Parse JSON object first
did you try to learn it first?
Ah
like that
Then add if condition
if (arguments)
if (????????) {
the var
how do I store args... lets start with that
if (!defined variable) return <whatever you want>
so if I set (not like that) var location = args bla bla bla
if (!defined location) return <whatever you want>
Where you storaged argument
You said without arguments
if I will do !weather New York
and var location = args.slice(1).join(" ");
Location = New York
??
@topaz fjord
why
would you do that
then that means the user cant find weather on a specific location
const Location = args.slice(1).join(" ")
const locations = {
'New York' = nyc
}
locations[Location]
Like this
New York !== nyc
i dont think they would want to create an array for every single location
in the world
const superagent = require("superagent")
const Discord = require('discord.js');
var location = args.slice(1).join(" ");
exports.run = async (client, message, args, level) => { // eslint-disable-line no-unused-vars
if (!location) return msg.channel.send("Please specific location!")
superagent.get('https://api.apixu.com/v1/current.json')
.query({ key: 'my key was here'})
.query({ q: location})
.end((err, res) => {
const embed = new Discord.RichEmbed();
embed.setTitle(`Weather In ${res.body.location.name}`)
.setThumbnail(`http:${res.body.current.condition.icon}`)
.addField("Name", res.body.location.name, true)
.addField("Region", res.body.location.region, true)
.addField("Country", res.body.location.country, true)
.addField("Local Time", res.body.location.localtime, true)
.addField("Temperature", `${res.body.current.temp_c}° C | ${res.body.current.temp_f}° F`, true)
.addField("Feels Like", `${res.body.current.feelslike_c}° C | ${res.body.current.feelslike_f}° F`, true)
.addField("Wind Speed", `${res.body.current.wind_kph} KP/H | ${res.body.current.wind_mph} MP/H`, true)
.addField("Wind Degree", `${res.body.current.wind_degree}`, true)
message.channel.send({embed})
});
};
why this doesn't work?
use weather-js
var location should be under exports.run @feral matrix
But array is good at performance then using other methods or etc
exports.run = async (client, message, args, level, location) => {
this will fix it @topaz fjord ?
just put var location = args.slice(1).join(" "); under that
exports.run = async (client, message, args, level) => { // eslint-disable-line no-unused-vars
var location = args.slice(1).join(" ");
and dont use var pls
yes
let or const is better
choose const if the value isn't going to change in future
if (!location)
what is !defined
can u try it again
!defined variable means variable named defined variable is not existing
if (!args[0]) also works for me :v
spaces in variable names arent even a thing
^
MrSheldon - Today at 11:32 PM
d!weather
testBOT - Today at 11:32 PM
Please specific location!
Oliver Evans - Today at 11:32 PM
d!weather tlv
testBOT - Today at 11:32 PM
Please specific location!
use args[0] instead
!weather New don't work
!weather New York Does work
how do I make it work with 1 word...?
Um
@feral matrix limited to 1 word?
if args doesnt include the command itself, then you dont need to do slice
I want it to work with 1 word and with multiple words
My event doesn't work fsr. Discord.py rewrite.
@bot.event
async def on_message_delete(message):
async with aiohttp.ClientSession() as session:
webhook = Webhook.from_url(webh, adapter=AsyncWebhookAdapter(session))
embed = discord.Embed(title='{0.name}#{0.discriminator}'.format(message.author), description='Channel: {0.mention} | {0.name}\n\n{1.content}'.format(channel, message))
embed.set_author(name='Message Deleted')
embed.set_footer(text='{} - {}'.format(now.strftime('%d/%m/%y'), message.id))
await webhook.send(embed=embed)
My opinion is same
Using array
const list = {
rock: 'rock',
paper: 'paper',
scissors: 'scissors',
r: 'rock',
p: 'paper',
s: 'scissors',
'바위': 'rock',
'보': 'paper',
'가위': 'scissors',
'주먹': 'rock'
}
const request = list[nt.arguments[0].toLowerCase()]
I used array like that in my bot's rps command
Platform info: Windows_NT 10.0.15063 x64 Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz × 4 Async types tested: Bluebird Promises = Bluebird 3.5.0 Promises Native Promises = ES2015 Chrome V8 Promises Asy
are callbacks really that much faster than async?
Isn't async checks the condition of function by calling back?
const superagent = require("superagent")
const Discord = require('discord.js');
exports.run = async (client, message, args, level) => { // eslint-disable-line no-unused-vars
let location = args.slice(1).join(" ");
if (!location) return message.channel.send(`Please specific location!`)
superagent.get('https://api.apixu.com/v1/current.json')
.query({ key: 'KEY_WAS_HERE_LOLXD'})
.query({ q: location})
.end((err, res) => {
const embed = new Discord.RichEmbed();
embed.setTitle(`Weather In ${res.body.location.name}`)
.setThumbnail(`http:${res.body.current.condition.icon}`)
.addField("Name", res.body.location.name, true)
.addField("Region", res.body.location.region, true)
.addField("Country", res.body.location.country, true)
.addField("Local Time", res.body.location.localtime, true)
.addField("Temperature", `${res.body.current.temp_c}° C | ${res.body.current.temp_f}° F`, true)
.addField("Feels Like", `${res.body.current.feelslike_c}° C | ${res.body.current.feelslike_f}° F`, true)
.addField("Wind Speed", `${res.body.current.wind_kph} KP/H | ${res.body.current.wind_mph} MP/H`, true)
.addField("Wind Degree", `${res.body.current.wind_degree}`, true)
message.channel.send({embed})
});
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "weather",
category: "General",
description: "Display weather of location",
usage: "weather location"
};
!weather New don't work
!weather New York Does work
how do I make it work with 1 word and with multiple words...?
@feral matrix superagent.get('https://api.apixu.com/v1/current.json')
what...?
@feral matrix Can u see if NewYork works?
@feral matrix for location instead of args.slice(1).join(" ") try args.join(" ")
I see
lol
in speed and other stuff
Is it better than Redis? 😁
idk about redis
Ah
and for very small stuff maybe mongo but I mean not embedded and it's nosql
Im benchmarking my redis now
^^
Benchmark of My Redis: https://hastebin.com/adunezamoc.erl
100000 requests completed in 0.94 seconds xD
nice
damn
Compared to MYSQL as an EXAMPLE:
5000 items 315 000 rows 10784 kB takes 72 seconds
5k in 72 seconds lol
Nope
but with enough data it'll use a lot of ram
It uses in memory + nosql
nosql is database type
I just did 100K
redis keeps all it's data in memory
Actually false
it can also save to files
ok there
but all data will be always kept in memory
nvm I retract my statement
You are correct it stores in memory then moves to file on shutdown I believe
that's the whole reason redis was created
you can enable rdb (snapshot)/aof (logs all operations that modify the data)
yep
aof is instantly written to
and is always appended
rdb is the whole data, overwritten every save
^ This guy knows his redis 😛
if you want reliability, use aof
if you don't mind losing a couple minutes of data on crashes, only rdb will be fine
Which is what I do ^^
if you want just a cache, disable both
and i have not allot of brain cells
He's going into the technicals
But its very very easy to use/setup
You use Linux or what?
windows
So I can point you to the correct resource
mainly
K
Thats the Windows port of Redis
Although I'd perfer to run redis on Linux
What distro do you use?
i need redis windows for beta stuff
That will do it all 😃
ok
whats redis like?
But keep in mind redis by default binds to 127.0.0.1
Ok so in java at least this is how it works
redisInstance.set("variable", 1234);
As an example
That sets the variable named variable's value to the integer 1234
Thers not .save .commit or the a query even
Its just one line after you define your connection stuff
👌
Like I said thats basic redis though
cuz with sqlite
You can go advanced obviously
issue with redis-windows is that it cannot load rdb files from linux
then convert it from Redis > GSON > back to a Java object
I like RethinkDB lots, in node.js with rethinkdbdash its easy:
r.table('posts').insert({ id: 0, title: "hello world", createdAt: new Date(), author: user(something).id }).run();
@sick cloud you use rethink?
Yep :3
More work than I just did though
Adding table like stuff for definitions is basically like using : in your variable
Example
redisInstance.set("hi:variable", 1234);
lol
Hi would then become the main key and then variable would be a subkey
Anyway I was just curious on db types people use 😃
Rethinkdb is the way to go now bois
Scrap SQLite
I've tried so many DBs in the past it's not even funny
You name one .. I probally tried it
Minus rethinkdb
I've done MSSQL, MYSQL, SQLITE, Mongodb, Redis are the ones that I can name off the top of my tongue
I've tried way more but cba to name them all
MySQL SQLite Mongodb are bad
I prefer rethinkdb coming to it
Fair enough
Never heard of redis
Oh wow
😂 link me
Did you see my benchmark?
oof
Never even used Redis, heard of it a tiny bit.
That link is a benchmark of a custom redis server
Is the redis site.. I'm sure you can find better documentation elsewhere though
re: Adding table like stuff for definitions is basically like using : in your variable
you don't actually need to use :, it's just convention
keys can be anything <= 512MB
iirc
owo
why would you want that, idk
Like I said though I like to keep my stuff in GSON arrays from a Java Object
BotAccount account = gson.fromJson(instance.get(s), BotAccount.class);```
Works fine for me.. Never ran into a data corruption issue since using it
if you don't share gson objects with other threads you should be fine
Nah.. I make a new instance each time I need to call something
I actually need some help with Rethink, when I follow the Ubuntu install instructions I get this error, and it just won't install (see the attachment)..
ok so that means they don't support that version you are on
<-- Used to be a helper on #ubuntu
Aka they don't support bionic
You can try using a lower supported branch
Here is a list
alright, and how do i install a lower release/branch or whatever?
Show me your sources.list related to rethink for me
How? 👀
(total linux noob here ;-;)
sudo nano /etc/apt/sources.list
Hmm seems its in sources.list.d directory then: /etc/apt/sources.list.d/
then use ls to see if you see the rethink source file
It may say something like: rethink.list
or something like that
Np 😃
okie
That shouldn't be empty
alright so now you see where it says bionic
Thats the part you change to one of the dists that you want
Since you are new.. Let me get it for you 😃
Hi there tony
👀
Use xenial
😃
so change bionic to xenial
No / sorry
Then once you do that MAKE SURE to: apt-get update
okie
Now try installing rethink
😃
If you get an error on apt-get update though let me know.. They might have a release specific key
Hm looks like Mr.Tony has added me on discord
@quartz kindle Client is a global variable
And I guess it is
but idk how to end the listener
alright
I assume you got no errors Tony?
okie
aw crap
hmm
Tim said this, http://prntscr.com/jw3cxw any idea how to stop the old end event from executing? http://prntscr.com/jw3cxw
Try apt-get -f install for me even though usually that means the branchs aren't compatible
anyone know of a free host?
@earnest phoenix For a bot?
^
okay hold on
I really hope apt-get -f install works for you Tony or you might be out of luck on official builds
crap
ahh im try glitch
I hate glitch tbh lmao
thx for your help @floral leaf
or use azure or digital ocean, they're pretty cheap
So.. anything else I can try do? D:
Im helping tony he wants rethink
but not 4 u lol
Tony do wget https://github.com/srh/rethinkdb/releases/download/v2.3.6.srh.1/rethinkdb_2.3.6.srh.1.0bionic_amd64.deb
lol
then dpkg -i v2.3.6.srh.1/rethinkdb_2.3.6.srh.1.0bionic_amd64.deb
That will install rethink for bionic
😃
oo okay yay!
I suggest also deleting the rethink.list in /etc/apt/sources.list.d/
To do that rm /etc/apt/sources.list.d/rethink.list
opps
spoopy
I put a / init
oh
srry
all good ^.^
dpkg -i dpkg -i rethinkdb_2.3.6.srh.1.0bionic_amd64.deb
My bad
Btw please delete the source list first
and apt-get update
alright
SO you have a clean system for it to install on
the rm thing said that rethink.list didn't exist
oh did u already delete it?
o lol
also the deb should be in /root not in sources.list
Your gonna cause an error there
rm that too
xD
cd /root for a correct download directory
once u clean and get apt-get working
oof ok
yep
then do that
And finally dpkg -i rethinkdb_2.3.6.srh.1.0bionic_amd64.deb
Had 2 dpkgs in there at first for the second command
okay
And apt-get -f install should install anything else queued aka your rethink
🍪 here ^^ :P
XD
thanks though ❤
No problem .. If you ever need any Ubuntu help just hit me up 😃

I worked with the Ubuntu people and system (as volunteer) for years
Had to leave though sadly because of job stuff
Anyway. Glad to have helped.. Gave me flashbacks of good ole days
Very cool :V
Having sone GitHub Desktop issues if anyone uses it. yesterday, it worked fine - today it says publish ( https://cdn.discordapp.com/attachments/457756983693410318/458071314343657479/unknown.png ) and this when i try it ( https://cdn.discordapp.com/attachments/457756983693410318/458070850122416129/unknown.png ) ;-;
anyone know?
they haven't even acquired it yet, deal isn't happening until later this year
I think it's the reference between local & github that's broken
The master branch
Try making a new repo.
or the good ol git reset --hard HEAD
We aren't making a new repo, too many commits..
..and I tried git reset --hard already, did nothing ;-;
I'm not a fan of it, its disgusting for me lol. but yeah I do have it .-.
Mmm give that a try.
How?
.-.
Just a sec
ok
I already have Git installed
already set it up though 
Yes. But it's shows you how to commit etc
so type git commit -m 'test' or something maybe?
I'm just wanting to fix GH desktop ;-;
Sorry can't help much I'm in class
Scratch that
https://stackoverflow.com/questions/6656619/git-and-nasty-error-cannot-lock-existing-info-refs-fatal
@sick cloud
okay
Maybe that helps
wow no that errors too D:
Wow
No clue man
;w;
Maybe this
Fixed it >:3
ugh
this is annoying me so much but
message.client.config.bumpchannels.map(id => {
message.client.channels.get(id).send({bump})
})```
It keeps saying cannot send an empty message
when bump is a perfectly fine embed
smh
because when you do {bump} it gets translated to {bump: bump}
which is why {embed} works
oh
im so fucking retarded
thank you ;3333
if(!message.member.id ==="448629905731747842") return message.channel.send("**Error:** *Permisions invalid!*");
Why isnt this working???
if(message.member.id ==!"448629905731747842") return message.channel.send("**Error:** *Permisions invalid!*");
?
@inner jewel
So, in my web dashboard I'm making, I have this code:
Router.get('/servers', checkAuth, function(req, res) {
let array = [];
req.user.guilds.forEach(guild => {
if (guild.owner === true) {
array.push(guild);
}
});
res.render('viewServers', { title: 'Your servers', user: req.user, guilds: array });
});
How do I push guilds to the array if the user is an owner OR they have Manage Server permissions?
I'm using the identify and guild scopes also :^)
check the bit fields
if(guild.owner || ((guild.permissions & MANAGE_SERVER_BIT) != 0))
you need to get the actual value from the discord docs
Am I wrong or does js node have goto?
@earnest phoenix I hosted my bot on glitch.com and im already limited my bots command handler if i put em in one file its 82GB worth of storage lol
Uhh
uhhhh
Command handler itself is 82 GB
you know you can make modules in glitch right?
not really im new lol
im really new to discord bot coding ive studied for years and gave up and now im back trying to make a successsfull bot , my bots name is LevelCord
With Webhooks and URL can I use a URL like
www.examplewebsite.com/index-a?
you mean with a custom path?
yes
yes
Alright, thanks
@sick cloud what was it?
@stray wasp GitHub desktop just totally broke.
oh ok
I started using Visual Studio Code's SRC. :3
alright
@stray wasp know how to fix this one?
nah bro sorry.
;w;
I'll look in a sec
thats when i try pulling
I found a fourm
error: cannot lock ref 'refs/remotes/origin/master': unable to resolve reference 'refs/remotes/origin/master': reference broken From https://github.com/herio5154/stargoon ! [new bra...
@sick cloud
thanks
already am
ok sweet
@sick cloud use cli
cli > *
node.js music bot command ?
Why does this event not work? Any ideas?
@bot.event
async def on_message_edit(before, after):
if before.content != after.content:
if before.id == something and not before.author.bot:
try:
async with aiohttp.ClientSession() as session:
webhook = Webhook.from_url(webh, adapter=AsyncWebhookAdapter(session))
embed = discord.Embed(title='{0.name}#{0.discriminator}'.format(before.author), description='Channel: {0.channel.mention}: {0.channel.name}\n\nBefore:\n{0.content}\n\nAfter:n\n{1.content}'.format(before, after))
embed.set_author(name='Message Edited')
embed.set_footer(text='{} - {}'.format(now.strftime('%d/%m/%y'), before.id))
await webhook.send(embed=embed)
except Exception as e:
print('Error: {}'.format(e))
``` no errors in console. 
Okay, that was wrong. Fixed.
?
bot.on("message", function(msg) {
if (msg.author.equals(bot.user)) return;
if (!msg.content.startsWith(prefix)) return;
var args = msg.content.substring(prefix.length).split(" ");
switch (args[0].toLowerCase()) {
case "8ball":
var fortunes = [
"Oui.",
"C'est faux.",
"C'est vrai.",
"Sans aucun doute.",
"Non.",
"Je ne c'est pas.",
]}
if (args[1]) {
msg.channel.send({embed: {
title: "Hmmm... ?",
description: (fortunes[Math.floor(Math.random() * fortunes.length)]),
}});
}
}); ```
?
code mmmm
there is so many things wrong with that
the code itself is good but .length when I do another command like purge that works and down there it says that .length is not defined while I don't have it in my purge command and that without the 8ball code it works perfectly
description: (fortunes[Math.floor(Math.random() * fortunes.length)]),
^
TypeError: Cannot read property 'length' of undefined
this error
because fortunes doesn't exist in the same scope
?????
you're declaring it inside a switch
it's only declared if args[0] === "8ball"
which doesn't make any sense because you do declare it but it's not in the same scope so you couldn't use it anyway
that's why "fortunes" is undefined
and where I have to declare it
that's something for you to figure out
lol okay 😃
let i;
client.guilds.map(g => g.memberCount).forEach(+ i)
I'm a little confused on how to add each map in guilds membercount together. Anyone know any documentation to help me?
yes and add them together.
i think you can use the reduce method
oh ok thanks I'll look into it.
👍
you can also achieve that with client.users.size
lmfao
@ancient drift it’s a custom emoji right?
Try it like this: <:emojiName:ID>
Like
is gonna be !discordbotlist
Add a \ before the emoji to get this
Evaluating Code
message.guild.members.get("289965520223076352").joinedAt
Output
Wed Dec 31 1969 19:00:00 GMT-0500 (EST)
Anyway got any idea why it says 1969
and how to fix
is 289965520223076352 a member in this server?
@earnest phoenix it's a known issue when using erlpack on d.js https://please.zbot.me/79O8XKTm.png
it's an optional package for d.js
you may or may not have it installed
even if you don't i've seen people suffer from the same issue
Okey dokey. I was so confused when it says 1969. Hope it's resolved soon.
you could try parsing .joinedTimestamp yourself not sure if its affected by the same issue
Yes, it says "0" lol. @earnest phoenix
xD
Thats the beginning of unix time. Must be an issue converting the milliseconds
There would be a command for the bot creator to be all right on his bot in any server?
never used it
Is there a way to fetch a user in discord.js master?
There is in stable but I can't find one in master
Not sure. Can’t find it in the docs.
Can't find it either :/
Oh, didn't see that. Thanks!
Interesting
I can't npm install canvas >:-)
idk
it tries to go to like npm_modules/npm/npm_modules
idk
nvm
You have try with
npm i canvas
Is se same
it's not that
I need to install something special first :3
poop
is there anything else then canvas that works I don't have to download something extra? (just so I know)
You need to install what?
So again i'm trying to make a second prefix as a mention code: https://hastebin.com/wepevijewu.js can anyone tell me whats wrong with this?
guys why throw err;
^
Error: Cannot find module 'Gallery.js'
const Gallery = require("Gallery.js");
@earnest phoenix probably.this ```js
if(commandfile2) commandfile.run(bot,message,args)
u used commandfile2 but then commandfile
@earnest phoenix Is Gallery.js an npm module or a file in your project?
file project
try js const Gallery = require("./Gallery.js");
No it still doesn't work 
@bright spear throw err;
^
Error: Cannot find module '../Gallery.js'
no 🤔
remove a dot
Gallery.js is in the main folder of your project right? or is it in a subfolder
I don't have any other idea
no is not this is other problem lol
@bright spear
but the images are not displayed
const Discord = require("discord.js");
module.exports.run = async (bot, message, args) => {
let mrole = message.guild.roles.find('name', "Member");
let aUser = message.author
if(!mrole) return message.reply("Couldn't find the role. (Member)");
await(aUser.addRole(mrole.id));
message.reply("Gave you that role!")
}
module.exports.help = {
name: "agree"
}
``` why does this always return "Couldn't find role. (Member)"
Because in your server you dont have create this role
it wasnt that but thanks anyway






