#development
1 messages · Page 568 of 1
need to account for everyone of these | 0 | None |
| 1 << 0 | Discord Employee |
| 1 << 1 | Discord Partner |
| 1 << 2 | HypeSquad Events |
| 1 << 3 | Bug Hunter |
| 1 << 6 | House Bravery |
| 1 << 7 | House Brilliance |
| 1 << 8 | House Balance |
| 1 << 9 | Early Supporter |
const house = houses[flags & HS_HOUSE_MASK]
you dont understand how bitwise works... do you?
nope
so i did that insane function for nothing
| 1 << 6 | House Bravery |
| 1 << 7 | House Brilliance |
| 1 << 8 | House Balance |
not really
mhm
oh well, it was an interesting challenge
mhm
@quartz kindle server's back up for my bot
LOl
its a small ass bot
hmmh
const houses = {
[1 << 6]: "bravery",
[1 << 7]: "brilliance",
[1 << 8]: "balance"
}
const HS_HOUSE_MASK = (1 << 6) | (1 << 7) | (1 << 8)
const house = houses[flags & HS_HOUSE_MASK]```
ima cat
using a brute forcing method that involves thousands of iterations to find a bitwise value
ok
why? because we can
but seriously, pls learn bitwise
i will
hmmm
..
what path
For my file
I'm having a deadass brainfarts.
a path is a way to a file, the location of the file
for example C:/windows/system32
thats a path
how do i find it?
My desktop!
which operating system?
node.js
dumb question, but how do I detect if someone votes on my bot so that it automatically gives the person 300 credits
use dbl's webhooks
never used webhooks befofe
you're using node.js?
yup
if you install the dblapi
it creates a webserver for you on port 5000 or something
then in your bot's edit page, you put the url where your webserver can be accessed
for example, your bot's ip address on port 5000
or whatever works for your specific configuration/host
o
how do i download modules?
hm
i give up. it's just not working anymore now
are you logging in
trying
show the line where you connect, minus the token
nice commands
also, not a good idea to create multiple event listeners for the same event
you leaked your token
token isn't there
also, nice project name
this is where the token is, but covered
thats a syntax error

How to count the servers that my bot is in
What lib?
when you ask a question here you say the library
But i totally var tifalbot = new Commando.Client(); not var client
I dont use commando
Commando.Client is the Commands client for discord.js
Still have no idea what that is
If your using discord.js the process should be the same tho, no?
Does it help with command making or something?
It isnt better than module.exports is it?
no
it gives you a framework to work with, meaning it handles a lot of things for you that otherwise you would need to do by yourself
that's on the new logs.
those are all the commands it wanted me to add, 300 characters...
wtf
I just posted a link of the commands but I needed 300 characters.
Very readable
Wait
Looks like the nested ternary functions you find in my javascript code
no ur not supposed to paste the help command 

Talk about your bot instead of listing the same thing they can find in your bot's website or in a help command
ur the one making yourself look like someone should facepalm at you
^
oh hey
we should be the one making the facepalm
whats "violent"
Ok don't go #memes-and-media
vi·o·lentDictionary result for violent
/ˈvī(ə)lənt/Submit
adjective
using or involving physical force intended to hurt, damage, or kill someone or something.
Well what you told us doesnt really help us solve your problem
explain how its physical
¯_(ツ)_/¯
its fine to put a list of commands in the description, just please format it correctly lol
and html
^ yeah but isn't it lazy to do it tho
The thing is, how am I supposed to do that, redo a whole 300+ commands?
and just type them out?
I'd much rather wanna see basic info about the bot and the history behind it rather than a database of its commands
Do you happen to have it in json format?
It's basically nadeko if you think about it.
i know
Dont know or care what that is
but I added more things to it.
What language?
^
"a bot with over 300 commands that are too long to write about and im also too lazy to do that so just use the help command instead"
Im pretty sure mine is just a table with the commands, where to find the support server and a more long brief description 
It's a description, not a list of commands
it's not being lazy bruh, it's about typing a bot that has a lot of commands down, I don't know how you guys do it.
Don't write the commands @copper socket
300 characters.
i did a long ass description of my commands, documentation style
300 characters is nothing
wouldn't it be possible to add a file with all those commands for that help command to pull?
Talk about the bot
because my commands are complicated
Yep, 300 characters is a hugely insignificant amount of characters
you probably typed 300 characters in a message already
🤦
It's clearly a brief description (think of it like a tagline or slogan) @copper socket
it would be a decently long message but atleast its not an essay
why dont you check random bot pages to inspire yourself?
^

Just not the ones from the "New Bots" section
this is why we can't have nice things lmaoo
check a few certified bots
Yeah like @quartz kindle's
example of a short description https://skullbite.is-for.me/i/skqt1vr4.png
this is for my bot
^
10/10
5/7
nO
Lets be honest, no one actually reads the long description, I have everything that they need there (and on its website) yet I still get the dumbest questions in my support server
Most of the time its just because the syntax of the commands is weird and they all come to me saying it doesnt work
but the help command tells them explicitly how to do those commands
With extra help on the "hard" ones
another example except for a long description @copper socket https://skullbite.is-for.me/i/6de9fqkk.png
Mine arent even complicated
my commands have a shit ton of arguments xd
Well yours is an astronomy bot or smth right?
my commands can reach the message limit if people want to
so 2k characters
yup
i wouldnt type that much
i try to keep my commands as idiot proof as possible

Thats another thing tho, people splitting the same command into different parts instead of adding flags or something
half the stuff has defaults and checks for user dumbness
yeah my commands check for dumbness too
like when people mix up arguments for one command into another, it tells them which command those arguments are for
const filter = (response) => { return response.author.id == ctx.msg.author.id; };
const filterSettings = { limit: 1, time: 30000, errors: ['time'] };
const q1 = await channel.send(`What's the name of this project?`);
q1.channel.awaitMessages(filter, filterSettings) .then ... .catch ...
i'm using this to await messages, and i only want 1 message to pass then the .then ... will fire. instead, its waiting the full 30 seconds, then firing the .catch with the message sent. how do i fix this?
Could it be the return in the filter?
limit isnt a part of collectors i dont believe
Limit 1
then what is it?
Its there for awaitMessages
i need to limit it to 1
kek
i keep getting Error: SQLITE_ERROR: no such table: projects, how do i actually make a table?
there's no documentation on it
Hey
yeah but how do i do that within node 
const sqlite3 = require('sqlite3').verbose();
let db = new sqlite3.Database('../db/sample.db');
db.run('CREATE TABLE langs(name text)');
db.close();
Summary: in this tutorial, you will learn how to insert one or more row into an SQLite table from a Node.js application. To insert data into an SQLite table from a Node.js application, you follow these steps: Open a database connection. Execute an INSERT statement. Close the ...
alright
catch your errors
How?
in promises, either add a .catch(console.error) to promises (usually after the .then if there is anyor wrap your code intry { ... } catch (err} { console.error(err); }` if it's async
can i get someones help? trying to make my first bot, a really simple one but im very lost
uh, thats the thing, i havent learned one yet
i want a bot that can keep track of points that are distributed via command to keep track of money in a RPG server im running. i couldnt find one that fit the need, so i was gonna make my own, but thats proving difficult as well
Let's not get into Discord bots without learning any programmimg language first, aight mate? 
wdym
one sec
right click > open with > notepad/wordpad
show your json file
also, you probably want an an actual code editor, take a look ate notepad++, sublime text, visual studio code, brackets, etc...
@ember fulcrum
also, dont use discord.io
thats a terribly outdated library
whatever guide you're following is bad
lol
ugh why is this so haaaaard
show your files?
i just wanted to make a bean counter bot
i can't help you if you don't show your code
one sec
it isnt working anyway
@ember fulcrum please reset your token
You will mind when your discord account gets banned for API abuse
yes, delete everything and use a proper library, such as discord.js
🤔
it is
but its rest only, no websocket
its good to retrieve information and built a page with it
dont call it shit :( the devs probably spent many months developing it
everything has its uses, restcord can be used to create a bot/website interface
^
ay boiz for some reason heroku used to run but now it dosent .
i didnt even
pass that :d
http://prntscr.com/mhuzug but the bot isnt running 😦
heroku
that's why I took my bot off heroku.
or vps
lol
@restive bough is vultr Linux only?
Daaaammm
you can upload your own iso's
would pycharm be ok for discord bot via python?
yes
what is it
maybe close your function body 
? In english
"bot developer"
I'll regen now

it'll stay the same
?
HOW
bro
Did not work
Yesh
i've learned the hard way yesterday
lol
Glitch is stoopid
don't blame glitch for shitty code?
It's regened btw
without the token itself
Gtg I'll fix it my self -_-
just add a fucking curly brace
Lol
Nah mate
This is like 70% of modern bot devs
Edit button on your bot page -> scroll down
ID, you mean? Are you using webhook?
Oh, it is vote.user, correct
ok
vote.user provides the id
hentaicion lmao
light theme brings some memories back
back when i was a 12 yr old memeing on youtube
we didnt have dark theme back then
Who ever can help with my bot (javascript) dm me i will reward idk how so 
look, mom I'm famous
@earnest phoenix probably the worst place to ask
why
it'll be lost in this channel
xd
whats the problem with your code?
Dm me ill show
no, show it here
you're missing a )
where
here }});
I'm not quite sure if they are just trolling
;? 
my best bet is that line 173 isnt closed properly
how do i close?
Do you even know basic JS
i dont see anything wrong in that part
please learn proper js then
does the token have a comma at the end?
that error is most likely because, again, you msised a comma
send the file without the token
delete the token and post the code
k
then do ctrl+z to get it back
{
"token": "",
"prefix": "-"
}```
gr
its missing a ; after the closing } isnt it?
what is the error anyways?
no clue ^
@dusky steeple its a json file
^ yep
ah nm
you can hover over the red circle and it will show the error
it looks fine
screenshot that
shall i guys?
thats what he did
is the file set as something else in your editor? like its a json file but the program thinks its something else
i cought the same err and it helped me
delete everything and write it again
okay
@earnest phoenix
{"token": "","prefix": "-"}
do like this
i had this err in every bot and it helps me
my version dont work?
nop
what is the error
my config is literally 27 lines long and works fine
the json is perfectly valid, it passes json linters. the problem is with your code editor
you could say it has a... glitch 😏
10/10
lol
in ma first i catch it
{"token":"","clientid":"521776946149851157","prefix":"ш!","ownerID":"282504799897780225"}
```@earnest phoenix
?
why did you put the clientid in the config doe
wat
@restive bough some bots need it
@restive bough for invite link
or that
and? i tryed it on heroku, glitch, own PC host, termux host
putting code in one line is no different to having it spread out
AND EVERYWHERE IT WORKIN
it wont make a single difference
but it fixed my probleb
Unexpected token :
your problem != others problems
I JUST WANT HELP FFS
But why dont it work
its glitch
delete the file
create a new json file
and write the code again
if it still doesnt work, open a support ticket
or get a real code editor
Boi
thats racist
blows up
how do i fix then
not
@quartz kindle can i add you to my glitch and you try fix it?
buy an vps
lol ok
you dm me lol
did
@earnest phoenix just buy an vps lol
@earnest phoenix your problem had nothing to do with config
Ok
is it okay now?
yes
you had this ```js
const log = message => {
console.log([${moment().format("HH:mm:ss")}] ${message})
missing the closing }
oof
also this
const updatePresence = (client) => {
client.user.setPresence({
game: {
name: `Streaming my code to - ${client.guilds.size} Servers | ${config.prefix}help`,
type: "STREAMING",
url: "https://www.twitch.tv/piggyplex"
}
});
missing the closing }
make your project private
i just closed the tab
https://hastebin.com/fuletoyuco - Error:
jsTypeError: Cannot read property 'title' of undefined
results[0] is undefined
)
@mossy vine yes lol
const google = require('google-it');
module.exports.run = async (client,message,args) => {
if (!message.content.startsWith("m!")) return;
if (message.author.bot) return;
if (!message.guild) return;
const input = args.join(' ');
if(input.includes("porn"))return message.reply("No you pervert");
if(input.includes("hentai"))return message.reply("No you pervert");
)
google({ query: input, disableConsole: true }).then(results => {
let gbed = new Discord.RichEmbed()
.setTitle(`Results for ${input}:`)
.setDescription(`${results[0].title}`, `_ _`, true)
.setColor(`${message.member.displayHexColor}`)
.addField('**Link:**', `${results[0].link}`, `_ _`, true)
.addField('**Description:**', `${results[0].snippet}`, `_ _`, true)
message.channel.send({embed: gbed});
}).catch(error => {
if(error)return message.channel.send('``Error:``\n```js'+ error +'```');
});
}
)
module.exports.help = {
name: "google"
}```
I send m!google Yahoo and get error
whatever ur using title on is undefined
@daring trellis results[0] is undefined, which means there were no results
💩
results is []
well
im testing it on runkit
its a google module
there's a better api anyways
SerpApi is a real-time API to access Google search results. We handle the issues of having to rent proxies, solving captchas, and parsing rich structured data for you.
who tf came up with the name "serpapi"
yeah lol
unofficial
to be daddy api UwU
Could someone help me fix this by chance.
https://hastebin.com/arafayivan.xml
the cards are stacking on top of each other and want them side by side 3 wide. Can not figure out wth I am doing wrong.
Is that bootstrap?
is the html being generated correctly? if so, its a css problem, not html
most code ive seen in my life
im stupid af
in everyway
cant even fix a lock command ting
all i had to do
was
ok
}
congrats no one cares
Yes the page shows like its supposed to somewhat. It just stacks the cards instead of putting them in line
check the css for card-block
Is that on mobile?
does it have display:inline-block?
you guys smart af
cause I have another page running the exact card setup and it puts them 3 wide ;/
are the classes the same?
You're iterating on card-columns
Iterate inside it
You're basically creating a new card-columns div for each guild
so put the <div class="card-columns"> before the %>?
Move this after it:
<% bot.guilds.forEach(guild => {
%>
And the closing brackets at the bottom move them as well
woot perfect. Thank you
Anytime
I had a feeling it was something simple I was over looking lol
I fix my code
well done!
Discord.js
I got an error when i execute the info command on my bot
obviously, tifalbot is not defined
The code for the info command is
``const discord = require('discord.js');
const commando = require('discord.js-commando');
class InfoCommand extends commando.Command
{
constructor(client)
{
super(client,{
name: 'info',
group: 'misc',
memberName: 'info',
description: 'Info about the bot'
});
}
async run(message,args)
{
var myInfo = new discord.RichEmbed()
.addField("Name", "NormanBot", true)
.addField("Created by", "Norman Anthony Anderson and his team", true)
.setColor("3FA227")
message.channel.send(myInfo);
}
}
module.exports = InfoCommand``
commando is shit tbh
I use discord.js and discord.js commando
And how am i supposed to make multiple commands without discord.js commando
write your own command handler
I can't. So hard
that's what she said
https://www.emojicode.org/ anyone wanna write a discord lib in this? 
Emojicode is a full-blown programming language consisting of emojis.
no i do not
Emoji coding 🤢 🤢
Writing my own command handler is hard for me
but whats element
Just inspect element
Use your browsers dev tool and find out lol
^
you guys are to real help
You asked a question we answered your question this isn’t a spoonfeed festival. Gotta put some work and research into it yourself
this
Look into css and how to use it if you want to customize things on a website
aye rye
HTML to create elements, js to modify their behavior and css to modify their appearance
does anyone know why my bot oauth url might be taking people to an old redirect url instead of the new one i added? the old one isnt in the URLor anything
When did you add the new one? Old one might still be cached
Why is it giving me the wrong emojis ?
for (var y = 0; y < array.length; y++) {
let DB = Items.findOne({name: array[y]});
let em = "";
if(typeof DB !== 'undefined' && typeof DB.id !== 'undefined'){
em = DB.id;
} else {
em = "477180041361620992";
}
emojisss = "<:a:" + em + ">";
if (emojisss === undefined) {
emojisss = bot.emojis.get("477180041361620992")
}
emojiss += emojisss;
}```
https://gyazo.com/8aa29242230f78ef4f4bfedaa20f7dc7
Theres a missing emoji in the top message but it dosent seem to output "477180041361620992" or i dont understand XD
probably 1hr ago or less
What am I doing wrong here?
Server ID: <%= guild.id %> | <%= `${guild.size}` %>
and outputs this:
what kind of size do you want ? @dusky steeple
I tried it without the ${} stuff also
bot.guilds.size
hello
guild.members.size
count of members in the guild
@dusky steeple guild.members.size
memberCount*
Cannot read property 'size' of undefined
Which lib are you even using
discord.js express
guild.memberCount returns nothing
How to fix error on heroku: Your account has reached its concurrent builds limit?
)
the error tells you what's wrong in plain english, don't have more concurrent builds than you're allowed to have
how do poeple have boucing icons in their site
bouncing icons?
...
css keyframe animations
Wait you can do that in css?
I thought it was js
Web Publishing never taught me anything useful
you can use either
css can do animations, but its limited to either transitions or loops
and if you combine css animations with svg, you can pretty much achieve animated vector graphics
can someone tell me why i cant console.log a Map properly?
var cache = new Map()
//code that adds a bunch of stuff to cache
console.log(require('util').inspect(cache, {depth: 2}))```
whats the output you get?
works for me
> map = new Map()
Map {}
> map.set("a", 1)
Map { 'a' => 1 }
> map.set("b", map)
Map { 'a' => 1, 'b' => [Circular] }
> console.log(require("util").inspect(map, {depth: 10000}))
Map { 'a' => 1, 'b' => [Circular] }```
its just Map {} even though i add a bunch of stuff to it
show the code you used to add items
fs.readdir('./src/commands', (err, f) => {
f.forEach(e => {
let cmd = e.split('.')[0]
let tmp = require(`./src/commands/${e}`)
//the default
cache.set(cmd, tmp)
//the aliases
for(let i = 0; i <= tmp.config.aliases.length-1; i++){
cache.set(tmp.config.aliases[i], tmp)
}
})
})```
f, cmd and tmp are all working as intented
check if f is empty
use a debugger
ohh it is?
so your console.log should be at the end of the forEach block
that's why it takes a callback
so correct way to do this would be to put the log in a .then() after it or?
you can just put it after the foreach
so
fs.readdir(){
...
}.then(console.log(...))```?
no
oh
unless you use promisify
uhh no i dont think im using it
just do js f.forEach(....) console.log
and then it should work, right?
yes
but how can i make it so that stuff comes after the readdir is complete?
either write them inside the readdir callback, or create a promise
or use readdirsync
readdirsync does a promise?
👍
Hey, so I'm trying to get voice connection size. I read the documentation for discord.js since it's what I'm using to write my bot in, and it shows; <Client>.broadcasts which returns as an array of connections. I'm unsure if I need to use .length or .size to get the voice connections as an integer.
Oh, alright. Thank you very much, sorry if I ask basic questions, I'm not good at trying to get integers from stuff like that. (:
any good website devs to help me?
TypeError: Cannot read property 'id' of undefined
on website
i tried to link currency to the website
app.get('/', function(req, res) {
cookie.fetchCookies(`globalCredits_${req.author.id}`).then(pb => {
res.render(__dirname+'/views/index.ejs', {
status: (req.isAuthenticated() ? ` ${req.user.username} | ${pb.value} ` : "Login"),
client: client.user,
user: req.user,
login: (req.isAuthenticated() ? "yes" : 'no'),
});
})
});```
did you attach the author property to req?
because i can tell you that req doesnt have an author
i dont think i did
alright
so how will i attach author to req?
what i usally use on embed text not website
is user.id
user iis defiend to message.author
user.username is from oauth2
then you can't attach it
Why not just req.user.toString() for mentioning tho 
hi
@amber fractal because it isnt discord.js
toString would do nothing
What is the language?
cookie.fetchCookies(`globalCredits_${req.user.id}`).then(pb => {```
what i have
that gives error
Everyone loves WebHooks...
nvm fixed
ty
@sick cloud
anyways
forgot
about CheckAuth
😂
👏
have one more problem i need help with
like disable a page
for everyone
upset for me
like a admin panel
there are many ways to do that
you need to make the page check for ownerID
in dashboard.js
send request using an authorization header with the session
or index.ejs
if(req.user.id === "259743772366077972")) {
you have your ownerID in your config file?
yea
make it read that. If the id matches show the link or page
<% if(user.id === bot.config.ownerID) { %> for instance how I do my admin page on my dashboard
are you already using oauth2?
so you can just check if the logged in user is the same id as the bot owner
<a class="dropdown-item" href="/">Dashboard</a>
<a class="dropdown-item" href="/logout">Sign Out</a>
<a class="dropdown-item" href="/admin">Admin</a>
it just shows up white
tho
you can made the admin item appear only if the logged in user is the same as the owner
if they are not appearing, check your ejs tag
< % if(req.user.id === owners_id) { %>
ejs has two tags, <%= and <%-
ah
<% doesnt return anything
it does on my dashboard
<%=f(req.user.id === owners_id) {>
<% if(user.id === bot.config.ownerID) { %>
<a class="dropdown-item" href="/admin"><i class="far fa-user-secret"></i> Admin</a>
<% } %>``` this is how mine is set up and works 🤔
hm
because you're writing the raw html, not outputting it
ah yea duh lol
@earnest phoenix you only need <%- for the actual output, not the if
only in the line that returns the admin item
or you can put it all in one line
SyntaxError: Unexpected token catch in /app/website/views/index.ejs while compiling ejs
tf
xD
so
how do you just add to a permission overwrites array on a text channel without deleting others
i tried edit but it just wipes them all
<%- if(user.id === bot.config.ownerID) { '<a class="dropdown-item" href="/admin">Admin</a>' } %>``` try this
begining of code?
<div class="dropdown show">
<a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Options
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<a class="dropdown-item" href="/">Dashboard</a>
<a class="dropdown-item" href="/logout">Sign Out</a>
<a class="dropdown-item" href="/admin">Admin</a>
@sick cloud have you tried using .overwritePermissions()
uhh no
i justwanna myself use panel
is that in master?
no, in stable
whats its master equiv then 
let me check
createOverwrite?
not working
SyntaxError: Unexpected token if in /app/website/views/index.ejs while compiling ejs
The error explains it to you
iirc to remove just set it as null
oh okay


