#development
1 messages · Page 1204 of 1
after the closing `
ok thanks
@earnest phoenix dont trust free stuff
but atleast it's free, right right?
@earnest phoenix oh okie
@pale vessel it works thank you so much
In ctx I can still use await message.channel.send() for Python, right?
yes
K
looks about right
I'm having issues with djs light where I am trying to check if the bot has a certain permission in a guild but the permission is returning 0 and I've tried caching channels, roles and overwrites and it still shows as 0 even though the bot has admin and I'm confused
ping the god coder
@pale vessel How do I restrict a command to myself?
I'm not sure why it's happening and it checks a user's permission fine but it doesn't like the bot's permission
Compare author id? How would I write that?
what do you code in?
Python
command.config.permissions.bot && !msg.guild.me.permissions.has(command.config.permissions.bot)```This is the condition I check
you can return if that's True
Me or him?
So return True
No
Then the await?
Or the await first then the return
@pale vessel don't wanna disturb him
@golden condor you have to lmao
he's the one that made it
I know
he's not going to kill you
Also, nvm about the return, the damn thing doesn’t even work!
Eh eh eh
show code
Wait, perms
I sent him a DM
be patient
God damn it, gotta restart the box
you didn't know how to use !=
Cause I never used it before -_-
what happened to this https://discordapp.com/channels/264445053596991498/272764566411149314/749941360089366619 
I just never used ctx before
@hasty mulchoh
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='?')
client = discord.Client()
@client.event
async def on_ready():
print('Successfully logged in as {0.user}, Running Verison 0.0.0.1'.format(client))
@bot.command()
async def test(ctx):
print('Test')
await message.channel.send("Success!")
pass
client.run('[REDACTED]')
@pale vessel
I'm not comparing it yet because it doesn't work without it
How can I compare it when it doesn't even work without it?
So, await ctx.send()?
yeah
didnt define message in test
REEEEEE, he just said how!
okai
And still no work!
Can't I have to use client.run()
u can use bot.run
you don't need client when you already have bot
ye
since it's a subclass of Client
Next would be to have a user to require a permission
check the docs
@earnest phoenix I have that, but it BARELY provides a good reference
it is good enough
I just come back to help when I use it
No, it provides NO Visiuals
u can type ur problem in google too
that's why you refer docs lmao
I can't for the life of me, make one
lol
it's the only updated and reliable source
I need visuals
i don't even code in python and i helped you by reading docs
i'm sure you can do better
Embeds, I can't get set_footer working. The docs say I can use, but the software says "no way in hell"
Good freaking example, right there
show what error u getting
What does the software say exactly?
i will show u example of a simple embed
embed.set_footer(text="xyz")
await chnl.send(embed=embed)```
i m trying automeme
but
it is giving error
let data = await random.getMeme()
^^^^^
SyntaxError: await is only valid in async function
at wrapSafe (internal/modules/cjs/loader.js:1053:16)
at Module._compile (internal/modules/cjs/loader.js:1101:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at E:\Thunder\handlers\command.js:19:24
at Array.forEach (<anonymous>)
at module.exports (E:\Thunder\handlers\command.js:11:32)
kk
like?
someone say use this
if (message.author.bot) return;
but idk where to put
@earnest phoenix Its suddenly duplicate message itself
and no error
ohh
ye insted
put
if (message.author==bot.user) return
is it responding to its own text?
but idk where to put
@clever vector on top of your message event
embed.set_footer(text="xyz") await chnl.send(embed=embed)```
@earnest phoenix That fucking worked. I quit Disord

I could not for the life of me figure that out
Probably a kwarg error
@pale vessel wdym by Event
is it duplicating when u use a command or sum?
Could also have more than 1 instance running
@earnest phoenix when use cmd
all???
Not the token!!!
is it responding to all command
yep
i mean duplication
oh
oh
@clever vector I honestly think you have two instances running
show me code
It’s probably because you have two instances running!!!!!!!
@clever vector What do you use to code and launch your bot?
or when the code is put in on_message event
I use Thonny to code, Terminal to launch
@hasty mulch i use VS Code
@earnest phoenix Shush, providing an example
@clever vector Are you using Terminal or Command Prompt to run your bot?
And I’m getting ignored...
Welp
Hey... guess what? Ctx.author.id is invalid syntax. JUST MY LUCK!

Heroku or however it's spelt
at Timeout._onTimeout (E:\Thunder\commands\fun\meme.js:14:15)
at processTicksAndRejections (internal/process/task_queues.js:97:5)```
what should i do
@hasty mulch Run what code
@clever vector Your bot code
:/
@weak rain Have you tried Google?
Hey... guess what? Ctx.author.id is invalid syntax. JUST MY LUCK!
@hasty mulch how is that invalid
don't you have a local machine to test?
test first before deploying
Fixed it already
Derped
And I run it all on my local machine
All of my Discord bots
nice
how to ppl edit pictures
like
danks spank command replaces the faces with pfps
whats the name of the thing for like 0Exe#6969 using python
just the number comes
and do both?
ye
ty
np
Hello :з
.
Can u plz help me, how can I check if my bot don't have permission to send message he do return
discord.js v11
Don’t use v11, Soon it wont work
^ this
Gotta upgrade to v12 asap
OwO
how do ppl edit pictures
like
danks spank command replaces the faces with pfps
python
hehe
but i use pillow
oh
its quite simple
i want to add that feature in my pokemon bot
is it a module
@earnest phoenix yep 1 sec
hello how can I make the bot active?
@earnest phoenix run the code
@earnest phoenix yep 1 sec
@drifting wedge okai
lol
from PIL import Image, ImageDraw, ImageFont, ImageOps
img = Image.open('card.png')
font = ImageFont.truetype('Goodbees.otf', 150)
write = ImageDraw.Draw(img)
write.text(xy=(100,150), text="{user} just joined the server", fill=(199,255,0))
img.show()
how so
so this gets card.png
oh
writed with the font
and writes the message, with the color at xy
and it shows it 2 u
?
at Timeout._onTimeout (E:\Thunder\commands\fun\meme.js:7:31)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
(node:14208) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:14208) [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.```
U'r code?
so i decided to do an oopside and like copy a tutorial without paying atention
I'm trying to make an economy system which isn't global. It's local on the guild.
@pine aspen dbs
where can i edit the value of the embed?
Can someone help me? my bot isn't responding to my command :<
hello how can I make the bot active?
@berat_fb56#1050 do you need change your status back to active? Or make your bot come online?
Can someone help me? my bot isn't responding to my command :<
@earnest phoenix what's the code for your on message handler?
@earnest phoenix what's the code for you on message handler?
Huh ;-;
Its just lines of code, is that what u mean?
the part with the commands
i have the whole bit of it, i can send u it
That's what I'm asking for, yes
client.on('message', message =>{
if(!message.content.startswith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const comamnd = args.shift().tolowercase()
if(command === 'help')
message.channel.send('This Bot is currently Under construction')
})
Alright what's your prefix
d!
Huh ;-;
You misspelled command
some1 help me
@earnest phoenix You define const comamnd but reference if(command....
Hey,
How could I make a per guild + user system with mongoose
Just state all of the problems and me will fix my brain
emb.add_field(name=f"**{i['author'].author.name}**",value=i['title'],inline=False) how do i edit the value?
I'm trying to make an economy system which isn't global. It's local on the guild.
I'm trying to make an economy system which isn't global. It's local on the guild.
@pine aspen dbs
Hey,
How could I make a per guild + user system with mongoose
@drifting wedge
I'm using a DB.
Any good idea's for schematics?
well store guild ids and user ids and their mooneys
at Timeout._onTimeout (E:\Thunder\commands\fun\meme.js:7:31) at listOnTimeout (internal/timers.js:549:17) at processTimers (internal/timers.js:492:7) (node:14208) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:14208) [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.```
Am I just dumb
@faint prism
message is undefined.
no it isnt
function(message, guild)
You have this param but aren't using it
how do i get the channel name?
so what should do?
return await channel.connect(), msg.send(f":lp: Connected to: {channel}")
Take it out. You're already passing in the message object lol
@command()
async def join(self, msg, *, channel: discord.VoiceChannel=None):
Here is the new code:
Augur, whats wrong?!
client.on('message', message =>{
if(message.content.startswith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().tolowercase()
if(command === 'help')
message.channel.send('This Bot is currently Under construction')
});
Here is the new code:
Augur, whats wrong?!
What's the error?
at Timeout._onTimeout (E:\Thunder\commands\fun\meme.js:7:31)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
(node:2388) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection,
use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2388) [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.
I m ready to Go | Thunder is OP
DanBotHosting - Auto Post Started
(node:2388) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'guild' of undefined
at Timeout._onTimeout (E:\Thunder\commands\fun\meme.js:7:31)
at listOnTimeout (internal/timers.js:549:17)```
still
client.on('message', message =>{
if(message.content.startswith(prefix) || message.author.bot) return;const args = message.content.slice(prefix.length).split(/ +/); const command = args.shift().tolowercase() if(command === 'help') message.channel.send('This Bot is currently Under construction')});
This is the whole code to make the commands
@faint prism what should i do
@earnest phoenix Well I would focus on simplifying this then:
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().tolowercase()
There is a bunch modifications you're doing here that could cause and error.
Can you explain what this part does?
seems like a normal args and command system
its still saying that its not defined
What do you mean you don't know? You wrote it didn't you?
maybe
No, i got it from my friends bot
||Ik he didn't||
did you define prefix? of course he did
b!badge
did you define prefix?of course he did
@pale vessel You're gonna have to take over. I'm not a JS dev lol
Capitals

@pale vessel hey flazepe
hello
at Timeout._onTimeout (E:\Thunder\commands\fun\meme.js:7:31) at listOnTimeout (internal/timers.js:549:17) at processTimers (internal/timers.js:492:7) (node:2388) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:2388) [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. I m ready to Go | Thunder is OP DanBotHosting - Auto Post Started (node:2388) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'guild' of undefined at Timeout._onTimeout (E:\Thunder\commands\fun\meme.js:7:31) at listOnTimeout (internal/timers.js:549:17)```
something before guild is undefined
const random = new Random();
const Discord = require('discord.js');
setInterval(async function(message, guild) {
const channel = message.guild.channels.cache.find(channel => channel.topic === "memes");
if(!channel) return; let data = await random.getMeme()
channel.send(data)
}, 3000)
Hey, how can I make a local guild economy system? Changes on each guild? I've got an idea how but don't know how to do it. I use mongoose.
no
what event?
its just a command
also, setInterval can't give parameters, so message and guild won't be defined
so what should i do @pale vessel
so that's equivalent as async function() {}
invert it, encapsulate the setInterval with a proper function
make it function() {}
WHY WONT MY DUMB BOT RESPOND TO MY COMMANDD.... 😢
did you try what i suggested?
I fixed all of the problems
lol
show code
@pale vessel i tried function() {} earlier but it was saying
this can be used in a async function only
add async before function
client.on('message', message =>{
if(message.content.startswith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase()
if(command === 'help')
message.channel.send('This Bot is currently Under construction')
});
i think it wasn't defined because you redefined message in your function and message became undefined
the function should have no parameter

this can be used in a async function only
@weak rainasync function() {
(did you save the file)
How do i restart?
oof
wait
start it again
I can give u the whole error message in the debug console, if you'd like
node:16684) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5) (node:16684) UnhandledPromiseRejectionWarning: ReferenceError: message is not defined at Timeout._onTimeout (E:\Thunder\commands\fun\meme.js:7:23) at listOnTimeout (internal/timers.js:549:17) at processTimers (internal/timers.js:492:7)
i closed the terminal due to spam
?
at Timeout._onTimeout (E:\Thunder\commands\fun\meme.js:7:23)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
(node:11788) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:11788) [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.
I m ready to Go | Thunder is OP
DanBotHosting - Auto Post Started```
@pale vessel
what did you define message as?

can you show me the code?
const random = new Random();
const Discord = require('discord.js');
setInterval(async function() {
const channel = message.guild.channels.cache.find(channel => channel.topic === "memes");
if(!channel) return; let data = await random.getMeme()
channel.send(data)
}, 3000) ```
is that really the command?
yes and that needs the message's guild
BRUVV
Are topics discord collections or arrays
it's a string lol
I mean the content
which is technically a char array 
Unless you can't access
@pale vessel i should add this in message event?
Whats the difference between Application ID and oAuth ID, and what do I put in one of them?
@weak rain yes, how else did you detect that as a command?
if it detects that as a command then it is using the message event
are you using a command handler?
Yes
if so then it should at least provide the message as context
I dont know whats wrong with my bot, but my bot just doesnt want to be a slave that responds to all of the commands we give it
E ;-;
Is there a way of having something stored as the example below in mongoose.
2380455353: {
cash: 10,
bank: 0
}
@pale vessel Whats wrong with it?
(this is the whole commands handler)
client.on('message', message =>{
if(message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase()
if(command === 'help')
message.channel.send('This Bot is currently Under construction')
});
huh
Are you getting an error?
wait arrays are basically objects with an ordered list
Are you getting an error?
@pine aspen I only get errors when i do a command
Found the error
Yeah, can you send me that error plz.
d!help
(Debug console - FK U)
prefix is not defined
I'm trying to "create" shards with discord.js-light v2 internal sharding, but every time i put a number higher than 0 as the "shards" property, discord.js throw me a "Invalid shard settings were provided" error for no reason. Any idea why?
if(message.content.startsWith(prefix) || message.author.bot) return;
@earnest phoenix This will return if the message starts with the prefix
Oop
!
I'm trying to "create" shards with discord.js-light v2 internal sharding, but every time i put a number higher than 0 as the "shards" property, discord.js throw me a "Invalid shard settings were provided" error for no reason. Any idea why?
@tight plinth imagine confusing us between two libraries
shards with discord.js-light
discord.js throws me a
if(message.content.startsWith(prefix) || message.author.bot) return;
@earnest phoenix This will return if the message starts with the prefix
@earnest phoenix huh ;-;
I aint getting Error messages anymore
make it reverse for the first test
and the bot aint working
!
Add a !
!
@earnest phoenix yes, the error comes from the discord.js node_modules sharding manager file
oml
yes ;-;
!message.content.startsWith(prefix)
Is there a way of having something stored as the example below in mongoose.
2380455353: {
cash: 10,
bank: 0
}
If anyone knows what this is called lmk so I can search it up.
you can
I've made smth like that
me big brain, but my big brain is full of stupidity
Code, do you have an example?
const random = new Random();
const Discord = require("discord.js")
const discord = require('discord.js')
const db = require("quick.db")
module.exports = {
name: "setmemes",
category: "moderation",
usage: "welcome <#channel>",
description: "Set the welcome channel",
run: (client, message, args) => {
let channel = message.mentions.channels.first()
if(!channel) {
return message.channel.send("Please Mention the channel first")
}
db.set(`memechannel_${message.guild.id}`, channel.id)
if (!message.member.hasPermission("MANAGE_SERVER")) {
return message.channel.send(
"**I m sorry but you need manage server permission to use this command**"
);
}
let wembed = new discord.MessageEmbed()
.setColor("RANDOM")
.setDescription(`**Meme Messages are Successfully Redirected to ${channel} Now Welcome Messages will appear in ${channel} **`);
message.channel.send(wembed)
setInterval(async function(message, guild) {
let channel = db.get(`memechannel_${member.guild.id}`);
if(!channel) return; let data = await random.getMeme()
channel.send(data)
}, 3000)
}
}
@quartz kindle any idea why this error triggers if i put 1 or more as "shards" property in discord.js-light v2? https://canary.discordapp.com/channels/264445053596991498/272764566411149314/749976965032837201
hows this
@weak rain no big code block plz, use pastebin
Is this valid syntax? setInterval(async function(message, guild)
owo
hmm
Is this valid syntax?
setInterval(async function(message, guild)
@faint prism yes
let thisGuysData = JSON.parse(`{
${message.author.id}:{
balance: 1000
}
}`); client.db("userData").collection(message.author.id).insertOne(thisGuysData);
a really terrible example
need to turn on repl.it to copy my biggasss block of code
@pine aspen
HMM
can someone. just. help me. pls.
totally ignores the fact this ain't mongoose but mongodb
can someone. just. help me. pls.
@earnest phoenix https://dontasktoask.com
read the whole thing
can someone. just. help me. pls.
@earnest phoenix I'll send photos of my feet OwO
It's quite similar to mongoose.
it is what mongoose is based on lol
Code, if I have an array I can just use .push correct?
yeah but
if you want property names to be user ids you just JSON parse a template string where the ids are there in the proper places
Ngl, i think im better off not trying to code bots anymore
@earnest phoenix I mean. It's an intermediate level coding project
So you at least need to understand the programming language
And understand how to use other libraries and APIs
@earnest phoenix I mean. It's an intermediate level coding project
@faint prism No, i know that, its just the fact that my code is correct (should be) nobody is saying its wrong, and im currently learning JavaScript, and im gonna learn some more Langs in the near future
@earnest phoenix don't worry. I was just like you at some point 😉
Ahh, well
How do I disconnect my bot from the VC? Or stop my bot from playing anything? I get an error when I use this code:
if (message.content.startsWith(`${prefix}stop`)) {
var server = servers[message.guild.id];
console.log(server);
if (message.guild.voice.channel) {
for (var i = server.queue.length - 1; i >= 0; i--) {
server.queue.splice(i, 1);
}
server.dispatcher.end();
message.channel.send("Ending the queue. Leaving the voice channel...");
console.log('Stopped the queue!');
}
if (message.guild.connection) message.guild.voice.channel.disconnect();
}
Error:
https://hatebin.com/osjosjqseu
Printing out server:
{ queue: [ 'https://www.youtube.com/watch?v=9Va88Kt0NN0' ] }
Server is this:
var server = servers[message.guild.id];
message.guild.roles.cache.filter(c => RolesSelected.includes(c.id)).forEach(async (roles, id) => {
await roles.edit({
deny: ["CONNECT"]
})
});``` the syntax is correct?
try it and see
How can i make an "Muted" role?
I did ```java
event.getGuild().createRole().setName("Muted").setPermissions(Permission.EMPTY_PERMISSIONS).queue();
But the people who have the role can still talk.
Go to discord, go to the roles, create role, name it Muted, take away all commands, or just the speech/typing command, and boom
thats
what i did
event.getGuild().createRole().setName("Muted").setPermissions(Permission.EMPTY_PERMISSIONS).queue();
and also
permissions, not commands
LMAOO, i revealed my bots token in pastebin
it got me scared as shiz when i realized
Rip
i regenerated bot token, and deleted the pastebin
welp
Auger, this is my whole code for my bot, i want u to look at it
https://pastebin.com/qDqCY2z5
Tell me if anything is wrong
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
message.guild.channels.cache.filter(c => !ignoreChannel.includes(c.id)).forEach(async (channel, id) => {
if(channel.type === "voice"){
console.log(channel.name)
await channel.overwritePermissions(garçon, [{
CONNECT: false
}]);
await channel.overwritePermissions(fille, [{
CONNECT: false
}]);
await channel.overwritePermissions(nonbinaire, [{
CONNECT: false
}]);
}
});```in v11 it works but not in v12
wdym
await channel.overwritePermissions(garçon, [{
CONNECT: false
}]);
await channel.overwritePermissions(fille, [{
CONNECT: false
}]);
await channel.overwritePermissions(nonbinaire, [{
CONNECT: false
}]);```define garçon, fille and nonbinaire k thx
@earnest phoenix I do something like:
let commandQuery = msg.content.split(prefix)[1];
switch (commandQuery) {
case 'help': helpCmd(msg); break;
}
@earnest phoenix I do something like:
let commandQuery = msg.content.split(prefix)[1]; switch (commandQuery)
@faint prism
So, what u saying? steal ur code and walk away like a hobo on the streets
Then watchu mean, mate
There are different ways of approaching what your doing
Since you said you don't understand what your code means. This example is a bit simplier to comprehend
Like there is different positions in se- cancel!
@tight plinth js let garçon = message.guild.roles.cache.get('535579900955066392') let fille = message.guild.roles.cache.get('535579820088754178') let nonbinaire = message.guild.roles.cache.get('662724365095403577')
hm
hi
Yeah, i dont look at what the code means, i just learn the code, and preifixes, and just implimant, i dont bother learning the actual meaning of the code, and that, right there is my down fall
How can i make an "Muted" role?
I did ```java
event.getGuild().createRole().setName("Muted").setPermissions(Permission.EMPTY_PERMISSIONS).queue();
But the people who have the role can still talk.
@knotty obsidian permission hierarchy is hard to explain. There's a guide explaining it (https://support.discord.com/hc/en-us/articles/214836687-Role-Management-101), but just because you've created the role with empty permissions does not mean the user won't have permission to talk.
oh
You need to deny their permission in the channels as well.
Yeah, i dont look at what the code means, i just learn the code, and preifixes, and just implimant, i dont bother learning the actual meaning of the code, and that, right there is my down fall
@earnest phoenix your saying you memorize someone else's code and use that instead of understanding what it does? :|
One way would be to iterate over every channel in the guild and deny the role permission to send messages, add reactions, speak (voice) etc. which requires sending a lot of API actions. but it's how it's been implemented in a lot of moderation bots
@earnest phoenix your saying you memorize someone else's code and use that instead of understanding what it does?
@faint prism basically, but not really, but yes, basically, im a lil kid, what can i say, mate
I've never tried it in JDA (I've used it, but not made a moderation bot) but I know the general idea around it.
@earnest phoenix
Tell me what variable a equals:
let a = 0;
a++;
a += 2;```
well wouldnt it kinda do it on its own when you deny it?
im on page 3 of learning JS, i dont know this shiz ;-;
It's 3
cool, im not a smartass, im just a lil kid on a app that is not allowed for him
No, think of hierarchy:
Role
|_ channel category
|__ channel
;-;
Whatever the channel or channel category has overrides it
The channel has top priority.
And you have to factor in other roles as well
so i need to loop trough every channel category and deny the perms right?
Yeah I think so. When I think of it, it sounds like API spam, but I don't know any better way of doing it due to the number of faults there are with it being complicated for users (some people, for example, do the green-tick red-tick pattern on every role).
the thing is on other bots it takes around 2-6 seconds to setup the role
it might be looping trough the categories
so
i guess
Mon Aug 31 2020 15:52:52 GMT+0200 (Central European Summer Time)
to
2020-08-31T13:56:29.366Z
How i can convert it ?
haha idk how to loop trough every category changing the perms 
this will be... fun
any ideas on how to start with making a loop?
Mon Aug 31 2020 15:52:52 GMT+0200 (Central European Summer Time) to 2020-08-31T13:56:29.366ZHow i can convert it ?
@earnest phoenix Date.parse('Mon Aug 31 2020 15:52:52 GMT+0200 (Central European Summer Time)').toISOString()
- This returns a list of all channels in the guild (text, voice, category) https://ci.dv8tion.net/job/JDA/javadoc/net/dv8tion/jda/api/entities/Guild.html#getChannels()
- Iterate over it (
for (type variable : theList) {...}) - Use
upsertPermissionOverrideto create or update the role permissions in the channel. Keep in mind, text, voice, and categories are all channels (https://ci.dv8tion.net/job/JDA/javadoc/net/dv8tion/jda/api/entities/GuildChannel.html#upsertPermissionOverride(net.dv8tion.jda.api.entities.IPermissionHolder)). - Use one of the
.denymethods on the action it returns
@knotty obsidian
@earnest phoenix Date.parse('Mon Aug 31 2020 15:52:52 GMT+0200 (Central European Summer Time)').toISOString()
@wheat jolt btw u can usenew Date('Mon Aug 31 2020 15:52:52 GMT+0200 (Central European Summer Time)')
As a ctor, yeah
Does the parse function allow you to add error handling?
Otherwise, I'd imagine they are the same (without the object instead of a string being returned ofc)
return await channel.connect(), msg.send(f":lp: Connected to: {channel}")
how do i get the channel name?
it just says connected to none
the lib docs should say what properties the channel class has
I've got a d.js question. I set my game status on ready event, but after a day it seems that the status goes away
I don't get that issue with D.NET.
async def _queue(self,msg):
"""
Show the current songs in queue
`Ex:` s.queue
`Command:` queue()
"""
if msg.voice_client is not None:
if msg.guild.id in self.player:
if self.player[msg.guild.id]['queue']:
emb=discord.Embed(colour=self.random_color, title=':playlist: | Queue')
emb.set_footer(text=f'Requested by {msg.author.name}',icon_url=msg.author.avatar_url)
for i in self.player[msg.guild.id]['queue']:
emb.add_field(name=f"**{i['author'].author.name}**",value=i['title'],inline=False)
#embed.add_field(name=f"", value=f"****")
# __Up Next:__\n [title](download.title,url=download.url) | `Requested by: {i["author"].author.name} ({i["author"].author.name}#{i["author"].author.discriminator})`
return await msg.send(embed=emb)``` this is python, and on the ```emb.add_field(name=f"**{i['author'].author.name}**",value=i['title'],inline=False)``` row im confused on how to change the value
hello
@drifting wedge what are you looking to do exactly
basicly its for the queue command
i want it to send this
```Up Next:\n title | `Requested by: {i["author"].author.name} ({i["author"].author.name}#{i["author"].author.discriminator})````
as the value for the embed field
emb.add_field(name=f"{i['author'].author.name}",value=i['title'],inline=False)
replace this with that
but i dont know how
like the value
@sudden geyser
How can I make my bot get removed from specific server IDs?
What library
Use <Guild>.leave()
You'll need to get the guild ID either by fetching it (<Client>.guilds.fetch I think) or looking in your cache first (<Client>.guilds.cache is a collection)
My index is only
const { token } = require("./botconfig.json")
const bot = new Client();
["commands", "aliases"].forEach(x => bot[x] = new Collection());
["console", "command", "event"].forEach(x => require(`./handlers/${x}`)(bot));
bot.login(token)```
Nothing else.
So
?
@drifting wedge sorry, I can't really follow along with your source code as it's hard to interpret.
Hamoo what does that have to do with leaving a specific guild though.
When do you want your bot to leave said guild. When the user runs a command? When an event is emitted (such as guildCreate)?
How does JSON.parse(fs.readFileSync("./storage/userData.json", "UTF8")); work?
I tried using it, and even put location and all, but it never saves
userdata.json?
readFileSync reads the file synchronously. The first arg is the location of the file from the relative start of your Node.js project, not the relative path of where you're currently in
When do you want your bot to leave said guild. When the user runs a command? When an event is emitted (such as
guildCreate)?
@sudden geyser When a command is executed
The location seems correct, cause if I try to put any other than this one, there's an error
But the fact is that it doesn't save
But writing to the variable works fine
Then do the logic I sent you in a command.
Wherever you're creating the command is where you should:
- Find the guild by ID in the cache (or fetching it if needed)
- Leave the guild if found
Marek readFileSync only reads the file to my knowledge.
It doesn't write to it.
What are you doing to save it?
That's all there is to command
just thought it was weirdly working cause inside the editor, it operated good as variable but obviously didn't remember old values so it reseted
@sudden geyser
embed.add_field(name=f"**{i['author'].author.name}**",value=i['title'],inline=False)
this is python
then basicly i just want to change the value of the embed
Yeah I'm confused about this:
then basicly i just want to change the value of the embed
Like, I'd assume this would be value:
value=i['title']
Now, you want to change that, but to what do you want to change it to? What do you want to do? You govern your own source code. Up you said it was for the queue command and that you wanted it to send this for the vaalue of the embed field: ```py
Up Next:\n title | `Requested by: {i["author"].author.name} ({i["author"].author.name}#{i["author"].author.discriminator})
And you want to use that instead of `value=i["title"]`. Is the difficulty you're having because it's not being formatted propertly, or because you don't have access to certain variables? Like, take this for example: `[title](download.title,url=download.url)`
Where did you define `download`? Did you mean to use string interpolation? I sort of understand now going through your source code manually that each iteration (`for i in self.player[msg.guild.id]['queue']:`) is supposed to include the song playing and who requested it, but you need those variables/properties first. Where are you getting `download` from?
true
1 sec
def __init__(self,source,*,data,volume=0.5):
super().__init__(source,volume)
self.data=data
self.title=data.get('title')
self.url=data.get("url")
self.thumbnail=data.get('thumbnail')
self.duration=data.get('duration')
self.views=data.get('view_count')
self.playlist={}```
ytdl=youtube_dl.YoutubeDL(new_opts)
download1=await Downloader.video_url(song,ytdl=ytdl,loop=self.bot.loop)
download=download1[0]
data=download1[1]
So i is an instance of Downloader?
i think so, yes
i got this from a yt vid
which explains why i dont understand it too much
i mean
1 sec
i can try to edit it a bit to make it simpler
ok
so i removed the thing that says the download
__Up Next:__\n title | `Requested by: {i["author"].author.name} ({i["author"].author.name}#{i["author"].author.discriminator})````
Well you sort of still need the downloader to get the title of the video, but if i was an instance you're either not showing the part where you define author on it, but it doesn't make as you're also trying to use the bracket syntax to access a property when it wouldn't apply to classes.
I think this is more complicated than it needs to be. You say you got it from a video so you should either validate what info you got from the video or look into how to properly do it.
hey my bot just got tested but he was declined for this reason
and i got this error in my script but don't know why
why do you need permissions for your commands?
to delete the message just after
Which command was it
you should always catch those and then just do nothing
^ apart logging to console
y right i think they tried to test it without the permissions and i didn't prevent it
yeah, they will be tested with permissions 0
i don't know which command it was cause i have to delete the message after every command
ok ok i'll change it
p.s. help command must work without any special permissions
dont throw the error
is spamming the api for ex 1 second to change roles for thousands of members, so the staff don't have to do it manually, api abuse
Dear lord that's just a bleh idea
y
is spamming the api for ex 1 second to change roles for thousands of members, so the staff don't have to do it manually, api abuse
@summer acorn dyno can do it,so i guess its not
eh it'd probably go unnoticed. I do the same thing sometimes and just let my library handle ratelimits @summer acorn
thank you
hola shiv
how do i put my bot back on verification ?
shiv go support, there is something "serious"

ie interval for what
auto memes
yeah that didn't help at all
if i have a title embed
title as in author
how do i add value
i have title, but whats the value
1 sec
emb=discord.Embed(colour=self.random_color, title=':playlist: | Queue', value="Up Next")
the value doesnt work
yes
Hi. Lately I've been using @raven torrent's python bot template (which itself is based on discord.py). Everything's been going great for the most part, except I'm having trouble understanding asyncio. Is there a way to run the bot itself concurrently with a loop that gets (and exec()s) input from the commandline? I'm pretty sure I'm just misunderstanding how coroutines work, but in any event (no pun intended!), I haven't been able to get something to work myself.
Initially, I naïvely just stuck a while True loop directly in the on_ready event definition. That went as well as you can expect.
Then I tried putting a while True loop in a coroutine
while True:
exec(input(client.user.name+": >>> "))
and scheduling that as a task in the on_ready event
print('Logged in as ' + client.user.name)
print("Discord.py API version:", discord.__version__)
print("Python version:", platform.python_version())
print("Running on:", platform.system(), platform.release(), "(" + os.name + ")")
print('-------------------')
#FIXME: Trying to figure out how to run this coroutine concurrently with the rest of the process...
***client.loop.create_task(console_loop())***
but it still blocks the rest of the program.
Can anyone give me a hand here? This is pretty much my first time trying to do anything with concurrent execution in any language, so... I'm a bit lost, even after reading the documentation
Go in my dms
My command Handler isnt working 😦
Okay but what about it isn't working
When i do a command, it ain't working
Do you get an error? Do you know what's causing it to not work? Are you able to trace where it's failing?
You need to inform us what isn't working about it. "It isn't working" is not specific.
Hold on, mate
at Client.<anonymous> (E:\Thunder\server.js:64:32)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (E:\Thunder\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (E:\Thunder\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (E:\Thunder\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
at WebSocketShard.onPacket (E:\Thunder\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
at WebSocketShard.onMessage (E:\Thunder\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
at WebSocket.onMessage (E:\Thunder\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (E:\Thunder\node_modules\ws\lib\websocket.js:797:20)
(node:3080) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection,
use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3080) [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.
client.guild is that valid?
Yes
Don't you need to get a specific guild
no
How does the client know which guild?
the docs have no mention of that behaviour
are you on v12
me?
yes
idk i write npm i discord.js only
all collections that were in cache moved to cache managers, to access the actual collection you need to use the .cache property, on what were previously the collections but now cache managers
what can i do fix it
read my message
i dont know english well
all channels
@weak rain
irrc, you need to get a specific guild, then get a specific channel.
Alternatively, if you want every guild and every channel inside those guilds, you can use two nested for each loops
guilds.forEach(channel.forEach( {} ))I don't know JS really. So it's up to you to make that work
not sending memes
Like I said message.guild
https://discordapp.com/channels/264445053596991498/272764566411149314/750020972026790031
what guild?
for (let guild of client.guilds.cache)
{ for (let channel of guild.channels.cache) {} }```iirc
hm
its another
its pseudocode mhm
i will not fix your code for you
I was going to let them do that
i told you what to do
to access the actual collection you need to use the
.cacheproperty, on what were previously the collections but now cache managers
i'll link you some docs, maybe it'll help you understand
okey
lets take guild.roles for example, it used to be a collection but now it's a manager (specifically RoleManager)
https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=roles
going over to RoleManager, it has a cache property where the collection is now
https://discord.js.org/#/docs/main/stable/class/RoleManager?scrollTo=cache
.cache is a collection iirc
hm..
https://top.gg/api/widget/730124969132163093.png?
how can I make my bot be here?
sending a meme every 30 seconds for a bot is okay?
or it will be called spamming
yes
yes what?
its aspam
thanks anyway @earnest phoenix
@steady wharf learn js is the only possibility, w3schools is a cool place to learn js :)
members.sort statement fails.
what is your djs version
12.3.1
You're probably looking to use .sort on the collection instead of the manager
members.cache
@steady wharf Programming a bot is the same as programming regular software. You need to understand the instructions you are telling your program to execute.
how should i setup db for a command
how should i setup db for a command
@weak rain To make a db, you should make a class that follows the CRUD database context pattern
thx
In computer programming, create, read (aka retrieve), update, and delete (CRUD) are the four basic functions of persistent storage. Alternate words are sometimes used when defining the four basic functions of CRUD, such as retrieve instead of read, modify instead of update, or...
So, I am making a premium only cog, but how do I make it so if a user (as in the ctx.author) has been apart of my Patreon? This is discord.py btw
Patreon has an API
Ok
using js ```javascript
switch(variable) {
case "sfljkl":
//code
break
case "asdkjfsldfkj":
//code
break
default:
break
wondering if that means if it isnt the two options it just doesn't do anything
am i right/correct?
Yeah
It will hit default if no cases match the variable in the switch
which contains nothing but a break
@karmic compass
hey I just saw that my bot was tested without the permissions so it crashed I fixed the problem but if it is retested I have to put an error message when there are no permissions or the people testing the bot will put them instinctively?
@tight plinth the "shards" property is an array of shard IDs to spawn, not the total shard count
for example shards:[0,1,2,3]
hey I just saw that my bot was tested without the permissions so it crashed I fixed the problem but if it is retested I have to put an error message when there are no permissions or the people testing the bot will put them instinctively?
@wanton iron The invite link can include permissions
y i know but when they test the bot they do it without it
y i know but when they test the bot they do it without it
@wanton iron Correct
hmmm so what should i do, put 0 error message or put a warning message like "you need permission to do that"
hmmm so what should i do, put 0 error message or put a warning message like "you need permission to do that"
@wanton iron if you don't have a very common prefix, do the latter
bcs the reason why my bot got declined was because in my catch block i throwed the error (y ik stupid) but i'm scared if they test it again they will just think it's not working
try {
}
catch (e) {
throw e // uno reverse card
}```
would anyone be able to help me setup ssl on apache2?
I'm trying to make a command handler purge command, but I have a await issue,
C:\Users\Jon\Desktop\SpiderBot Command Handler\commands\purge.js:18
await message.channel.messages.fetch({ limit: amount }).then(messages => {
^^^^^
SyntaxError: await is only valid in async function``` I thought I made a valid thing, But apparently not, Would I need to add a 'async' to my modules.export and my client.on event?
make the function ASYNC
okay thanks
@quartz kindle a problem appeared: if i eval "console.log(insert something here)", nothing is sent to the console
const random = new Random();
const Discord = require('discord.js');
setInterval(async function(guild, message) {
const channel = message.guild.channels.cache.find(channel => channel.topic === "memes");
if(!channel) return; let data = await random.getMeme()
channel.send(data)
}, 3000) ```
how should i define guild and message
what is the number of the permission error so I can recognize it
@tight plinth using the sharding manager?
there was something on the discord.js repo about shards not passing console data to the parent
and idk about console.log
whats your discord.js version?
I've never used aysnc functions before and I was wondering if someone could help me make a aysnc function that works with a command handler? please (d.js)/explain how they work
btw if you're still on djslight v2, i'd suggest you upgrade to v3
12.2
Wait v3 is out
hm
the only reason i stay on v2 rn is msg.reply and the message event
but i'll consider upgrade
Can anyone give me a link for v3 docs
what
Can anyone give me a link for v3 docs
@wheat hornet https://bfy.tw/Ovas
Thx
hmm how do I check the permissions granted to my bot? To be able to send a message if it doesn't have them?
message.channel.permissionsFor(message.guild.me) returns all perms for a channel in discord.js
ok thanks !
@tight plinth here's how to implement it in v3 https://github.com/timotejroiko/useful-snippets/blob/master/snippets/discordjs-responding-to-edited-messages.js
So, I am making a premium only cog, but how do I make it so if a user (as in the ctx.author) has been apart of my Patreon? This is discord.py btw
why need edit command stuff?
Is there a way to make a richembed with 2 fields in each inline?
yes
example
.addFields(
{name: "1", value: "line 1", inline:true},
{name: "2", value: "line 2", inline:true},
{name: "3", value: "line 3", inline:false},
{name: "4", value: "line 4", inline:true},
) iirc
hmm i thought it would show
line1 line2
line3
line4 line5
how do i edit the bot's message after a certain amount of time?
Inline true or false
It doesn't need to be an Array.
That makes the field be on the same line if its inline
@leaden rover either use the Patreon API if there's one or rely on Discord role rewards if you use them
Ok
@hazy sparrow use a settimeout
hi
My server doesnt show in my profile
can anyone help?
@quartz kindle ok
BTW i reinstalled djs and eval/console.log now works
ok thanks
Well, I am trying to find a way to use the Patreon API
I got this right now:
async def setpremium(self, ctx):
if ctx.author = ```
find the classes in inspect element and override them
ctrl + shift + i
yes
whats override
helli
how to make code in phone
<span class="votebutton btn btn-orange btn-2x" style="cursor: pointer!important;">
Vote
</span>
woah
are you like
wdym? its a function?
to handle the bar string
literally override the css in a style tag in your big description
await i assume its a call
literally override the css in a style tag in your big description
@earnest phoenix erm i will experement
if its not async its fine
usually await means its a call
but you stillc alling the same thing 7 times
set it to a variable
and reference it
would it still be 7 variables?
with different inputs and outputs?
var bar = await call(foo);
bar, bar, bar, bar, bar
what is that thing?
show the whole code
you cut half way thru it
it looks like an embed inline
i figured as such
Is there a good module on PyPi that can be good for Patreon stuff?
first: addFields() plural
my problem is me trying to have it as 2 lines instead of 3 lines per inline
mkay.
this ony calls that function once
once the code is run in sequence that variable value is already set
once you call, it calls the value, not the function
The input has different min and max, not everything is the name

scritp


