#development
1 messages · Page 389 of 1
yea do that, but you probably can use them
how do i get the bot developer role?
K, 😃
@earnest phoenix by getting you bot approved
Theose emotes are not copyrighted i think its just the ones with faces
@earnest phoenix adding your bot and its bein approved

kkkk
anyone know how I can make command cooldown in discord.js?
or anti-spam idk
cache + rate limiting check
using a rate limiter
^
@prime cliff thanks for the info 😃
Hey @inner jewel am I breaking DBL TOS by using
in my server and bot???
¯_(ツ)_/¯
¯_(ツ)_/¯
i'll check the TOS
I assume not, since they are not iconic emoji's
By that I mean, they are not emoji's that represent DBL (like
or
)
most likely yes
I can't see any form of Term that states that I may not use the DBL Emoticons:
and 
But I will check with Oliy just to be sure
use them
ok.. 😃
hi in discord.js, does anyone know how to make a status command. so it changes the status of the bot/
Read the docs
it's very easy
ye
but
im a nub
lol
<botdingus>.user.setGame
That's why the docs are there.
Then learn how to code in javascript
read the docs to learn it then
No, but I want a command like ';status', to change the status of the bot.
; - ;
Yes
then learn js
would it ble like
oh
Ik how you can do that
oo
dm me
😉
Please don't encourage spoonfeeding
is this an official discord server
like discord feedback, etc
nope
k
hi
if (msg === prefix + "SETGAME") {
const sayMessage = args.join(" ");
bot.user.setGame(sayMessage);
console.log(sayMessage + ` (Requested by ${message.author})`);
}
isn't working
language: discord.js
no errors, or anything. ;-;
theres a lot wrong with that
k
can yo tell me what's wrong? c:
It's not executing the code inside that block, and there's no check to ensure that the message author is you
oof
wait
one sec.
let BotCreator = "382915575971577858";
if(!BotCreator) return;
const sayMessage = args.join(" ");
bot.user.setGame(sayMessage);
console.log(sayMessage + ` (Requested by ${message.author})`);
}
that, solace?
no...
what then
lol
I know it.
no u dont
I don't know, what's wrong with it
Well @earnest phoenix helped me with it
;-;
Please, can ya just help me? c:
I did
I said it's not executing the code in that block
Like help me edit the code.. 😛
and it's not checking to see if the message author is you
and no
Im not coding it for you
that's spoonfeeding
and we dont encourage that here
well
he sent wrong one lol
im stuck af
dont spoonfeed @earnest phoenix
he isnt
lol
uf
You're stuck because you do not know js
and if you get a solution to this
i read the
fucking
forums
lol
you're only going to learn nothing and keep coming back expecting to have code given to you
so would ```if (msg === prefix + "setgame") {
const sayMessage = args.join(" ");
bot.user.setGame(sayMessage);
console.log(sayMessage + ` (Requested by ${message.author})`);
}```
work?
No
-_-
Same issue as before
oof.
depending what ya gonna do
No, that just wont work at all
well kewl
hence the no errors being thrown
Are you actually making an open setgame comamnd
if(command === "setgame") {
const sayMessage = args.join(" ");
client.user.setGame(sayMessage);
console.log(sayMessage + ` (Requested by ${message.author})`);
}
``` would this work then, what ya say?
taht's why I said to make a check @elder rapids
and actually make the code execute properly
That would work depending on how you define command but
there is still no check
open status messages are bad and should not exist
so everyone can use it ik
Dont do that
lol
the command i want to do is:
just do a written status, in the code
so like ';status', and in the code; it knows to set it to a selected one.
;p
well
We know what you want
but we cannot just code it for you
We can help you by pointing out errors
; - ;
so you can fix them
ivee
tried.
I gave you the two errors that you need to fix
just one little bit
pls.
All that you need now is an understanding of javascript and d.js
Which you can gain by learning js and reading d.js docs
I KNOW FUCKING JAVA SCRIPT, SO JUST 🖕
;_;
You do not
he's just trying to help mate
Otherwise you'd know the issue
because I've told you the issue several times
The reason why im like this
ik the issue
is because if I just code it for you
you'll keep coming back to be spoonfed code
and you will keep expecting to be spoonfed
when that is not allowed in this channel
So if you want to fix this issue, take the issues I pointed out, and fix them. They're both extremely simple issues to solve
it's not checking if the author is me; it's not executing the code in that block.
Yes
eheh
Two easy fixes
let author = "382915575971577858";
if(!author) return;
const sayMessage = args.join(" ");
bot.user.setGame(sayMessage);
console.log(sayMessage + ` (Requested by ${message.author})`);
}```
?
no
Both issues still exist there
oof.
i changed it to author
Yes
and thats my user id
That doesnt change anything
in let <dingus> you can have anything it doesn't effect how it works -_-
oh ok
so you need to change other stuff
do u know?
lol
wai
wait
client.on("ready", () => {
client.user.setGame("with my code");
});
client.on("ready", () => {
client.user.setActivity({game: {name: "with my code", type: 0}});
});```
lol
why..
bot.user.setActivity({game: {name: "with my code", type: 0}});
});```
?
the bot.user.setGame is faster...
I'm sure this has already been posted, but gonna do it anyway.
Check this: https://anidiots.guide/
That will work but it would not be a command
Just put that in your ready event
K
Ooo.
K.
hehe
lol i cant be arsed with a command
wait.
bot.users.get("382915575971577858");
const sayMessage = args.join(" ");
bot.user.setGame(sayMessage);
console.log(sayMessage + ` (Requested by ${message.author})`);
}```
no
aw
Where did u get that code from lol
did i fix one of the errors?
no
ugh.
Learn await and async before using them
https://codeburst.io/javascript-es-2017-learn-async-await-by-example-48acc58bad65
https://anidiots.guide
great explanation owo
I at least know how to use google

Guys how do u tag someone with a bot, i tried:
'message.channel.send('@215780447370608640 your a noob, hahahaha.')
<@ID>
OH
@idle mountain
ik
👌
wait do u know what peng means lol
k
oof
You really think an urban dictionary command is a good idea? No offense but the content on that site is 👀
You'd be forced to put the urban command under NSFW
If there was any chance something can slip up
But anyways there should be an API somewhere for it
im pretty sure they have an API @nimble merlin if not officially, then at least unofficially. google a bit.
Anyone mind checking out my python code to make sure the mods wont have a problem with it? It isn't long
This is discord.js.
let guildHighestRole = message.guild.roles.highestRole;
Returns with undefined
Heyo,
How do I make my bot auto send an embed message on server join
I'm using discord.py
@west current wut versions
@nimble merlin Isn't it supposed to be on_server_join() ?
Version*
@west current there is no highestRole from the roles
You'll have to check the positions and find the highest
@nimble merlin What do I do with the server kwarg ?
I did
This is what I have now (just calling an embed with the class/function stuff
server alone is working
why ? It's working perfectly on my other functions
This is what I have on other functions and it's working
I think I'm just missing the way to give the channel destination to post the message
Yeah
I know
Yeah I'll try that
no
But I found the error
The errors comes when a default channel is not defined
I'll try to find a way to work around this
good night friend
rest well 😃
@old glade mate just loop through the channels and look for one that your bot can speak in
and then send the welcome message there
anyone knows how to do a welcome message where in the user gets to choose what channel the welcome message is going to be sent
my best bet is to get the current channel's id
well i want other users to be able to do it in different servers
like the welcomer bot
im using discord.py btw
hmm
store the channel's id in the respective server's id column?
store it in a sqlite database
along with the server id
and put the welcome message in the same row
Could someone please help me make a discord bot i've never made one before and i need help to make one. Thank you
Use google
how do you make your bot leave all guilds its in apart from one (i have its id)? using discord.js stable
Just go through all the guilds and leave if the ID does not match the id you want to not leave
thats what i'm asking tho, how? i'm not that good with javascript really
how do you fix php(7.2) 502 errors nginx
@small solar use a forEach() loop or for loop
I can't get the json from the api
You got an error from server pokeweeb (427229734947127306) in channel general (427229734947127308) caused by TEDD_Tranzit#6243 (314558939696201728)
File "/usr/local/lib/python3.5/dist-packages/discord/ext/commands/core.py", line 62, in wrapped
ret = yield from coro(*args, **kwargs)
File "/root/modules/profile.py", line 458, in upvote
k = await resp.json()
File "/usr/local/lib/python3.5/dist-packages/aiohttp/client_reqrep.py", line 730, in json
headers=self.headers)
ClientResponseError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8'
@uncut slate
?
The app is returning html instead of json
Please don't ping random people for help, anyone who knows will answer
oof
b'<!DOCTYPE html>\n<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->\n<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->\n<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->\n<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->\n<head>\n<title>Access denied | discordbots.org used Cloudflare to restrict access</title>\n<meta charset="UTF-8" />\n<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\n<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />\n<meta name="robots" content="noindex, nofollow" />\n<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1" />\n<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/cf.errors.css" type="text/css" media="screen,projection" />\n<!--[if lt IE 9]><link rel="stylesheet" id=\'cf_styles-ie-css\' href="/cdn-cgi/styles/cf.errors.ie.css" type="text/css" media="screen,projection" /><![endif]-->\n<style type="text/css">body{margin:0;padding:0}</style>\n<!--[if lte IE 9]><script type="text/javascript" src="/cdn-cgi/scripts/jquery.min.js"></script><![endif]-->\n<!--[if gte IE 10]><!--><script type="text/javascript" src="/cdn-cgi/scripts/zepto.min.js"></script><!--<![endif]-->\n<script type="text/javascript" src="/cdn-cgi/scripts/cf.common.js"></script>\n\n</head>\n<body>\n <div id="cf-wrapper">\n <div class="cf-alert cf-alert-error cf-cookie-error" id="cookie-alert" data-translate="enable_cookies">Please enable cookies.</div>\n <div id="cf-error-details" class="cf-error-details-wrapper">\n <div class="cf-wrapper cf-header cf-error-overview">\n <h1>\n <span class="cf-error-type" data-translate="error">Error</span>\n <span class="cf-error-code">1015</span>\n <small class="heading-ray-id">Ray ID: 401fdc01e9a791a0 • 2018-03-27 06:39:21 UTC</small>\n </h1>\n <h2 class="cf-subheadline" data-translate="er'
It's a cloudflare error
is that html? oof
How often do u retrieve votes
Is it a public bot?
How is it poor handling of errors, you dont validate if json is valid
The whole point of ratelimiting is that they dont reply from their server back
It should return a better response like "ratelimit" instead of this long as html code.
True but this should be in some sort of documentation
ur spamming the api
no one is spamming it
I have txt logs of commands with timestamp, happened 11 times in the last hour.
the error?
or commands were ran
its realistic that someone runs 60 commands in an hour
->>>>> ratelimit
I'm going to add a cool down but there should be some sort of documentation of responses from the site. I usually have json checks as well, just ran the code without it to see what the problem is.
why not just cache the response
and just preload all on bot bootup
also #414124730715734068
Depends on how you set it up my fair lad
why would u need it to be called upon command
fetch all voters + have webhook
-> up to date list of voters
i love python it kills you inside
:/
what causes the error with 'pipe' when trying to upload random image? (discord.js)
like; is it image error or something else
by chance could you post said error
well not atm maybe later
Found this from what I sent sometime to someone (node:14688) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'pipe' of undefined (node:14688) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
And
(node:14688) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot read property 'pipe' of undefined
I now I'm missing the owner only bit, but why doesn't this work?
# eval command
@bot.command(pass_context=True, hidden=True)
async def eval(command):
"""Evaluate a command."""
eval({command})
bot.say("{command})
The error I get is ```
File "bot.py", line 215
bot.say("{command})
^
SyntaxError: EOL while scanning string literal
Wait...
I see my mistake.
xd
Works now.
heh
heheh
thats a horrible eval command
How do yall do the image manipulation
Libraries
is ur bot over 2k servers?
no.
is it a music bot?
moderation
then u no need to shard
then how do i host my bot without being online
VPS
That has little to do with sharding
right?
a mean way is heroku 😅
heroku is no
vps cost money and money cost money so
I think you already got the idea what you could change about your first page. In short again what's important: First impression, Short and insightful description, space to breath, layout on different devices. Basically try to sell yourself. I'd suggest you to fix the layout and content first, then I'd think about working on the colors and maybe switching the background image.
Can't say much about your story page. Personally I'd not make a wall of text like that, at least I'm not interested in reading it because there isn't much to look at and the dark grey is a bit depressing. But maybe that's part of the story.
https://s.put.re/c8AKNkN.png let me ask you a question, so this is not a monologue. What do you notice just in that selection of your page "contributors" ?
Ah yeah, thought that's just a bug or WIP. But that's not what I meant.
Nailed it, if you want to learn more about it, take a look at "consistency in design and layout" and "color contrasts".
do you need to shard when the bot has music commands?
Consistency basically only refers to staying consistent with your decisions. Basically you don't want to confuse the viewers eyes by choosing a different alignement.
@sinful lotus no
Your footer also suddenly jumped up, you could make it stick to the bottom 😄
so I dont really need to shard if the vps can handle the load?
But yea, I think that's sufficient for now, might actually be a bit much. But at least you have some points now you can tackle 😄
If you want I can review it after you've made some changes again, because I still have some things I'd change, but that's up to you later.
I'm really not that proficient with actually implementing front end. Software Engineering and UI/UX is more my thing :S
basically sharding isnt that hard as long as the bot is in one file?
one .js file and one .config or json file
Would not say so, still have to figure out how to do my own 😅
Sharding isnt hard with multiple files either lol
and you shouldnt clatch everything in one file anyway
im still learning the module exports for now but I dont quite get the gist of it
thats why I cant right now
@blissful bear Websockets I guess. You could connect to a service (or directly to your bot) through a tunnel and basically stream the updates to your webserver.
thats where it gets quite complicated for me 😂
Well, you only need to keep the tunnel alive, which is like no data traffic except a heartbeat every now and then. Similar to disocrd.
And then when the bot starts playing music you send one little packet with informations about it and the length
when it stops or pauses you send a packet again
no streaming needed actually
welll quick question why putting all stuff on one file is a pain 😂
Perhaps, yeah
@sinful lotus Think about it this way, what if someone else (or you in 2 years) have to look at it again?
@blissful bear Have fun with your project, sounds like a cool idea you've got there. 😃
rofl
Ah, what does it express do you?
Sorry, a paket just arrived and I hat to inspect it 👀
Okay yea, for me it feels like it's actually pretty "dark" and makes the whole page more heavy.
what is a fork on github? i dont get github 👀
What's the best way to make a play music (in voicechannel) command in discord.js?
@quiet bobcat ty
np
@earnest phoenix ytdl-core
Does anyone know how to make my commands case insensetive
Language : Javascript
toLowerCase()
Kek
so
read the docs smh
^
message.content.toLowerCase.content == "ping" ?
is that correct?
language?
and lib
hmm well Idk how to do stuff for specific server yet
oof bye i dont understand python
oof
I use discord.js >:D
but I have a python dingus tho
but right now I am trying to understand ytdl thingy with my slow brain ¯_(ツ)_/¯
message.content.toLowerCase(); does not work
error?
no error
command wont run
when i try to run the command nothing happens
i did var msg = message.content.toLowerCase();
and then msg.content
@nimble merlin there is no such implementation, but you could do it with the add_check
Figured it out
im making a cat command
here is the code
if (msg == prefix + 'cat') {
.get('http://random.cat/meow');
const embed = new Discord.RichEmbed()
.setColor(0x954D23)
.setTitle("Meow 🐱")
.setImage(body.file)
message.channel.send({embed})
}
and the error is
D:\Bot\index.js:77
get('http://random.cat/meow');
^
ReferenceError: get is not defined
at Client.bot.on (D:\Bot\index.js:77:5)
at Client.emit (events.js:180:13)
at MessageCreateHandler.handle (D:\Bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (D:\Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (D:\Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (D:\Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocketClient.internalOnMessage (D:\Bot\node_modules\uws\uws.js:103:17)
at native.client.group.onMessage (D:\Bot\node_modules\uws\uws.js:57:15)
D:\Bot>node .
D:\Bot\index.js:77
.get('http://random.cat/meow');
^
SyntaxError: Unexpected token .
at new Script (vm.js:51:7)
at createScript (vm.js:136:10)
at Object.runInThisContext (vm.js:197:10)
at Module._compile (module.js:613:28)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
at Function.Module.runMain (module.js:690:10)
at startup (bootstrap_node.js:194:16)
@edgy needle u need request or something

does anyone know do i split the prefix and what goes after the prefix?
language : JavaScript
cuz im trying to make a say command
there is startswith
but it wont be of use
hmm just wondering what I can do to observe the rate limit of voting, maybe setTimeout could help?
put the users into an array then every 30 second check those users if they voted ?
then make a set interval command that checks every 30 seconds?
so make a cache then?
yes
is this cache is like creating a map?
yep
one example: https://www.npmjs.com/package/memory-cache
cache.put is where I can put the users for a while?
while they are in pending for checking?
no cache is for caching the api output
for pending user check you'd need something better then memory cache since if the bot is restarted the cache will be deleted
you'd be better with db or sth
and if you want do user checks, if the user has voted, it would be better if you used webhooks
thanks for the tips, ill just look onto those for now
np
@edgy needle did you solve the issue?
Didn't define body
const { body} = await superagent I believe
oof
Yes
how to host bot online ?
meaning?
glitch.com or get a VPS
if you wanna host online ^ oof
I need help with the JS version of the DBL Api, I need help checking if the user has voted or not.
@upper ember from 2500 ye
It's good practice to shard before the required sharding limit
So you know what you're doing
at least in discord.py is recommended to shard so you have cca 2500 servers per shard
so start sharding at 2500
discord allocates servers to a shard with this formula: ```
(guild_id >> 22) % num_shards == shard_id
U must start it earlier or ur fucked considering after 2500 some guilds won't work
^^
def check(reaction, user):
return user == message.author and str(reaction.emoji) == '👍'
```even by copying this example from the rewrite docs it gives me this error
```TypeError: check() missing 1 required positional argument: 'user'```
rewrite or async?
I did mention it's rewrite, tho
sory
interesting I'm also on rewrite and I have this: ```python
def check_r(reaction, user):
return client.user != user and reaction.message.id == msg.id and (
str(reaction.emoji) == '👎' or str(reaction.emoji) == '👍')
And it works for me
what do you have in wait_for?
@supple marlin
?
'add_reaction', check = check, timeout = 30
whole line pls
try: reaction, user = await self.bot.wait_for('add_reaction', check = check, timeout = 30)
not sure if it will work but try
I kinda just realized, I want it to work only on a message the bot asks to add that reaction onto
oke
nothing anyway
better ask in discord.py server
oh hahaha, I'd rather figure out myself than ask them
it's pretty much the same as dapi
how ever you say
@nimble merlin took at this for command cooldowns, it's for rewrite:
can't
rewrite only feature
nevermind
i take it back, you can it's just not in the docs
it's a cooldown for commands
for a message spam filter you should look into on_message event and do a custom check there
if(!dbl.hasVoted(message.author.id)) return message.channel.send("You haven't voted, vote here:\nhttps://discordbots.org/bot/bot_id/vote");
This should work right?
test it and you'll see
has anyone yet tried using animated emojis in embed titles?
how do I use user id as permission instead of roles? (discord.js)
I dont recommend using that endpoint for commands
Or using that method
If people use your commands more than 60 times in a minute you get blocked for an hour @west current
wew
It's kinda dumb
If you bot is... "very active" that means you can't have more than 60 users using the vote cmd per minute
Stop spamming api and handle votes correctly?
Just have an upvote array somewhere in your code
and then update that array every 10 seconds or so
Then make a function to check that array and return a bool
On bot bootup fetch all votes, then webhook updates new voters
And you've solved your upvote issue
I wonder how much CPU, ram and internet that would take
not a lot
Just post stats once every hour
the ratelimit is the same as everything for /bots
If your bot isn't really popular and being added a lot
it shouldn't make a difference if you just post on guild join/leaves
Otherwise you can just post on ready
just post once on your ready event and then you can just update once every restart
yeah same
but it doesnt matter too much
Save timestamp of last update, wait in guild join that x amount has passed?
once every few days, once ever hour, on guild join/leave
it doesnt matter too much
Yeet
-bots @blissful bear
@crystal pier 
!ftn
Just wondering
also #commands @static silo
I was just wondering which bot was yours
Ur buttons are broken on phone btw
lol xd
i've a question to you developers:
my bot is written in java (whit JDA) i need to add a good action logger
that both prints log on stdout and on a file
any suggestion?
(a server side logger)
why a file?
use slf4j for debugging
I do not recommend logging actions though unless in debugging
exactly for debug actually it is not in a so stable state and as is hosted on heroku for now the logs are really volatile
anyone here good with discord.py rewrite branch?
@commands.command()
async def userinfo(self, ctx, user=None):
"""Get info on a user."""
if user==None:
await ctx.send("Please tag a user you want info on")
else:
await ctx.send("`Name: {0}` nickname: {1} `id: {2}` status: {3} `playing: {4}` joined: {5} `top role: {6}`".format(user.name, user.nick, user.id, user.status, user.game, user.joined_at, user.top_role))
this worked before but now its just outputting the error str does not have an attribute name and so on
@commands.command()
async def userinfo(self, ctx, user):
"""Get info on a user.""
await ctx.send("`Name: {0}` nickname: {1} `id: {2}` status: {3} `playing: {4}` joined: {5} `top role: {6}`".format(user.name, user.nick, user.id, user.status, user.game, user.joined_at, user.top_role))
even when i revert it back to this
did you try to console.log(user)
how would i do that and these did work before
it worked before i just dont get why its not working now
ya lol so what your using it too
I helped make it >:)
and i just relized what im missing
async def userinfo(self, ctx, user: discord.Member)
no wonder it kept giving me errors
ok got it working now
how to make things like this in discord.js?
I am talkin about the CPU and ram stuff
@uncut slate Your website is quite delicious 👀
Which one 🤔
I didn't make the Twitchcord website, Baked did
but the overall theme and layout is pretty solid
Appreciate the compliment though :p
-botinfo @buoyant lance
-botinfo Aetheryx
Please include a bot mention
-bots Aetheryx
@fair grail 
@bronze sequoia 
@warm edge 
@tranquil frigate 
-botinfo @tranquil frigate
302864271383986176
Tweetcord
7999
A bot that allows you to interact with Twitter
Eris
t/
34
474 Servers
@uncut slate

@languid dragon 
Invite | Website | GitHub | Support Server
-botinfo @lone nymph
How would I would I reply with a message that contains the id of a mysql row, like http://being-banned.is-no.fun/rpa7n6 I wanna reply with "idcensorbot" where the serverid is, well, the server id
Ik how to ya know, like WHERE serverid = message.guild.id, but everything I've googled to return it into a variable doesn't work
Ik how to use query and all dat, i got a kind of basic knowledge of mysql but, I can't set any results to a variable or stuff like that
Right I found it out
But, does anyone know why tf whenever anyone messages it sends this it????
connection.query('SELECT * FROM censorbot WHERE serverid = ' + message.guild.id, function (err, rows) {
let go = rows[0].idcensorbot;
message.reply(go)
})
}```
It just loops
Regardless of message content
not really
the id won't ever contain user input
but yeah, use prepared statements
won't ever be user input
In the next 24 hours, we will be deprecating the /votes endpoint for bots that currently receive more than 100 votes per month. where do I start for making a webhook url 👀
a webserver
let go = rows[0].censor
console.log(go)
})
if(go == "0") return:
codeblahblah
Why whenever I do this it ALWAYS crashes with go undefined
But when I dont do if(go == "0") return; it console.logs the 0/1 perfectly fine
if(!dbl.hasVoted(message.author.id)) return message.channel.send("You haven't voted, vote here:\nhttps://discordbots.org/bot/368158704794861571/vote");```
This shit isn't working, it's not checking if the user has voted or not
Announcement messages 🙄
how would i stop my bot from responding to the built in help command when called from other bots? discord.py rewrite branch
i blocked it on all commands i added but since i did not do the help command how would i do it?
So, I got a webserver but it's a seperate process from my bot. I'm thinking about using that for webhooks. How do you guys handle your response from webhooks?
i mean
I'm using flask
i just make a POST-only route that gets the data then does stuff with it
i can help you if you want
I can set up a post-only url
yeah
It's just about getting the response and sending the data that's in a seperate process.
make sure to import response from flask
then in the route
response.values is a dict containing the data
Ok, I can do that but that's not really my problem
I do this in my main file: ```async def on_message(message):
if user_check(message):
await bot.process_commands(message)
def user_check(message):
if message.author.bot:
return False``` @loud bear
ok that has nothing to do with your webhook
the webhook has absolutely nothing to do with your bot's code
I need to send the response "Hey, enjoy the coins" but it's two seperate processes.
IPC?
inter process communication
Oh good, that sounds like work.
why would you need to send that response?
To let people know they got the coins from upvoting
on webhook received -> send to bot via ipc -> add coins and send DM
The problem is, I have never messed with an IPC or understands how it works.
I'll google it, not sure what it is though.
So, when the webhook does send information to my server, I can make it only receive the bot votes from that day, if I want ofc. Will it reset on a daily basis aswell and turn it back into an empty list?
If so, couldn't I save the list (split() ofc) into a .txt file and read it upon command!?
I can make it only receive the bot votes from that day, if I want ofc.
you don't choose what you receive
How would I specify query on webhooks if I don't post the url.
How would I specify query on webhooks if I don't post the url.
brb
shh
Hi, i have a problem :/ Can someone help me please?
Idk what is the error... and how to fix it
And how i fix it?
define a variable named config
Find out why its null
^
uhm...
@inner jewel I know what a query is but how do I specify the query or url if I'm on the receiving end?
you receive the quey strings on the vote page
you can give users an url with query params
ah ok
@floral stone thanks that helped though i had to do this insted
@bot.event
async def on_message(message):
if user_check(message):
await bot.process_commands(message)
def user_check(message):
if message.author.bot:
return False
else:
return True```
If i did not it just ignored me
you don't need the else statement
@bot.event
async def on_message(message):
if user_check(message):
await bot.process_commands(message)
def user_check(message):
if message.author.bot:
return False
return True```
I use else in those cases anyways because it makes sense to me 🤷
Just my 2c to that
why return false/true if message.author.bot is already a boolean
also ^
True
return not message.author.bot would be better
it will only process the command if the statement is True
oh
yeah
I had other statements in my original code
oof
wait just relized the code messed up ill fix it
because return message.author.bot will return True making it only for bot
return message.author.bot if False
nvm
might work
lol
i tried it without the else and it ignored bots and me
if user is not a bot then process command
so i tried with the else and it works and ignore bots
return not message.author.bot
its only 2 extra lines of code no biggie lol
Its good practice though
theres a lot of else statements in my code espically in the action commands so the user cant use the commands without the required arguments
lol
Well yea but thats a different scenario
^
lol how have i not impamented code to block users from tagging themselves for action commands
how would i make it give an error if a bot is tagged in an action command?
would it be user==user.bot or something
Anyone have any idea how I'd go about setting up a webhook (like to listen for DBL votes) in C#?
HttpServer
alright thanks
I'm using EmbedIO as a rest handler for my own api and the vote webhooks. It's just routing middleware for the HttpListener
is this not what im supposed to put in here.........
@commands.command()
async def kiss(self, ctx, user: discord.Member =None):
if user==None:
await ctx.send("Please say user you want to kiss")
else:
if user==ctx.message.author:
ctx.send("You can not use this action command on yourself")
else:
ctx.send("{} kissed <@{}>".format(ctx.message.author.mention, user.id))
when i forget that user is user: discord.Member =None and just put user=None oof XD
thats kind of important XD
hmm seems to work without a tag as well
and with id
and ya webhook test not working for me ether
webhook is just dbl sending a post request to your webserver every time somebody votes
i clicked the test button on the website and nothing happened
how do you have it set up
using a discord webhook like in devin's pic
you have to set up a webserver
it doesnt work for discord webhooks
Its not sending messages to channel, its so you can receive new votes on your end
I have the strangest thing occurring, so in chrome, and firefox it appears like the image on the left. Except for some reason, in guest chrome, it decides that it will go weird and not obey what I set.
Same on edge
https://discordbots.org/bot/380598116488970261
<style>
h1 {
font-size: 50px;
}
iframe {
display: none !important;
width: 0px !important;
height: 0px !important;
}
#menu,
#cmd-zone-01,
#botprofileicon {
display: none !important;
height: 0px;
}
#bot-details-page {
padding-top: 1px !important;
}
</style>
<body bgcolor="71BC78">
<h1>Kern Bot</h1>
Kern bot has features including YouTube® search, Trivia, Contests (semi-working), dictionaries, and other miscellaneous functions.
</body>```
WHY CANT I INSTALL ANY PACKAGES? I get this error:
npm ERR! path C:\Users\Dylan\Desktop\lmaobotdev\node_modules\async-limiter
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Dylan\Desktop\lmaobotdev\node_modules\async-limiter' -> 'C:\Users\Dylan\Desktop\lmaobotdev\node_modules\.async-limiter.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Dylan\AppData\Roaming\npm-cache\_logs\2018-03-28T07_36_32_078Z-debug.log```
I've reinstalled nodejs, made a whole new bot and it still won't work. if I go to node_modules to rename the folder there is nothing inside, it deletes everything... anyone got any ideas how to fix it?
nop
u need help with anything still?
nope all g
ok 👍
How to send a certain object in the console from JSON?
JSON
{
"appName": "App",
"appId": "00001"
}```
**Console**
App
00001```
Node.JS
Im using the npm google-play-scraper package.
And trying to get it work.
in python it's something like json["appID"]
yeah but I need JavaScript
it's the same thing
how do u. . . change timestamp to date? in js. . . i forgot
eh
use something else
use the
date
new Date() makes a new date :S
🤦 i have a timestamp of some numbers. . .
and i want the numbers to date
1489133256000 as an example
yes timestamp is numbers but there's another thing
like normal people understands dat
for example message.author.createdAt
ik
hmm
well
but if you execute the code in var gg it sends out json if you add .then(console.log);...
@floral stone
Hi, I want to do a gift to a friend, this gift is a code line but i dont know how to do what i want (sorry for my English, i'm french)
Do you know if it is possible to do a anti-spam not obvious.
Example :
First messages at 08:31 and 10 second
Second message at 08:31 and 12 second
Third message at 08:31 ams 14 second
BOT : - Bip! You sent message to fast, calm down
please specify your laungage and library
But, if after my second message, i waif 5 second, the spam is reset and i have no warn. Like this
Second message af 08:31 and 12 second
Third messahe at 08:31 and 17 second
do u know any coding languages?
Who? Me?
ya
No 😅 i ask to a other friend and he answer me that is it a system of point... and that for each message the average of the points would be increased, if we exceed the limit we are warned, and if we wait the system of point returns to zero
(i use google translate, have mercy D:)
Do you understand what i mean?
- why cant u just have a delay of 10 seconds for the gaining points
- If it is a discord bot what libary are you using and what coding language is it
- i think ur trying to make a point system bot like Mee6?
The language is javascript i think, with node
Wait... i reformulate my question
Do you understand what i mean when i say that :
for each message sent in less than 5 seconds, a pointing system is "+1", if this pointing system exceeds 3, we have a warning. But if we wait more than 5 seconds between each message, the pointing system always remains at 1
Idk what is the point system of mee6
Wait... i go check
Oh... no, isn't for level, is it an anti-spam
@earnest phoenix
oof i understand wat ur trying to do but i cant spoon feed people code
i cant spoonfeed code aka i cant give u the code
Oh... because you dont know how to do it?
i know but read the rules we are not allowed to give code :/
Fine
@lethal sun Send me a url of the code in repl
But can you just tell me how I should formulate what i want?
Or better, some clues?
For search on google, isn't for my code... but for a gift to a friend code so...
If you are new to coding I don't recommend writing a more or less advanced bot
You can do it of course, but people won't just "give you the code", because you don't learn anything from it
give a man a fish and he will have food for a day, teach a man how to fish and he will have food for the rest of his life
preach
what does ... mean in javascript?
ie; ...args
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
How do you guys set up your create-react-app in production
module.exports = {
client.on("messageDelete", (message) => {
let guild = require('./guilds/' + message.guild.id + '.json')
let deleteembed = {embed: {
color: 0xFFA500,
author: {
name: message.author.name,
icon_url: message.author.avatarURL
},
title: ":scissors: Message deleted",
fields: [{
name: ":bust_in_silhouette: User",
value: message.author.tag + ' **['+message.author.id+']**'
},
{
name: ":notepad_spiral: Message content",
value: message.content
},
{
name: ":bookmark_tabs: Channel",
value: message.channel.name + ' **[' + message.channel.id + ']**',
inline: true
},
{
name: ":id: ID",
value: message.id,
inline: true
}
],
timestamp: new Date()
}
};
}```
if i use an external file for each of my events, will this work?
formulas in json?
?
u dont define client
but if i define it in my main file, and then import this?
you have to pass the variable
?
client isn't defined in that context
everything in ur main file doesn't get moved to the other file
no
@uncut slate okay so how is having a cluster not the same as adding more servers
Think about it like this: seperate file, different variables
in my main file, i define client and then import the module
still wont work
As far as im aware, clustering just launches more processes
ok
Similar to adding more servers on which you can run multiple processes if one server is overworked
something like this
// Main.js
const client = new Discord.Client(...);
const externalModule = require('./some-module.js');
externalModule(client);
// some-module.js
module.exports = (client) => client.on('event', () => { ... });
ok
@meager lintel It should have a build option for production
or are you asking how other people do it?
@terse badger only difference being that adding a cluster needs effectively nothing and buying a server means buying server
You can set it up a few different ways
depending on what you use
do you use Redux at all?
Feel like a better language should be considered if theres performance issues with the api
If it's a one pager, just running the static files from a server would be fine
if you want routes, like a traditional website with multiple pages, something like React Router would be a good option
@terse badger that's your opinion, and there's a reason why we don't follow it
if you still think you're right and you want to be proven wrong, I would suggest Google
I have React Router set up the project with the npm run and I built the production copy
WhY dOeS nEtFlIx UsE nOdE
idk
because its the future
because they can
no u
Because they can afford the costs @bitter sundial
kinda shitpost kinda not
but um, how is this saying unexpected ; ? js fs.writeFile('.guilds/'+guild.id+'.json', JSON.stringify(defaultsettings), (err) => { // throws an error, you could also catch it here };
The docs mention to use serve or an express server
If you can afford to throw more servers etc at the problem /shrug
afaik I believe it runs an express server
?
Else, an inherently concurrent language will give you a much wider margin of security re. performance
lemme check on that, Pyro
Every ( needs a matching )
If u cant find issue, back to learning js syntax
bois ya know the os.cpus and stuff in discord.js, but how do I make it show in GB?
by converting bytes to gb
How would I make a restart command for my bot in discord.py, similar to reload but for the actual program?
So I don't need to kill the process every update.
im trying to make a say command but it wont work
command:
if (msg.startsWith == prefix + "say") {
message.delete()
const embed = new Discord.RichEmbed()
.setColor(0x954D23)
.setDescription(message.author.username + " says: " + args.join(" "));
message.channel.send({embed})
}
Language : JavaSript
ooh
you could make
@edgy needle start by googling "javascript startswith"
const sayMessage = args.join(" ");
works tho

Yes you do
i use it for my other cmds
Okay keep going then 👌
@meager lintel You can grab the build folder and serve it from wherever you want
you are comparing a function against a string
up to you mate
var msg = message.content.toLowerCase()
but it must be working 
I personally just wrote my own webpacking and such and built files and serve it from express
thats why i use msg so my cmds are case insensetive
if(command === "say") {
if(!message.member.roles.some(r=>["bot-admin"].includes(r.name)) )
return;
const sayMessage = args.join(" ");
message.delete().catch(O_o=>{});
message.channel.send(sayMessage);
}
``` this is hew I have
or had
does it still work tho?
how do I make a command for a specific user only? 
Javascript?
well I use discord.js :S
i think it is
do you want by id or by permission?
We cant help you if you dont listen to us
@edgy needle run this javascript code anywhere and you will see why you are wrong:
"potato 123".startsWith == "potato" ? "right" : "wrong";
startsWith is a function
exactly
no but it isnt wrong!!!
@karmic parcel Alright thanks
he asks before why it sint working when hes comparing to a function
it works everywhere else!!!
I tell him to google startswith 🤦
this works fine if (msg.startsWith(prefix + 'purge')) {
Yes now compare it to the new code
yes, that is different to what you gave us earlier
you should probably check if the message starts with a prefix, then split the rest by spaces
otherwise, msg.startsWith(prefix + "say") will return true for a message like !sayt4lcuiscm,zsjkdf
so you probably want a space there
its not about whether the code inside the command works, but just command checking that makes sense. you should probably not accept !sayskjfhskdjhf, only !say something
and I noticed in your code earlier, you already have your message split by space, so why even use startswith?
const sayP = args.join(" ").split("|");
message.channel.send(sayP)
};
just check if args[0] or whatever is your command is == say
Try this




