#development
1 messages · Page 459 of 1
not necessarily
you should await the coll.update and then return that
iirc, the cloud function docs reccomend that you return a promise from the function or smth
you can do a promise inside a promise catch - or you can use async and use await - essentially doing the same thing
if i await it, it does the same thing btw willi
@fluid basin yeah, in the hastebin link
because I dont wanna have to setup and deploy a server specificly to handle the incoming webhooks lmao
hmm
Can you do me 1 thing
Log client after you awaited the mongo conn
@hushed berry
leveldb js, does this look right? I don't want to break my db just yet :p
const level = require('level')
const db = level('./db', { valueEncoding: 'json' })
db.put('key', 'value');
function dbHas(key){
db.get(key, function (err, value) {
if (err) {
if (err.notFound) {
return false
}
return false
}
return true
})
}
console.log(dbHas('key'))
how do i create bots
oof
@lapis robin learn coding
lol
i will suggest you js @lapis robin
Welcome back to my guide, helping you create a Discord Bot using the amazing Discord.js library I hope you follow along and create your very own bot! If I go...
Watch that
ok
^ That too :p but the Discord bot part is in the video, as long as you can understand the programming it's helpful
Nothing too complicated either way
what i was thinking tocode was this
UwU
Wait there is one more thing u forgot
GITHUB yas
Oh i get it now this is the same with scripting in roblox
xD alrighty
xd
npm ERR! canvas@1.6.11 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the canvas@1.6.11 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Any idea on how to fix this. I've searched around and I can't seem to get it fixed.
do you have the build tools installed?
nope
what OS are you on
Windows 10
👍

It say my bot is waiting for approval ?
@tall halo
yup

Is a 20c bribe acceptable?
😅 😅

Anyways in the meanwhile you could try to ensure your bot is functioning correctly and online, also that it doesn't break any rules of Discord or the server

I guess you'll just need to wait then

var connection = null;
client.r.connect( {host: 'localhost', port: 20815}, function(err, conn) {
if (err) throw err;
connection = conn;
})```
Ok so I have no idea whatsoever as to what i can do here.
I'm currently running on glitch and I want to get this rethink db working. Problem is, of course since this isn't hosted on my computer, localhost doesn't work.
I don't think glitch supports running rethinkDB server
Not 100% sure on that but it is highly the case but still if its possible it'll be really hard to setup
Well hopefully I can get rid of this hosting situation soon...right now it's great because if the bot goes offline (which is pretty uncommon now) people can start it up by going to a short link to the project
You do know that you can keep it always online by just letting the bot visit that link
What, with glitch?
yup
https://anidiotsguide_old.gitbooks.io/discord-js-bot-guide/content/other-guides/hosting-on-glitchcom.html
Under "Keeping the project 'alive'"
Yeah I have pings setup, just earlier got it setup from the external source. The bot would go offline every few days or so beforehand (maybe it won't now)
That's the main reason I like glitch
let num = 37
for(let i=0;i<num;i++){
//your code
}```This will loop `//your code` 37 times
wow
If it has a queue, just add it to the queue multiple times.
Idk haha
A issue
My brain is fixed on JS and I forget this server supports everythang
I made a request for my bot
@livid whale dont ask
they
add
1 month
on the waiting time
@visual surge not an issue
@livid whale just 3 to 4 days and you will be all set
^at most, usually quicker
^
var num = 7
for x in range(num):
yourCode
I'm extremely unfamiliar with python but I mean, that should work as a loop I guess xD
when a user executes loop <number>, basically just loop the request command over and over, it'll add it to the queue. That is, if your bot does have a queue.
that's a messy way, but it should work (I don't recommend keeping it this way if you end up doing it like this.)
i dont want to do it like this
i want the song to be looped for as many times as the user inputs
and then it plays the song for that many times and if someone puts something to the queue it breaks the loops
or untill the loop is finsihed
idk python enough to explain it, really. Plus I don't know how your bot works lol
Why not just check if the song is finished then do your stuff after?
hey
just a python question
please dm me if you know about tkinter
the code is quite long
i will delete this message when somebody dms me
@serene plover wouldnt change match
is there a way to check if the input is an id in d.js?
wdym?
like if argument 1 is an id continue, else return
what I do in discord.py is attempt to get the object with the given id, if discord didn't return anything then it's not an id of that object type
hm, that might work
but that might not always work on specific occasions
for example, an id of that server might exist, but your bot will not return it if the bot is not in that server
what im doing is im making a settings command, where i want them to specify which role that is the mute role, but then i have to make sure that that argument is a role on the server, might be other ways to do that then to check for id...
idk if discord.js has that, but there's a way to get an object from a given iterator, and the same logic applies here wether it returns an object or nothing at all
i need helpin
makin
somethin
called
loopin
for a musicin bot causein people askin me to make it
you need help making a loop?
yeah
what language?
np brother
?
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
what i need to change the 'password'
Um guys
when you do
\:seven: discord doesn't turn it into it's unicode emoji
\7⃣
\6⃣
\5⃣
\🔟
it works with 10 though
\:customemoji: shows how you would format it in code
for example, \:tickYes:
i don't know if you already knew that, but...
/7⃣
app.post("/me", checkAuth, (req, res) => {
usersDB.get(`SELECT * FROM users WHERE id = ?`, [req.user.id], (err, row) => {
if (err) {
return console.error(err.message);
}
if (!row) {
usersDB.run(`INSERT INTO users(id, title, bio) VALUES(?, ?, ?)`, [req.user.id, req.body.title, req.body.bio], function(err) {
if (err) {
return console.log(err.message);
}
});
} else {
usersDB.run(`UPDATE users SET title = ?, bio = ? WHERE id =? `, [req.body.title, req.body.bio, req.user.id], function(err) {
if (err) {
return console.error(err.message);
}
});
}
});
res.redirect("/me");
});
<%- include('blocks/header', {bot, user, path}) %>
<div class="container">
<div class="container">
<div class="row justify-content-md-center">
<div class="col col-10"><h3>Your profile</h3>
</div>
</div>
</div>
<form method="post">
<label for="title">Title</label><br />
<textarea name="title" cols="30" rows="2"><%= userTitle %></textarea><br />
<label for="bio">Bio</label><br />
<textarea name="bio" cols="30" rows="2"><%= userBio %></textarea><br />
<button type="submit" class="btn btn-primary">Save Changes <i class="fa fa-fw fa-save" aria-hidden="true"></i></button>
</form>
<br>
<h6><strong>Your exp:</strong> <%= userExp %></h6>
<h6><strong>Your level:</strong> <%= userLevel %></h6>
<h6><strong>Your rank:</strong> <%= userRank %></h6>
<% include ./blocks/footer %>
help here 
checkAuth might be returning false
it doesn't
hi
Putting /me in the URL means it's a get

What is the legacy bool in the DBL /bots endpoint responses?
Bot pages were given a massive rework some time ago, I believe the legacy parameter is for bots that were still on the old schema (which there are none of anymore)
client.on('messageUpdate', Message => {
let serverid = Message.guild.id;
client.serverlogMessageEdited(serverid, Message.before.content, Message.after.content, Message.after.author, Message.after.channel, Message.after.id);
})
a little help in here
There’s 2 params, oldmessage and newmesaage
client.on('messageUpdate', before, after => {
let serverid = Message.guild.id;
client.serverlogMessageEdited(serverid, before.content, after.content, after.author, after.channel, after.id);
})
is that ok?
Yeah I think
Try it
inb4 Message is not defined
Nono
Its an event
With a callback
wrong syntax
gaaa
can you just show me an example? 
client.on('messageUpdate', before, after => {
let serverid = after.guild.id;
client.serverlogMessageEdited(serverid, before.content, after.content, after.author, after.channel, after.id);
})
I did that
No () is for only 1 param
It’s (before, after) =>
(param1, param2, …, paramN) => expression```
client.on('messageUpdate', (before, after) => {
let serverid = after.guild.id;
client.serverlogMessageEdited(serverid, before.content, after.content, after.author, after.channel, after.id);
})
so like this?
Yes
Whats the code for the kick command?
let member = message.mentions.members.first()
let reason = args.slice(1).join(' ');
if(!reason) reason = "No reason provided";
member.kick(reason)
Oof 'let' is underlined in red
@upper ember Can u help me pls
Ask the question
I asked roy Whats the code for the kick command?
No spoon feeding ree
lib?
no
oh, Imma not a c# developer.. at least not a c# bots developer
@spring ember Can u help?
https://discord.foxbot.me/stable/ @lilac dome
yo, i tried to make custom prefix in js, and use this line in the message event: ```const prefix = ${guildConf[message.guild.id].prefix}
maybe it is because you are using a constant? idk
what should i do then?
that guild.id is undefined? 
no, it says cannot read property id off null
uh, are you using eris 
no, discord.js
then there's something wrong with your message/the error doesn't come from here specifically
actually i guess in dm it would cause this error
but only if you didn't prevented it
I have a question that pertains to discord. js and javascript. I want to get my bot to post an array variable from another file. In total, I have a record. js, an array. js, and the main file included in an "index. html" file. I have the array using the so called "record", what I'm trying to have main do is post a record field in array[1]. It sees where the array's coming from, yet when I try to get it to post a variable, it gives an error of "ReferenceError: TrapList1 is not defined". Could I get pointed in the right direction to look?
uhh. So.... you are trying to access a variable from one process in another one?
Yes. I used VS Code to see if it can see everything, and it all came back positive in the coding. It's the actual calling where I get an error
I am 90% sure that two different javascript files cannot directly access variables from each other. You will probably want to use a database
Use module.exports
well if you make a function in the other file that returns that value and call that function in your file you can
{ Error: Cannot find module '../build/Release/canvas.node'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/root/oliver/node_modules/canvas/lib/bindings.js:3:18)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3) code: 'MODULE_NOT_FOUND' }
``` 
did you put this "canvas.node" thing in the correct place? :p
?
@topaz fjord which file would I have to put one into?
is this for a website or a discord bot?
// file1.js
const func = require('./file2.js');
console.log(func.test());
// will log ['1', '2']
// file2.js
const arr = ['1', '2'];
module.exports.test = function () {
return arr;
}
@sturdy chasm
@topaz fjord Does it even need to be a function?
@quasi hearth this is for a discord bot, but what I'm trying for is neat coding so that, when I want to mess around with it I don't have to cipher through long walls. Basically, the array is to keep a list of traps for D&D use, the record is just for storing it with info
Well it could just be module.exports.test = arr if i remember correctly
thanks, I'll have to try these out later tonight. family just told me their waiting for me to join them to dinner.
For easier purpose you can do module.exports = arr if you dont want to put a .test after the variable you defined the require as
alright, I just made of note of it, thanks
@topaz fjord so I quickly tested what you sent me before I left my house, as well as what everyone else said about module.exports. what you sent works, however it sends it to console instead of to a discord chatroom it received the command from.
Ah, ok. Thanks.
any good api for fornight?
google is good this time of year
i speeled it fortnight opps

On normal python, is there a way to get a random number between 000000 and FFFFFF
random.randint(0, 16777215)
Hexadecimal to decimal converter and how to convert.
how would i check if a role exists with discord.js
just find the role by name
check if the roles collection for the guild or guildmember has a role
if it cant find it not exist
<guild>.roles.has('id')``` would work
thanks
wouldnt getting it by name be better 
oh yeah id is exclusive to guild isnt?
yes
how would i check by name
i dont know
@sick cloud how would i check by name
what do you want to do?
check if a role exists on the server
but doesnt id vary from server to server for each role
but for what purpose?
i need to see if a person has an announce role , if they do they can use a _announce command to announce something to the server
you're better of letting each server setting the role
instead of hardcoding it by name
how would i do that?
a database
so instead of checking if X exists
make a database and a command that the person can use
like setaccouncerrole rolename
and you save the role id
i was kinda trying to avoid data bases at first
if you want to avoid it and use a hardcoded name
which i do
then do something like .roles.find(role => role.name === "yourhardcodedname")
thank you
i havent done that myself so idk if it works
also, are role names case sensitive?
if they are, you should use .toUpperCase()
i was planning on having it create a set of roles at join
or .toLowerCase()
role names are case sensitive
uppercase is better
why
there was several articles about it, i dont really remember, but apparently lowercase can have weird interactions
which apparently they are also outdated, and the best method now is .toLocaleCompare() used in combination with either or them
lmao
its an internationalization problem
some non-english characters in some languages do not have upper/lower case variants and might be converted into something else
Is this just luck or is there something wrong with my code?
I'm going to guess that's a code issue
Ye
that looks fine, unless you're caching command input/output it's just js randomness being fucky
lol
Is there a way to get all the emoji a bot has access to in a collection?
use the api
How would I make my bot leave a server via bot console
bot console?
Yes I can run commands and code in my bot's console
did you properly declare the guild?
let guild = client.guilds.get(<guild id>);
guild.leave()
.then(g => console.log(`Left guild ${g}`))
.catch(console.error);
that should work
id has to be a string
oh yeah
even if I put capital "L"
make the id a string
still unexpected token "l" Xd
where
send the full stacktrace
so, you do need to remove the <>, and are you sure the id is right 
yes I'm sure
that codes looks ok to me tho 
Yes the guild ID is corrent
correct*
I just ran a command in my console
or do I need to put the ID in the "leave()"
okay i feel like im dumb
how do i get the username of a member
its not member.username
(discord.js)
member.user.username?
yes
ok
are you on master?
master?
undefined, which means .get returns undefined
even with capital But that's a valid server
is the bot in the guild you're passing? :p
yes it is
If I go to my console and type inbot.guilds it will show all the guilds, roles, total members, etc. etc.
the server is listed there
are you certain this is the correct snowflake
the id
type the get() part in your console too
really it should work, try let guild = bot.guilds.find(g => g.id === '461273721764577312')
if it works in the console but not in the code, then the problem is the code
Ok so will this work, because I don't want to press enter and then guild will be declared already
put a ; on the end of the find pls
yeah
"g" apparently is not defined
but if I did "guild.leave()" it worked
mkay so the bot isn't on the server anymore, kthx.
guys any opinions regarding choice of database for bots? I don't really know if I should go with mongodb or postgress
rethinkdb
rethinks develoment is kinda dead
for SQL i recommend Postgres, for NoSQL i recommend MongoDB
I'm very tempted to save all guilds configuration in a mongo document
but idk if that will scale
probably not
i mean each guild in a document
if you really want to scae then SQL is the way
if you want easy acess and integration NoSQL it is
bc having multiple collections on a mongodb is a pain
redis can actually be used at large scale
i use it and for example dank memer use it
depends on what do you want to do with it tho
tbh i dont really need it, all i need is eventual copy to disk as i do everything in memory
im using json files currently
could be nice in your case then, redis will write to disk as you insert/delete/edit data
though while it can do that it is quite limited compared to actual databases
yeah but wouldnt that theorically double memory usage? my entire database is loaded into an object on bot startup, using redis would keep 2 copies of the database in memory
or would redis shut down after a write operation?
it won't unless you tell it to, though that would be a quite unorthodox way of using redis
yeah i figured
standard way would be to only use redis as cache
so in my case something like sqlite or leveldb would be better
yeah, as databases they have more options, redis shines as message broker or cache server but not really database
yeah, i could use it to offsource the database to it, but having it as an object inside node is good enough
might be something to consider at a scale where you'll have to separate your bot into multiple processes though
yeah good thought
my bot is not really sharding-ready, but i kinda doubt it will reach that point xD
well that or a database that accepts multiple connections, two options that you can consider before needing to chose one
yeah i like the redis idea for sharding more than handling multiple connections
i'll sleep on it, thx for the inputs
Hey there!
I'm trying to tweak up my ban command for my bot
Will this work
if(!message.member.hasPermission("BAN_MEMBERS"), message.author.id != my ID) return message.channel.send("No can do pal!");
you can't use , in an if statement
oh i actuall never saw people using that over ||
but yea beside that that should work
|| will crash my bot
watch this
Pleb Question: How do I get the package.json file started using command promopt again?
Thanks tony. I knew it had something to do with init
np
Anyone know how to make heroku work???
What do you mean by work?
@obtuse wind
- get ban list
- loop over it and unban every user
idk which lib you use so can't provide docs or code 
@proven surge heroku sucks ass, you're better off actually paying for a vps like digitalocean
yes
heroku is ass
gcloud gud
vultur better
yes
also 
even cheaper
nono
not bakery
its run by some sketch ass dude
i know him from a few servers
i wouldnt trust him with data like that
I know him
I use Bakery
bakery is awesome
he's not sketchy
The guy you need to watch out for is bob the builder
pretty sure he kind of disappeared though
wait TetraByte is owner of bakery right
yeah donut and him colab on it
byte greifed like 2 disc servers now
um what?
What servers?
Who owns that?
uh i think its deleted now
Rip

like things with chrome are blocked usually
how fix
hows
contact support
lmao what
Registrant Email: 3c587cad5cb64eb29f0e6a8309de9fe4.protect@whoisguard.com
Name Server: verify-contact-details.namecheap.com
Name Server: failed-whois-verification.namecheap.com
the whois of my nomain
Yeah I would probably contact support
hey
im making my bot send a list of maps like
1: map1
2: map2
3: map3
4: map4
and only two people are allowed in the chat
im making the bot choose one of the users at random
now what i want the bot to do is alternate voting, like say the two users are user1 and user2. and the one chosen at random is user1 and now only user 1 should be allowed to vote and if he votes now its user2's chance to vote. so if its user1's chance and user2 does a vote he should be told that its user1's chance
Sound like you want to have two async tasks run at the same time, one that checks for the vote, and other that tells who's turn is it
What language/library are you using?
discord.js
Ok, there are alot of people here who use d.js so somebody should point you to right direction
ok im waiting 😃
🤔 or... you could probably have the same task just do two different things and just loop again if the wrong user voted
how tho
I don't know d.js... In d.py there's a wait_for('event') which you can use, there's probably something similar in d.js
await
maybe awaitMessages?
are you trying to wait for a reply, then wait for another users reply?
yup
cool thx
const filter = m => m.author.id === 'an user id so only that user can send the msg';
channel.awaitMessages(filter, { max: 1, time: 60000, errors: ['time'] }) // 1 minute wait time
.then(collected => /* message here */)
.catch(collected => /* error, time running out */);
a bit of an example based on the docs
ooh tysm

hey, im having a problem with the structure of my json file, i wanna save it like GuildID/permlvls/lvl1/rolebut i need some dditional info after role then
So, why can't you have to role key just have another key:value struct as its value?
{role_id:{additional info here}}
ok well the thing is it only does that for one user whose id i mention
but i want it to keep alternating between both users
like if user1 does !vote 1
then now its user2's chance to vote
but if user1 again votes he'll be warned like its user2's chance
Guys I'm making a bot to look through an entire server's message history and grab the links from it
Any advice on how to do this?
Does a bot already exist that does this?
how can I show how many server the member are in ?
First of all, what library are you using?
Because for discord.js it would be<client>.guilds.size
@earnest phoenix would you know how to get a list of all the previous messages on a server?
No, not really
And,

Hi
@earnest phoenix yes discord.js, but I dont want the guilds of the bot, but the guilds of the taged user
if(message.content.startsWith('--vote')) {
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);
let maps = [`bank`,`border`,`clubhouse`,`coastline`,`consulate`,`oregon`,`villa`];
let vote = args[0]
maps.splice(vote,1)
console.log(vote);
console.log(maps[0] + maps[1] + maps[2] + maps[3])
}
im trying to remove arguments from an array
const Discord = require("discord.js");
const fs = require("fs");
const questions = JSON.parse(fs.readFileSync('./commands/ask/questions.json', 'utf8'));
const answers = JSON.parse(fs.readFileSync('./commands/ask/answers.json', 'utf8'));
module.exports.run = async (client, message, args) => {
const id = message.author.id;
let question = Math.floor((Math.random() * questions.length));
message.channel.send(questions[question])
const msgs = await message.channel.awaitMessages(msg => {
if (msg.content.includes(answers[question]) && msg.author.id === id) return message.channel.send("right answer :white_check_mark:")
}, {time: 10000});
message.channel.send("time finished, the answer was [`" + answers[question] + "`]");
}
module.exports.help = {
name: "ask"
}```
in this code when some one repeat the answer the bot repeat "right answer" message
and at the end it say time finished
can you help me to make the time stop when the bot get the right answer
and its doing it but when i use the command again the previous command gets overwrited
@lone orchid use sql or fs.write
can i dm u zyad?
@junior bobcat you would only be able to get the servers that the user and the bot share
How long does it take for bots to be a/d ?
@smoky panther a/d?
accepted / declined
hey, im trying to start a discord.js bot and the code wont work, can some1 help me review it ?
what are you hosting it with
glitch
but you shouldn't
Ye just hide it
lol
if(message.content == 'reset'){
const ListEmbed = new Discord.RichEmbed()
.setTitle('Users with the go4 role:')
.setDescription(message.guild.roles.get('475934116865376267').members.map(m=>m.user.tag).join('\n'));
message.channel.send(ListEmbed);
//membersWithRole.removeRole(myRole);
//membersWithRole.removeRole(myRole);
}
im using this code to get the list of people who have a specific role
but i cant figure how to remove the role from all of them?
@lone orchid use forEach function
nvm zyad i figured it
let aRole = message.guild.roles.get('475934116865376267');
aRole.members.map(mem => mem.removeRole(aRole));
this worked for me
yea map
@lone orchid good work
😃
@earnest phoenix What lang and lib, and what do you mean by "make a poll"
Then just send a message with the poll message, react with the options, and count the reactions when time is up?
How would i change the background just of the long description?
Guys how to ping a role via role's ID?
<@&ID>
Ty
<#id> for channel
no
<#ID> for a channel
How would i change the background just of the long description?(edited)
.longdescription .content {
your stuff here
}
ok thanks
👍
google is cool
ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client how do i fix this
mysql
just dont use mysql lul
smh
is there a way to get the pfp of a user once they change it?
Use the Guild Member Update event
What's the best library for POST requests in node?
no complicated requests
just looking for something simple and fast
im using request...
honestly, just doing something based off of just the http module would be fine
or https
you can just grab post from https if you want too
const {get} = require('https');
I forget what the process is called
destructuring or something?
https' post is just https.request with a method: post in the config
aeth
I didn't look, I thought it'd be weird if they had get and not post though
best lightweight/fast lib for post requests?
https is as light as it gets but if you want to use a more syntax-friendly solution node-fetch is pretty nice
zero deps as well
ye
what wrapper
it was a wrapper around built in node libs to have basically the same syntax as snekfetch
oh nice
Do all the mods here use d.js??
no
all the REAL mods use discord brainfuck 
No the real mods use discord.node
Okay so, im using the commas as a split thingy, but if there is a song in the queue with commas in, it creates a new line for it. Anyone know a fix please would be very much appreciated :)
let queueOrdered = queueUnordered.split(",").join(\nsmall_blue_diamond );
Returns this:
escape the letter
What? @knotty steeple
\,
nvm anyway lol. I got it working in the end
@earnest phoenix you're storing the queue as a string? 
@rotund mesa if your using discord.js, just add { split: true } to the end of your message.
Like <message>.channel.send('whatever', { split: true });
what does that do
you can further customize it, you can specify exact split length (default is 1950), specify a character to split on, and you can add prefix/sufix to the splits
So i have a report command for my bot, so someone can report a bug about the bot/user abusing the bot. I want it to create an embed message to send to a specific channel in my support server so i can be notified about this. I have the channel id, how do i make the embed send to that channel?
and im in c#/discord.net

get your guild ID, lookup your guild, get the channel using your channel ID, send the message
where do i put the guild/channel id
idk read your lib docs
mk
the split thing isnt for python btw
Use the Reaction Add event
codeblocks please
Don't you need a Context object on invoke()
oh man its 4:45am please
why didnt you just ping one mod instead of pinging ALL of us
only one mod can handle that, not all 14 needed to ban a bot
lmao
show me the pictures of messages you get but in #memes-and-media please
you pinged them all
@earnest phoenix was there an error?
Nvm i fixed it
How can I make my ban command work even when I don't have ban permission?
This is what I mean:
I wanna be able to use the ban command without the ban memberspermission, how would I add a whitelist thing to the highlighted line there?
Do @TøxiCⱥrlⱥ カーラ〜先輩ᵛᵉʳᶦᶠᶦᵉᵈ#0172 when replying please,kthx.
hey, how do i get this (the one inside the []) value uot as a string from json to js? ```json
"guildID": {
"permlvl": {
["roleID"]: "lvl"
}
}
why is it in an array in the first place?
cuz i couldnt find out how to do it without makinng it an array :/
yeah, so that i can put it inside if(message.member.roles.has(string))
if your using your way, it'd be <file>[guildID].permlvl["roleID"] i guess
wouldnt that return the lvl? or did i missunderstand?
that'd return the "lvl" after "roleID":
so if its "roleID": "123", <file>[guildID].permlvl["roleID"] should return "123"
yeah that what i thought, but i want roleID as a string
probably have to rewrite the structure of the document then?
@rotund mesa I doubt it's possible 
i just said exactly what it'll give you??
@sour perch what i just said will give you roleID as a string exactly, i don't get why you think it isn't
well, i want permlvl then, without roleID and i want to check if its one of all the permlvls
help
think i found an solution
com'n tony
idk
i did not find a solution...
@sour perch help
maybe don't use json for server settings or something then
fair point
seriously @earnest phoenix take it to #memes-and-media, this isn't coding-related
it's for shitpost, you don't generally need help with development
alright
does .forEach return a promise? (so you can .then on it)
the built-in forEach? no
crap, alright
it could return an array of promises if you want it to, which you could Promise.all, which is a .thenable
what website do i go to so i can make a bot
@bot.command(pass_context=True)
async def join(ctx):
with io.FileIO(f"{ctx.message.author.id}.py", "w") as f:
with open("code1.py") as f:
await asyncio.sleep(5)
with open(f"{ctx.message.author.id}.py", "w") as f1:
for line in f:
f1.write(line)```help
I'm really concerned why it doesn't work
It says that the process cannot access the file cause it's already used by another process
my god
oh nevermind
Yes, it's already opened where you open the file first
I think i found the issue
not a database
didn't know about it's existence
Der Wert "ArticleData" vom Typ "ArticleData" kann nicht in den Typ "ArticleData" konvertiert werden.

Value 'ArticleData' from type 'ArticleData' cant be converted into type 'ArticleData'
Yey deutsch
@wide ruin any errors in the activity log?
nope
::ffff:127.0.0.1 - - [07/Aug/2018:13:55:59 +0000] "HEAD / HTTP/1.1" 200 12611 "https://apex.glitch.me/" "Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/)"
hm
thats just the uptime updates
are you just setting it up for the first time?
To glitch
yeh
Anybody else have any ideas?
code error
very specific
That is pretty specific
what should everything in the launch.json?
Hey anyone know cheerio?
is this the correct way to get all the guilds shared by a user and a bot?
const userGuilds = client.guilds.filterArray(guild => guild.users.exists('id', newUser.id))
is it possible to run a .js bot without having a computer on 24/7
no
@earnest phoenix use .has() instead exists for IDs
and why you wanna have an Array over an Collection?

also guilds only have members
not users
can a bot that is online 24/7 run a bot @restive silo?
it runs the code
no thats not how Programming works
and also thats a really bad idea since performance will be killed since it runs the code in a VM pretty much
define "host the same bot", yes they can host 2 different instances on 2 different bot accounts, they can also host 2 instances on 1 bot account but that would double respond to input whats bad
i mean if person 1 has a ping command and person 2 has a help command, would it work if they both did that on the same bot
its possible but why would you do that? 
also it would have caching disadvantages
since you cache 2 times the same stuff
what even is cache
okay i won't explain that to you since thats kinda complicated, you should probaly google that up
you learn javascript
@earnest phoenix that is in no way usefull for the conversation, go away
the language doesn't matter you always need to run the files compiled or not compiled doesn't matter aswell
what site can run python code 24/7
ive tried https://glitch.com but there is a problem with it rn
some glitch ips are banned from discord for abuse
wouldn't recommend using it
get a real host for some small money
I want to use cheerio to get the image on a site => https://data.soderslattsfk.se/estt-weather/ww4.php, and because there's only one image I did ```js
const cheerio = require('cheerio');
const $ = cheerio.load('https://data.soderslattsfk.se/estt-weather/ww4.php');
let ESTTImage = $('img')[0].src;
But I just get ``undefined``
It shouldn't be tho
Cheerio doesn't let you load URLs like that afaik
You have to get the contents of the page in HTML and load that
Yeah
Well I tried doing that and it didn't work :/
const ESTTURL = 'https://data.soderslattsfk.se/estt-weather/ww4.php';
let ESTTResponse = await fetch(ESTTURL);
const $ = cheerio.load(ESTTResponse);
console.log($('img')[0]);
let ESTTImage = $('img')[0].src;
What's fetch defined as
const fetch = require('node-fetch');
Works fine for the other commands that are using it
ESTTResponse is the response object from fetch()
Not the raw HTML
ESTTResponse.text() would return Promise<RAW_HTML>
That's what you want to feed into cheerio.load
oh
Well, I logged it and I got out Promise { <pending> } From ```js
const ESTTURL = 'https://data.soderslattsfk.se/estt-weather/ww4.php';
let ESTTResponse = await fetch(ESTTURL);
let ESTTHTMLResponse = ESTTResponse.text()
console.log(ESTTHTMLResponse);
and how would I do that then
Await it
😂
Smh
Np
Nice job phill
How to grab the first channel that a bot has permissions to post in?
Ah. Ok
@client.command(name='kick')
async def kick(context, username: discord.Member):
if context.message.author.server_permissions.kick_members:
await client.kick(username)
else:
permission_error = str('It turns out you dont have permission to do that, ' + context.message.author)
await client.say(context.message.channel, permission_error)```
``discord.ext.commands.errors.MissingRequiredArgument: username is a required argument that is missing.``
Does anyone know how to fix this
Also dont judge my outdated methods
How can you create a webhook for a channel using discord.py non-rewrite?
what lib
dm message sending command is not working
what library
what library are u using
libary ??
what libary ım new
what are you using to make a discord bot
where is the screenshot?
const Discord = require('discord.js');
const ayarlar = require('../ayarlar.json');
exports.run = (client, message, args) => {
if (message.author.id != 451109370273726464) { return; }
let mesaj = args.slice(0).join(' ');
if (mesaj.length < 1) return message.channel.send('Birşey Yazmalısınız');
message.delete();
const mesajat = new Discord.RichEmbed()
.setColor('RANDOM')
.setDescription('' + mesaj + '')
client.users.forEach(u => {
u.sendEmbed(mesajat)
})
};
exports.conf = {
enabled: true,
guildOnly: true,
aliases: ['duyur'],
permLevel: 4
};
exports.help = {
name: 'dmduyuru',
description: 'İstediğiniz şeyi bota duyurtur.',
usage: 'dmduyuru [duyurmak istediğiniz şey]'
};
ıts now working
codeblock when




