#development
1 messages ยท Page 376 of 1
I am having trouble getting my bot to randomly choose between two variables in an array.
Here is part of my code (In javascript):
var coinFlip = ['Heads!', 'Tails!'];
var randCoinFlip = coinFlip[Math.floor(Math.random() * 2)];
//Skiped part of code
if (message.content.startsWith(prefix + "Flip Coin")) {
message.channel.send(randCoinFlip);
}
It send either "Heads!" or "Tails!", but continues to send the same one, until the bot is reset manually.
I tried using infinite loops, but my bot would not turn on.
All my other commands work.
Just send the math without using an extra variable
Cause I define it in the start
And each time call the same var
Without ever updating it
Oh no
;-;
Just call the maths while sending it
I'm very new to coding, and don't know how to do that.
just move the logic for selecting the flip into the command handler
if you execute the logic beforehand, the results are predetermined at every call to the command, right?
yos
basically, message.channel.send(....... Maths Stuff to get item )
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOH
ok lemme try
var coinFlip = ['Heads!', 'Tails!'];
//Skipped Code
if (message.content.startsWith(prefix + "Coin Flip")) {
message.channel.send(coinFlip[Math.floor(Math.random() * 2)])
}
Now it appears to alternate between "Heads!" and "Tails!", instead of a random pattern. ;-;
Wait no never mind, I was just astronomically unlucky for 10 flips.
Thank you!
๐
Im need SpoonFeedBack
hmm
I have yet more issues
I don't understand embedding ;-;
Here is my code:
/Embed Bot Command responces
const prefix = "s!"
client.on("message", (message) => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
if (message.content.startsWith(prefix + "Embed")) {
message.channel.send({embed: {
color: 3447003,
description: "A very simple Embed!"
}});
}
});
It returns the following error:
C:\SoupyBot\mybot.js:28
});
^
SyntaxError: Unexpected token )
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
The client.on("message", (message) => { . . . }); works perfectly fine in my non-embedded commands.
are you missing a }
Ohh
if you have too few ending braces, it says the bracket is unexpected
this?
/Embed Bot Command responces
const prefix = "s!"
client.on("message", (message) => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
if (message.content.startsWith(prefix + "Embed")) {
message.channel.send({embed: {
color: 3447003,
description: "A very simple Embed!"
}});
}
});
;-;
also, its ```js
fbi shit going on
m8
//Embed Bot Command responces
const prefix = "s!"
client.on("message", (message) => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
if (message.content.startsWith(prefix + "Embed")) {
message.channel.send({embed: {
color: 3447003,
description: "A very simple Embed!"
}});
}
});
that got clipped off
ok
Is there any way to make your BOT Page dark themed?
Did you log into your bot?
All I know is User Settings > Appearance > Theme > Dark Theme.
Now, what code should I use to execute eval in discord.py[async]?
Hello! Someone can help me? i have a error! โ
Show the full JSON (remember to hide sensitive things...)
you've got an issue in your package.json file, if you're trying to install a package just try and do it manually
or try removing the file and let it regenerate
Rezolved
๐
@tame rivet wdym
implementation
Are you making something and you want to implement ratelimits?
How do discord.py [ASYNC] get their time from ping command?
ctx.message.created_at - datetime.datetime.now() ```
Guys , Im needing to put my bot to say @here but when he say it, dont mention everyone...Someone help pls? http://prntscr.com/iibyjm
i cant edit my bot detailed description
it says "Potentially malicious script detected"
Some libraries have a config option of filtering out everyone and here @upper pumice what lib are you using?
its just html and it doesn't have any script tag
Hello, I'm trying to remove the background of this and change the color. I've done the color but I can't figure out how to do the background
code {
background-color: none !important;
background: none !imporant;
color: #fff;
font-family: "Karla", serif;
}``` That's my code
it does that ^
#ffff is white ๐คฆ
๐
#fff is white though?
yes
Ah
wanted that
Yea its a bit annoying doing !important all the time ๐
Yup
Trying to edit messages content with eris, but uhh https://my-cat.is-going-to.space/3db84f.png https://my-cat.is-going-to.space/0ef117.png (First image = original message, 2nd edited to just word testing, but somehow it mixes the both messages together?)
@prime cliff Eris
@upper pumice Yea its a client option https://i.imgur.com/0ntB0qv.png https://abal.moe/Eris/docs/Client
Enabled by default
that's a truly weird issue you got there trixter
shouldn't happen
i suspect discord 
How does I do it @prime cliff
How do I find out my user.id
How does I do it @prime cliff How does I do it @prime cliff
You need to use the client constructor to set the option
Go to where you defined discordclient
He wants to disable the everyone/here filter
you can use the message options to enable everyone/here for that specific message
Eris, a NodeJS Discord library
But yeah, you indeed can disable it in the client constructor options
i highly recommend not to tho
Yes , I saw this last time , but Idk what would I do
What sould I write on my codes to do it true?
you pass an object with the described parameters instead of a simple string 
Can you do it like SendMessage("Hello", disableEveryone: false) or is it diffrent in eris 
na you can't, second parameter will be considered as the file parameter
so it has to be Channel.createMessage({ content: "Hello", disableEveryone: false });
http://prntscr.com/iieb28 Where it?
On yellow its where its the @here but not mentioning
Client.createMessage() takes the three parameters channelID, content, file instead of the 2 content, file the channel based method takes, so the one to change from string to object is the second one
Can u send me a print on where it is it?
No , I want the @here , but this is not mentioning everyone , only stay blue
but
@here is poopy
just dont use it xD
then let them make a custom role call AFK Reminder or something
due to @here is the same spam as @ everyone
role pings 
OOF
people can choose if they want to role
to make it even more better
so you dont get pings
ofc?
thanks
i assume you used to use message.mentions.users.first() or something like that
so yeah as its a collection, and that collections don't have indexes
to get the second mention you would have to make the collections an array first
So I want to mention a tag , like <@&265158261945270273> , but this dont mention the guys of tag too :/
you mentioned us...
how do you make your bots log?
by writing code to make them log
Duh
Uhh
Is there any reason why the localstorage should not work in a browser that is not in incognito mode
You disable it?
I think disabling cookies disables local storage
At least beetwen reloads
At least thats the case in chrome last time I checked
Cookies are enabled
It looks like it isn't even being set
I believe localstorage has like a 10 MB limit
5MB
But it's all KV storage
How the fuck you gonna run out of 5MB unless you try to write the bible there
okay wtf
It seems to have turned out
That having www in front of it affects the localstorage location
the oofster
lol
Hey this has nothing to do with dbl, but does anyone know what the error here could be? https://shark-is-the-fucking-best.000webhostapp.com/i/cs9qwc.png
missing async function
ik but I still say the roblox oof even though I don't play roblox
^
oh wait
getpixels(blah, async (arg) => {
^
yep I just don't really know the terminology, forgot what a callback was
well now you know
yep thanks
pheonix idk
cool
omfg look at this scrub who can't find a name for their own bot
k im probably really stupid.... but https://shark-is-the-fucking-best.000webhostapp.com/i/a6pdei.png
LOL
async
prolly lol
while (true)
await Task.Delay(Brain);
oof
what if a 10 year old went in #306891333405245450
10 year old would be banned by now
LOl
haha
S P E C I F I C S
the help menu
How to catch the error of a d.js ready event? Been getting promise errors, breaking my code >:(
I'm trying to write a cog that works for bot bots.discord.pw and DBL. Here's what I have so far:
https://github.com/bmintz/cogs/blob/master/stats.py.
What should I do to make it support sharding?
i had nothing to thank of so i am making Bloxlink V2
ew Bloxlink
eh its all i thought of
maybe look at this
it has a json payload that you could use to send number of shards
data = {
'server_count': len(self.bot.guilds),
'shard_count': len(self.bot.shards)
}
this should be what you're looking for really
is it OK to post shard_count: 0 if the bot has no shards yet?
also, your code is so duplicated lol, check out mine
okโข
guys I have a question, is there an API limitation for libraries including links in footers of embed frames ?
Because in discor.py links doesn't work in footers
Can someone explain the following code?
let args = message.content.split(" ").slice(1);
let game = args.join(" ")
Assuming that message represents a discord message
Yeah
that will split the message into an array, and then args will equal the array from the second element onwards
then games will be the array joined by a space character
Oooh
What would happen if i got rid of it?
I should prob show the othercode around it.
//Admin Commands
client.on("message", (message) => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
if (message.content.startsWith(prefix + "setgame")) {
if (message.author.id !== "344671380412956673") {
return message.reply(":x: Admin Command Only")
}
let args = message.content.split(" ").slice(1);
let game = args.join(" ")
console.log(game)
}
});
you will get a not defined error
doesnt do anything right now besides printing out game
if you're doing it that way its probably better to handle splitting the command and args first instead of inside startswith
then you can do if (command === "setgame") etc
hmm
what bot who can move someone on voice channel to free slot voice channel?
woagh dyno can?
In dyno you can enter a command ?purge [Number]. in discord.js how can I find the [Number] so it can delete the specified number? I cannot find it in the discord.js api.
It is there, look in the message property
theres no "number" property in a message
the way it works is a message (or command rather) has arguments, and thats how you get the number
if you're really basic with this kind of stuff, i recommend you get a framework (like commando or something) that can automatically handle arguments for you
;-;
What is this error ?
client_connection: Connection<ConnectionKey(host='discordbots.org', port=443, ssl=True)>
Is it Discordbots related ?
Because I'm having 502 when trying to reach the website
- that's not the error
- website's down
if(message.channel.type != "dm" && message.channel.type != "group")
{
}
if(message.channel.type !== "dm" && message.channel.type !== "group")
{ }
@earnest phoenix about your question, you need to use js on your boat page
You need to be certified tho
aham
const testargs = msg.content.split(" ")
const testString = testargs.slice(2).join(" ");
if(msg.content.startsWith(prefix + " test")) { // enter value after "test"
console.log(testString);
}```
how do i make it so it will return if you haven't given this command a value, just using this for test, whenever I do the command normally without any value it console.log's a new line with nothing on it, is there any way to make it so if no value is entered it returns and sends a message telling the user to enter a value?
Do I have to be inside a @bot.even decorator to be able to use bot.user.id? Because I tried to follow the aiohttp sample in #312614469819826177 and it says AttributeError: 'NoneType' object has no attribute 'id!!
code snippet
bot = commands.Bot(command_prefix=commands.when_mentioned, description=description)
dbltoken = os.environ.get('DBL_TOKEN', None)
url = "https://discordbots.org/api/bots/" + bot.user.id + "/stats"
headers = {"Authorization" : dbltoken}
What does this error mean and how would I fix it?
Trying to implement the API into my python bot.
Traceback (most recent call last):
File "run.py", line 3, in <module>
import dblpy
ModuleNotFoundError: No module named 'dblpy'```
@cold fjord do this $ pip install dblpy
I already have.
make sure you're doing this inside the workspace
Yea I am.
๐ค launch a python interpretor in that directory and try import dblpy see if you get the same error
I get the error loading up the bot.
wait a sec, I just received a mention from here ๐ค
Some guy told you to look at the rules cause you are helping me and apparently it falls under "spoon feeding beginners"
Not a beginner just never ran into this problem before and was getting help.
kk, mb
Alright.
telling someone how to use pip install is not spoon-feeding, jonas
whaaa
Dblpy is installed to the /usr/local/lib/python3.6 directory, and it says the the requirements are "up to date".
make sure it's inside the virtualenv
The wha.
whaa you guys are not using virtualenv for this?
It's installed to the vps.
I am talking aboutthe local development, that's where you're getting the error, right?
this is your local system, right?
or may be the requirements.txt file isn't update and may not have dblpy
No, that's a screenshot from an ssh session to the vps.
well the error ModuleNotFoundError is pretty straight forward, Module Not Found
try this in your ssh, start a python instance, try import dblpy
tell me if you get any error
>>> import dblpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'dblpy'
>>>```
my guess is w/o sudo the modules should go in ~/.cache/pip/
My guess is this this is just going straight to dev/null (jokes)
you know what, there's a workaround this if you create a Virtual Environment
๐คท
I'm getting an error can anyone help me?
Why the hell am I getting this error: TypeError: Cannot read property 'send' of undefined if I try to send a message to a channel but if I try to send it to another channel it works. and yes, the bot has perms to send messages.
yea message.channel.send({embed});
Mhm
Figure it out yourself.
weird.
afaik ur message object is probably wrong
mhm
const reportArgs = msg.content.split(" ")
const reportString = reportArgs.slice(2).join(" ");
if(msg.content.startsWith(prefix + " bugreport")) {
const embed = new Discord.RichEmbed()
.setAuthor(`Bug Report:`, `${message.member.user.avatarURL}`)
.setDescription(`**Member:** ${message.member.user.username}#${message.member.user.discriminator} (${message.author.id})\n**Report:** ${reportString}`)
.setColor(0xff0000)
client.channels.get("416598356173914115").send(embed);
const secondembed = new Discord.RichEmbed()
.setTitle(":white_check_mark: Successfully sent Bug Report!")
.setDescription("Thank you for reporting a bug, your message will now be sent to the developers so they can fix it ASAP!")
.setColor(0x32CD32)
msg.channel.send(secondembed);
}```
it's just the server's channels it wont send to, it'll send to other server's channels tho
yes
oh okay i failed to read the entire code lul
๐
so yeah, what doesn't work is the second message?
it works in that other channel. I don't see why it wouldn't work.
you should log msg and see where's the channel property
uh ``` Client {
domain: null,
_events: [Object],
_eventsCount: 6,
_maxListeners: 10,
options: [Object],
rest: [Object],
dataManager: [Object],
manager: [Object],
ws: [Object],
resolver: [Object],
actions: [Object],
voice: [Object],
shard: [Object],
users: [Object],
guilds: [Object],
channels: [Object],
presences: [Object],
user: [Object],
readyAt: 2018-02-23T14:47:01.541Z,
broadcasts: [],
pings: [Array],
_timeouts: [Object],
_intervals: [Object] },
_guild:
Guild {
members: [Object],
channels: [Object],
roles: [Object],
presences: [Object],
available: true,
id: '325040514858745856',
name: 'Pete\'s Room',
icon: '91734fcede8b55b2dc36f654532d9a60',
splash: null,
region: 'sydney',
memberCount: 11,
large: false,
features: [],
applicationID: null,
afkTimeout: 900,
afkChannelID: '393663975360823299',
systemChannelID: '325040514858745856',
embedEnabled: undefined,
verificationLevel: 0,
explicitContentFilter: 0,
joinedTimestamp: 1515123517118,
ownerID: '223919574536552449',
_rawVoiceStates: Collection {},
emojis: [Object] },
_members: null,
_channels: null },
webhookID: null,
hit: null,
_edits: [] }```
that's the bottom part
when i typed the command i made it console.log msg
message.channel.send(`Roundtrip took: ${message.createdTimestamp - m.createdTimestamp}ms. Heartbeat: ${Math.round(bot.ping)}ms.`);
^
ReferenceError: m is not defined``` Any help?
don't use code you don't understand ๐
m is not defined
im blind ty for reading that out
So? define it
#define m message
please
import m from 'message';
am I seeing trolling
nah
import trolling from 'HumanBehaviour';
In that case, no
how are you trying to send it
hmmm
Alice is online!
Discord Bots WP has sent the 5017 servers with a 200 responce!
Discord List NET has sent the 5017 servers with a 200 responce!
Carbonitex has sent the 5017 servers with a 200 responce!
Terminal Ink has sent the 5017 servers with a 400 responce!
Discord Bots ORG has sent the 5017 servers with a 400 responce!
RIP terminal and dborg
do you log the response?
perhaps the body'll give you more information
ideally you should just ask your question rather than ask to ask
well i kinda want to embed something coded in html into discord but im not sure how to go about it
what does that mean
like, you're modifying the discord client?
the official client doesn't support arbitrary html embeds for obvious reasons
No, I was thinking I wanted to make a bot embed something I coded in html, but i dont know javascript so i wouldnt know how to exactly make it work.
I know you can make html work with javasript but im not very familiar with all that stuff
I was going to ask my friend, but she's busy all day
yeah there's absolutely no way to do that
the best you can do is have your bot link to some external website where you can then serve your content
But what about the thing that bots do with custom embedding?
That's not in HTML
i know, but i wanted to hange it to javascript
that's just a JSON embed, not even close to as versatile as HTML/DOM
oh
the closest you can get with embeds and html is ogp.me
still you don't choose the format
just give data
sending embeds yourself is the closest you'll ever get
It's not HTML
hm
Oof slow network
i guess i'll have to figure out how to do it another way, then.
Can even be a gjif
you can use that and upload it
The website I used was this https://cog-creators.github.io/discord-embed-sandbox/
the code gets changed to python, right?
you can send one of those with any discord lib
How to log in to your bot
What lib
This is the response Discord Bots ORG has sent the 5017 servers with a 400 responce saying {"error":"Unexpected token s in JSON at position 0"}!
;
malformed json
How to search on google using their API?
@inner jewel I've fixed it
how do I prevent my nodejs app from timing out of mysql connection
On disconnect reconnect
thx
for me it does
how can i show how many servers the bot is in in the playing status? d.js
Client.user.setStatus
trying to set up server blocks with nginx - both domains just reset to the default nginx page
followed https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04
Anyone had to deal with this before?
what are your nginx configs?
i need that
might be a wrong server_name
had that some time ago
also check /var/log/nginx/error.log
if an error happens it may fallback to the default vhost
/var/www/tweetcord.xyz/html/index.html
<html>
<head>
<title>Welcome to tc!</title>
</head>
<body>
<h1>Success! The tc server block is working!</h1>
</body>
</html>
/etc/nginx/sites-available/tweetcord.xyz
server {
listen 80;
listen [::]:80;
root /var/www/tweetcord.xyz/html;
index index.html index.htm index.nginx-debian.html;
server_name tweetcord.xyz www.tweetcord.xyz;
location / {
try_files $uri $uri/ =404;
}
}
and the same for remindmebot.xyz
lemme check those, sec

Error log:
2018/02/23 21:49:33 [alert] 29935#29935: *11 open socket #11 left in connection 3
2018/02/23 21:49:33 [alert] 29935#29935: *12 open socket #12 left in connection 5
2018/02/23 21:49:33 [alert] 29935#29935: *10 open socket #3 left in connection 7
2018/02/23 21:49:33 [alert] 29935#29935: aborting
2018/02/23 22:00:08 [alert] 767#767: *9 open socket #3 left in connection 6
2018/02/23 22:00:08 [alert] 767#767: aborting
hmmmm
for anyone wondering how I fixed it, just used apache https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts
and then https://stackoverflow.com/questions/8541182/apache-redirect-to-another-port to hook it up to Express
I've struggled with this for some time and am definitely doing something wrong.
I have apache server and a JBoss server on the same machine. I'd like to redirect traffic for mydomain.com to JBoss
@earnest phoenix im probably too late but above your message.channel.send put
const m = await msg.channel.send("Pinging");
rule 7
don't spoonfeed because then they learn nothing!!!
@uncut slate im gonna ask this stupid question but not the same port right?
And also
Do you use cloudflare
If you do you only need to add 1 type of address
You can just make a cname
any possible chance you could tell me where the hell I am missing the )
var msgid = "403986411310809088"
var channel = tempVars("channel")
channel.fetchMessages({around: msgid, limit: 1})
.then(messages => {
try{console.log(client)}catch(err){console.error(err)}
const fetchedMsg = messages.first();
var guild = fetchedMsg.guild;
client.on("messageReactionAdd", (messageReaction, user) => {
if(messageReaction.message.id !== msgid) return;
if(messageReaction.emoji.name === "โ
"){
console.log('added coin to ${member}')
guild.member(user).addRole("416775048511356938").catch(err => {console.error(err)});
}
} else {
console.log("different emote");
}
});
client.on("messageReactionRemove", (messageReaction, user) => {
if(messageReaction.emoji.name === "โ
"){
console.log(`removed coin to ${user}`)
guild.member(user).removeRole("416775048511356938").catch(err => {console.error(err)});
}
} else {
console.log("different emote");
}
);
(tag me please when you respond)
use a parser??
I tried, its not getting it
sorry accidentally added a slash
this is a bit of a stupid question but if anyone here uses postgres, what would be the easiest way of adding new entries to a model, and have that reflect for all existing users?
so basically, i have a User model, and it has two keys called afk and afkReason, but I want to merge them into one object like afk: {afk: BOOLEAN, reason: STRING}, but what should i do to get this change to reflect for all existing entries/users in the database?
cc @white blaze (not a random ping ok don't you yell at me people)
ok well you're smart though how can i do that
i would loop over every user object and add the values i need to but thats not smart because i have over 2k users in the database i think
probably way more
I actually have no idea what you're talking about hahahaha
A model?
I'm not the right guy to ask man, sorry
I reencountered an error
oof
client.on("message", (message) => {
if (!message.content.startsWith(config.prefix) || message.author.bot) return;
if (message.content.startsWith(config.prefix + "purge 10k")) {
if (msg.author.id !== ("344671380412956673")
return message.channel.send(":x: Soupyz Only Command :x:")
message.channel.bulkDelete(100);
}
});
returns
C:\SoupyBot\bot.js:53
return message.channel.send(":x: Soupyz Only Command :x:")
^^^^^^
SyntaxError: Unexpected token return
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
In console
Prob forgot a bracket or somthing
i see
it
so dumb
I fixed it
Anyone know how I would fix this? I need it to send the message to the guild but as I have shards it's looking only in 1 shard, how would I make it scan them all? Because the bot can't find the guild. This is my code:
const reportArgs = msg.content.split(" ")
const reportString = reportArgs.slice(2).join(" ");
if(msg.content.startsWith(prefix + " bugreport")) {
const embed = new Discord.RichEmbed()
.setAuthor(`Bug Report:`, `${message.member.user.avatarURL}`)
.setDescription(`**Member:** ${message.member.user.username}#${message.member.user.discriminator} (${message.author.id})\n**Report:** ${reportString}`)
.setColor(0xff0000)
client.guilds.get("399121674198581248").channels.get("416611377554391091").send({embed});
const secondembed = new Discord.RichEmbed()
.setTitle(":white_check_mark: Successfully sent Bug Report!")
.setDescription("Thank you for reporting a bug, your message will now be sent to the developers so they can fix it ASAP!")
.setColor(0x32CD32)
msg.channel.send(secondembed);
}```
<@&265158261945270273> <@&264889767072628742> How do i get my bot online
Well you don't ping all the staff
Well can you help me
Oh my god.
?
What language?
Eng
Programming language
wait did i haft to set the lang
Well, you need to choose a lang first
Like make changes to it
You need to choose a language first
and then a library
and then you can make changes
Beginner languages are python and javascript
Well, to make it online you need a language and a library
Can i edit my bot
do you know any programming language?
No
then learn one
@topaz fjord nope, both websites running on port 80 on their domains, with just one IP
and I'm not using cloudflare
it's just apache and express
db.Database_Open('1234567890').then(i => { // Gets the Information on the Database of ID: 1234567890
console.log(i); // Returns { id: '1234567890', value: 0, text: '' }
});```
this returns a Promise<Object> right?
what does
How do I find a guild if Iโm grabbing it by id if I have shards, cause itโs not picking up my server as itโs in the other shard. Using discord.js
anyone have a moderation bot files?
i want to make some discord moderation bots
like kicking, or banning
write it yourself 
what the heck is a app.js file
you realize life doesn't work like that right
@warm halo <member>.kick("why(reason)") or <member>.ban("why(reason)")
let member = message.members.mentions.firts();
member.<kick or ban>("Reason")
.-.
add the .catch(err=>console.log(err)
oh also spoon-feed is forbidden
you might want to know that before continuing any further
let member = message.members.mentions.firts();
member.<kick or ban>("Reason").catch(err=>console.log(err)
@warm halo
inb4 u get banned today 

omg
i feel ya
hell no
i hate mine...
i hate the discrim changer


just killed any way to uniquely identify a user with a human-readable way
I keep my name and avatar
I already change my discrim
that's because ur a scrub rph
no im a baguette
๐ฅ


oh fck



french peeps need to get banned
nu

What does this have to do with #development
Interesting development conversation you guys have here.
Nothing
what do you have to do with #development
yes very developing
Maybe move to #general or #memes-and-media kthx
move urself
b!nsfw-gif
Hmm
Bots only work in testing channels
And nsfw commands will probably only work in #306891333405245450
b!nsfw-gif
Did you even read what I said
hey does anyone know a good hosting things thats free or below ยฃ5
Google Cloud trial, Digital Ocean w/ GitHub student pack are really good free options
Vultr and DO are pretty good too
$5 > ยฃ5
if you can't get a student pack, you can register and wait and you'll get $10 free from do and $20 from vultr
print("User {} is using the command kick".format(ctx.message.author.name))
role_names = [role.name for role in user.roles]
if ctx.message.author.id == ctx.message.server.owner.id or "Veruta_Commander" in role_names:
try:
await bot.kick(user)
await bot.say("User {} was kicked!".format(user.name))
except discord.Forbidden:
await bot.say("FORBIDDEN (status code: 403): Privilege is too low... :cry:")
except:
print("hi")
else:
await bot.say("You do not have permmision! This command is ristricted to {}".format(ctx.message.server.owner.name))```
What am I doing wrong?
I have the role but it doesn't work
Give me a sec.
Error is: Line1: Unexpected identifier
@earnest phoenix
Mk
@earnest phoenix
How so
i dont get that error
Hmm...
I'm not sure then.
k doesnt matter
let mod_role = message.guild.roles.find('name', settings.modrolename);
^
TypeError: Cannot read property 'roles' of null``` Any help?
Ehm
you don't have a guild
@earnest phoenix that code is python not js
the guild is null
TypeError isn't very pythonic
Oh
also TypeError does exist in python
Oh
the guild object is null
try thinking of scenarios where you receive a message that isn't in a guild
^ exactly what I told this dude lol
leeked dm's https://help-there.is-fi.re/29743a.png
Yo can someone help me i am dion a Python bot and i can't seem figure out what the code is for ping
๐คฆ
guys how do i make this first code only take out the mention
let text = args.slice(1).join(" ");```
can someone help me
this is coming up as an error
async def pingtest(ctx):
now = datetime.datetime.utcnow()
delta = now-ctx.message.timestamp
await client.say('{}ms'.format(delta(microseconds=1)))```
This place is cancer rn
XD
@mental willow wHAT EVEN IS THE ERROR
if we don't have the error we can't help
lol
ok one second @abstract mango
@mental willow that's not how you calculate ping
start = now()
message = await sendmessage()
elapsed = now() - start
message.edit(elapsed + " unit")
@abstract mango
async def pingtest(ctx):
now = datetime.utcnow()
delta = now-ctx.message.timestamp
await bot.say('{}ms'.format(delta(microseconds=1)))```
when this command is executed the console brings up an error saying that
await bot.say('{}ms'.format(delta(microseconds=1)))
then has this as another error
what the heck do you expect delta(milliseconds=1) to do
How do I use this bot?
seduce it
i have a bot that censors, and when you curse it responds with "You can't say that" and it deletes the curse message, How would i make the bot delete the "You can't say that" after like 3-5 seconds...
I cant do a second message.delete
so idk what to do
thing = sendmessage()
wait(5 seconds)
thing.delete()
That works too
right
thanks guys
wait
@inner jewel confused, do i put thing = sendmessage(message)
you don't copy paste that
you understand what that means
and write the equivalent in actual code
i dont really understand what that means ๐ฎ
i tried making my message.reply("blah") into the variable
nomsg.delete()```
ahhh
your issue is you are trying to delet a promise
not an actual message
you need to await message.reply
but the code needs to be in an async function
soooo...
(this is a guess)
await message.reply()
nvm
i stopped half way
that's not right
i have no idea what I'm doing xd
idk
await message.reply("blah")
thats not a thing tho
lang?
ahh
you can make the function async
async function
how, exactly...
then you can await promises
thing = (async()=>await message.reply(""))()
async function blargh() { code(); }
NO!
natan stop
client.on('message', async (message) => {
// your shite
thing = await message.reply("blurgh");
});
this is async function
now adjust it for your code
i've given you enough
async message >>>>>>> async (message)
ah, wait, if i make it async will it effect the rest of it?
like everything else in the client.on(awseSadsdasdasd(asdasd){ HERE})
no
Am I allowed to ask about CSS here?
it's development so go ahead
Hey is it possible to create a bot using a phone?
huhhhhhhhhhhh
I don't have my computer rn
Oh okay thanks
android?
you can download a terminal emulator
install node
npm
and nano
and code away
and stackoverflow is your ctrl + c
no spoonfeed zone
Download avatar
Average all the colors
Done
Its no rocket science
Make sure you handle animated avatars properly
Hello guys
^
@austere meadow @earnest phoenix does anybody know why my lavalink doesn't play audio when i send a play op code? it logs ```lavalink_1 | [21:30:01] [ INFO ] [SocketServer] {"op":"voiceUpdate","guildId":"199857240037916672","event":{"token":"5d
2654571145be91","guild_id":"199857240037916672","endpoint":"eu-central926.discord.gg:80"},"sessionId":"c07dc3d4a45e9ca9f
8fe42690a8d4e27"}
lavalink_1 | [21:30:01] [ INFO ] [JDAA] Audio System successfully setup!
senpai_1 | 21:30:13 - info: [Shard:0] [Command] Yukine#8080/184632227894657025 (@warm fox play ytsearch
:moms sphaghetti)
lavalink_1 | [21:30:13] [ INFO ] [[/]] Initializing Spring FrameworkServlet 'dispatcherServlet'
lavalink_1 | [21:30:13] [ INFO ] [DispatcherServlet] FrameworkServlet 'dispatcherServlet': initialization started
lavalink_1 | [21:30:13] [ INFO ] [DispatcherServlet] FrameworkServlet 'dispatcherServlet': initialization completed in
36 ms
lavalink_1 | [21:30:13] [ INFO ] [AudioLoaderRestHandler] GET /loadtracks
lavalink_1 | [21:30:13] [ INFO ] [GarbageCollectionMonitor] GC monitoring enabled, reporting results every 2 minutes.
lavalink_1 | [21:30:14] [ INFO ] [AudioLoader] Loaded playlist Search results for: moms sphaghetti
lavalink_1 | [21:30:14] [ INFO ] [SocketServer] {"op":"play","guildId":"199857240037916672","track":"QAAAkwIAKEVtaW5lbS
AtICJNb20ncyBTcGFnaGV0dGkiIChNdXNpYyBWaWRlbykAEUpheSBHcmVlbidzIHN0dWZmAAAAAAAEPfAAC1NXLUJVNmtlRVV3AAEAK2h0dHBzOi8vd3d3Ln
lvdXR1YmUuY29tL3dhdGNoP3Y9U1ctQlU2a2VFVXcAB3lvdXR1YmUAAAAAAAAAAA==","startTime":0,"endTime":0}
yes but i use a custom library to interact with lavalink from appelation
i forword all stuff correct and it seems to get everything correct but like it doesn't play
saw that a few min ago, looks nice
yes
oof
oh okay XD uh anyway im not too sure
which also became lavalink support
oh it does?
cc @ kromatic
guys
might sound like a dumb question, but
how can we use the webhooks the API sent to do something like giving a role when someone vote?
I mean, how to make the bot listen to the post request sent by the API?

hes french
why are you linking me to d.js docs lmao
what he's asking is, how we're supposed to set up a webhook which in the end gives a user which upvoted our bot a role in the server
is there a guide or something?
Read up on express
Can someone help me with my API for discord. Py

there\nhi
thanks
Assuming it's in code
How would I access require.cache from the main file in a module?
anyone one here with dealing with message edits with d.js
Hi
There
how do I uhhhh stream youtube videos
you will always have to download no matter what, but ytdl-core works by downloading videos chunk by chunk, which is essentially what streaming is
and ok you're using c# so all those options go down the drain

oh well
guys can you help me?.
with what
in all honesty im not really sure, sorry @frail terrace
oh well
how replace to ```
`
this text in nodejs
it might be best to google other projects that use music with c#
?
.replace("`", "") 
@austere meadow wut
you wanted help with message edits
oh
so
i get the part with remiting the message event when i edit a message
but
if i edit my message while using eval how would i be able to edit the bots message @austere meadow
if(yoklist.some(word => message.content.replace(/\s+/, "").replace(/\s+$/g, "").replace(/\n/g, "").replace(/\r/g, "").replace("`","").includes(word))) {
message.delete();
message.channel.send("omg");
}```
but it didn't replace ` this text
you would need to use .then on the bots message
so
//message is your message
message.channel.send().then(botmessage => {
botmessage.edit() //botmessage is the bots message
})
ok thx
in discord.js how would I get how many guilds are in each shard?
shard.manager.fetchClientValues
yea I tried that before but when I use it, it returns 0 guilds
do you await it
no, I didn't
still shows 0 and this is how I used it
client.shard.broadcastEval('this.guilds.size').then(results => {
console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`);
});```
@bright karma
still gets 0
don't await
it works for me
at the bottom of the logs it prints the server count.
@jagged birch
???
@unborn stone that's gay
@shadow hollow you'll get a DM from our magical bot @gilded plank
also can y'all get out of this channel if you're not adhering to the topic
lol
How can I make my bot send an image without using the discord image link
Ex of bad:
https://cdn.discordapp.com/attachments/409886899914932224/417221178147733514/Communism.jpg
upload a file as an attachment
MORE ERRORS
lol
client.on("message", (message) => {
if (!message.content.startsWith(config.prefix) || message.author.bot) return;
if (message.content.startsWith(config.prefix + "ton")
message.channel.send({
file: "https://cdn.discordapp.com/attachments/409886899914932224/417223891023298561/asston.png"
})
} else
//more code
Returns
C:\SoupyBot\bot.js:66
message.channel.send({
^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
I tried doing this:
client.on("message", (message) => {
if (!message.content.startsWith(config.prefix) || message.author.bot) return;
if (message.content.startsWith(config.prefix + "ton")
message.channel.send({
file: "https://cdn.discordapp.com/attachments/409886899914932224/417223891023298561/asston.png"
}); //<--- Semi colon
} else
//more code
Didnt help
NVM
IM JUST STUPIF
./filename.ext
not url
also remove the () from your message parameter
it'll work without it
Does anyone know how to use javascript httprequests in DBL bot pages im trying but i keep getting network errors ik that Donut did it with his bot page but he hasnt been on in awhile





which server

