#development
1 messages · Page 383 of 1
idk it shiuldnt send the error
I guess you could just ignore the error ¯_(ツ)_/¯
¯_(ツ)_/¯
i want to get nice api
is there a way that a bot would not go online because the code has some error in it?
I did this:
const { Client } = require ('discord.js');
const { TOKEN, PREFIX } = require ('./config.js');
const ytdl = require ('ytdl-core');
const client = new Client({ disableEveryone: true });
client.on('message', msg => {
if(msg.author.bot) return;
if(!msg.content.startsWith(PREFIX)) return;
const args = msg.content.split(' ');
if(msg.content.startsWith(${PREFIX}play)) {
const voiceChannel = msg.member.voiceChannel;
var connection = voiceChannel.join();
const dispatcher = connection.playStream(ytdl(args[1]))
}
});
This is just a tst bot thing...
Yes I do
what coding language?
js
then use it :/
Where?? I try to edit the bot and there is no specific place to... Start coding I guess. I'm really new to discord bots. This is my first time. Sorry for the inconvenience.
Do I submit code using github?
https://discord.gg/4gNqVG @tulip raptor
that's the jda server
I've never used jda so I can't advice you
then?
I need to know where I can submit my code
you don't need to submit code
just run the code from your IDE or cmdline?
uh yeah..
Ok, sry
const { Client } = require ('discord.js');
const { TOKEN, PREFIX } = require ('./config.js');
const ytdl = require ('ytdl-core');
const client = new Client({ disableEveryone: true });
client.on('message', msg => {
if(msg.author.bot) return;
if(!msg.content.startsWith(PREFIX)) return;
const args = msg.content.split(' ');
if(msg.content.startsWith(${PREFIX}play)) {
const voiceChannel = msg.member.voiceChannel;
var connection = voiceChannel.join();
const dispatcher = connection.playStream(ytdl(args[1]))
dispatcher.setVolumeLogarhytmic(5 / 5);
}
});
client.login("TOKEN");
now I did this and it conects to the VC but I can not hear it... Do you have any ideas why?
why have you not tell me at i need to come to active my bot before 14:05 today?
you should invest on keeping it online 24/7
@inner jewel but why? I put all dependencies for it, created META-INF/services/javax.script.(forgot) with required content
onst Discord = require("discord.js");
const client = new Discord.Client();
client.on('ready', () => {
client.user.setStatus("online");
console.log("Reload Completed");
});
client.on('message', msg => {
if (msg.content === 'input command') {
msg.channel.send('output message');
}
});
client.login('my token's bot');
what the problem?
in node.js
my token's bot
lol
I purposely wrote that I wanted to hide you
What?
How do I get the number of all users in the servers my bot is installed on ?
discord.py btw
I have to get a list of all guilds and then get the member inside each guild ?
that'll contain duplicates
I just noticed the get_all_member method in the doc
I think doin len() of this would do the work
again, it'll contain duplicates
how do I do this then ?
Guys how do I get the number of guilds the bot is in??? C#
you know there's more than one c# lib right?
I know
I just need to know
How it roughly works
Nvm I will try it out me self
Whats the function of DBLWrapper.NET?
how does one get a channel that's on another shard d.js
bRoAdCaStEvAl
😩
Hi, I request some help. I am currently making a music bot with the Discord.js library and I keep getting an error when using my play command. This is what my console shows:
Any help?
Yeah how can I define it.
np
It worked but now im getting another undefined error.
post
to connect to a voice channel I belive.
Standby..
cost dispatcher = connection.playStream(ytdl(args[1])) its there and defined. the playStream is having an error.
Okie, Thanks for your help
np
How're you getting your connection variable?
voiceChannel.join() will return a promise.
Where shall I add that in?
So you've to use await. Otherwise your connection variable will be undefined.
await is undefined.
Is it inside an async function?
If you're not using async/await, you can use .then() after .join()
I've added the await to the command.
var connection = await voiceChannel.join();
Yeah correct.
Hated it.
You've to use it inside an async function.
await doesn't work in sync functions.
Use .then() instead.
For example:
voiceChannel.join().then(connection => {
// Use `connection` variable here.
});
What is my connection variable then? I am new to these types of bots.
Check this, there's an example:
https://discord.js.org/#/docs/main/stable/class/VoiceChannel?scrollTo=join
Before what line?
Before this?
You should learn about callbacks
You don't need to use try..catch...finally there.
Mkay..
You can do it like:
voiceChannel.join().then(connection => {
// Use `connection` variable here.
}).catch(e => {
// You can catch your errors here. `e` is the error variable.
});
So I'll replace my current code with that one.
(Sorry I'm very new to discord music bot programming)
No problem 👌🏼
Okay I've replaced that.
Added the connection variable.
Bot is active.
I'm just testing it now.
@shrewd totem Crashed - Connection is not defined.
Because the connection variable is not accessible outside of the callback
Could you show the screenshot of the error and code?
@shrewd totem there you are
I love how no one listens to me
😂
@topaz fjord because idk what u be talking about xd
Its pretty self explanatory
You can't use connection outside the then() (where connection is defined).
You trying to access the connection outside of the callback where connection is defined
Sorry - I'm really confused.
@shrewd totem Do you have a glitch acc. that I can invite you to?
No I don't.
Check this line (or file) https://github.com/TheBastionBot/Bastion/blob/master/modules/music/play.js#L228
That might help you.
So let's say we have ```js
Test.test().then(data => {
})
Console.log(data)
Your not able to access the thing data
Since it is being defined in the callback
So anything defined in the callback can't be used outside
Yeah, see how it's used. ANd listen to public class Turtle, he's trying to explain it to you.
Read this:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then
I understand that the data cannot be used outside of the callback*.
Not command, callback
Hold on a minute - ima read that thing.
Here is the link to my code (You have commenting rights)
https://docs.google.com/document/d/1_our2FfCtNcQF6ybE4G3Lpp6lw1GUcwWqU2xPGizb5w/edit?usp=sharing
const { Client } = require('discord.js'); const { TOKEN, PREFIX } = require('./config'); const ytdl = require('ytdl-core'); const client = new Client({ disableEveryone: true }); client.on('warn', console.warn); client.on('error', console.error...
Don't you have it on GitHub or GitLab? I don't have a Google account.
I can adjust it so you can edit.
Just put it on git :/
I dont have it.
I'm using my brothers account on glitch.com
nothing else.
I don't know the pass.
why are you using your brother's account 🤔
o
Damn parental controls.
Lmao
Check your file now.
Syntax error
I saw.
Syntax error, it's hard to edit code in a text editor lol
ik.
Fix syntax errors and try.
Standby..
You should really get a linter
Is there another method to get guild.id and guild.name?
for some reason, every script/code after this line doesn't execute/run:
var customcontext = new CommandContext(client, msg);
@frozen bough what lib
sorry, i'm using discord.net
Check your code not the error
you're not supposed to use 2 .catches
you use one or the other
You can but you're terminating it in the wrong way.
Remove the
.catch(console.error);
``` part.
It doesn't like: .catch again.
Or just the ;
Because you don't need to catch twice
@shrewd totem Removing it entirely worked
You only need to catch once
Its back online.
And you should probably learn JS before writing bots.
@topaz fjord i'm using Discord.Net (C#)
Oh shit - lemme reset permisions
If you did you wouldnt be having problems 
shhh
Will not respond..
Because in my book I count this as spoon-feed
Not mine.
@stone steppe I'm reading the whole conversation, before continuing anything else you should take some real JS courses
^
Yea I'll spend the next 48 hours doing that. 😃
You can't learn js in 2 days
It's not McDonald's as far I know
@topaz fjord rip
You actually has to give it time to learn
More you'll spend time on learning a language more you'll be able to make nice stuff with
You can. JS is not that difficult language.
Okie.
Well, actually depends on person to person.
What you're trying to do is like trying to drive a car without knowing how to drive a car
Yeah
Well Thank you @shrewd totem @topaz fjord and later on @glossy oracle for all the help 😄 I'll take ur advice.
I need a new computer though...
Goodnight!
Good night
any idea how to pull from en instead of de with xpath?
//*[@id="main-content"]/div/article/div/div/table/tbody/tr[1]/td[2]
`<td style="min-width:300px;white-space:inherit" class="well" data-lang-en="(2 items) Adds 1206 Maximum Health<br>(3 items) Adds 1096 Maximum Stamina<br>(4 items) Adds 4% Healing Taken<br>(5 items) When you interrupt a casting enemy, you heal for 4300 Health and apply Minor Vulnerability to the enemy for 10 seconds, increasing their damage taken by 8%." data-lang-de="
(2 Gegenstände) Gewährt 1206 maximales Leben<br>(3 Gegenstände) Gewährt 1096 maximale Ausdauer<br>(4 Gegenstände) Gewährt 4 % erhaltene Heilung<br>(5 Gegenstände) Wenn Ihr einen Feind unterbrecht, der gerade eine Fähigkeit wirkt, dann heilt Ihr Euch um 4300 Leben und belegt den Feind 10 Sekunden lang mit kleinere Verwundbarkeit, wodurch sich dessen erlittener Schaden um 8 % erhöht.
">
(2 items) Adds 1206 Maximum Health<br>(3 items) Adds 1096 Maximum Stamina<br>(4 items) Adds 4% Healing Taken<br>(5 items) When you interrupt a casting enemy, you heal for 4300 Health and apply Minor Vulnerability to the enemy for 10 seconds, increasing their damage taken by 8%.
</td>`
What in the heck am i reading 👀
Do you know how to pull from en and not de if the site uses both in xpath
http://prntscr.com/is91dz
I keep getting the DE as seen in the screen shot when I want the EN
i am trying to get my bot to add songs to a queue and then start playing the queue after the first song is played. the bot also stops working when i try to add a song to the queue and says that bot is already connected to a VC in this server
here is my code
@bot.command(pass_context=True)
async def play(ctx, url):
if not playing:
#may be Pointing to the wrong thing?
author = ctx.message.author
voice_channel = author.voice_channel
vc = await bot.join_voice_channel(voice_channel)
player = await vc.create_ytdl_player(url)
player.start()
if playing:
new_vid = queue[0]
#make the program play new_vid using youtube_dl
else:
queue.append(url)```
i need help, can anyone tell me how to use the config vars thing on heroku? the language im using for my bot is python
from os import environ
environ.get("NAME_OF_THE_CONFIG_VAR") # to use however you want
ty so much
Please include a bot mention
-botinfo @worthy marten
329668530926780426
Sheepy
9008
A cute multi-purpose bot for music, economy, levels, temp voice channels, and more! Sheepy 2.0 Coming Soon™
JDA
(customizable)
62
2748 Servers | 4 Shards
@deft galleon 
@drifting shell 
@drifting shell #265156322012561408 pls...
sry lol
@idle grail what's the error ?
Btw you can do if (member.roles.includes("Admin") || second things || third one) return true;
I haven't worked with discord.js, but looking at the docs quickly it says .roles is a Collection and doesn't mention .includes(thing) but mentions .has(thing), does it work if you say has instead of includes? @idle grail
Oh
I didn't do that
i did this: member.roles.map(r => r.name).includes("Administrator")
And it seems to work
now i got a new problem
In which the bot stopped working XD
who use nodejs?
uuuughhhh
Why isn't this working?
My code -
const dbl = require("dblposter");
const DBLPoster = new dbl("token");
DBLPoster.bind(voidClient);```
voidClient is my client
you can use the dblapi.js that was made by tonkku instead of dblposter
@earnest phoenix https://www.npmjs.com/package/dblapi.js
ok
for anyone using vscode is there a way to fix intellisense, mine randomly stops working, Ive tried reinstalling
btw in using insiders
Help. I am really tired.
I want to set variouses but I can't
translate(react, {to: 'en'}).then(res => {
switch (res.from.language.iso) {
case 'ko':
var messageTitle = '아스키'
var messageContent = 'ASCii 문자열을 전송합니다. 인수는 영문 문자열입니다.'
var errorTitle = '오류'
break;
default:
var messageTitle = 'ascii'
var messageContent = 'Send ASCii artworks. Argument is string.'
var errorTitle = 'Error'
break;
}
})
if (!args[0]) {
message.channel.send({embed: {
color: 4620980,
title: `${messageTitle}`,
description: `${messageContent}`
}})
return
}
I used this code
2018-03-17T08:13:12.939077+00:00 app[worker.1]: /app/react/ascii.js:24
2018-03-17T08:13:12.939115+00:00 app[worker.1]: title: `${messageTitle}`,
2018-03-17T08:13:12.939116+00:00 app[worker.1]: ^
2018-03-17T08:13:12.939119+00:00 app[worker.1]:
2018-03-17T08:13:12.939124+00:00 app[worker.1]: ReferenceError: messageTitle is not defined
But got this..
😭
@gleaming summit messageTitle is not defined where you send the message
out of scope
@earnest phoenix Thank you for helping me
np
Sometimes people should read the console
-help
.
@glossy mason Wait how do i use this?
from os import environ
environ.get("NAME_OF_THE_CONFIG_VAR") # to use however you want
where should i put the environ.get("BOT_TOKEN")
i already did it though
so you should do client.run(eviron.get("BOT_TOKEN")) if your main discord.Client() is called client
does anyone know how to put the bot respond from a blue box like beta version
from python
what
are you using the random library i've never heard of provided by dbl or Discord.py
@tidal grove
which one barry
um ok
@tidal grove
im a bit busy & wont reply after xx06
goes dnd
👋
also, assuming you're using d.py, you should join the support server. link on here https://github.com/Rapptz/discord.py
i need help reagrding how to make ranking up system with a put like if we put 1 mssge its a 1 exp @worthy storm
:d
pls help
help yourself. read the docs
to make a ranking up system, count the amount of messages for every user
https://github.com/Rapptz/discord.py read this. im busy
and save it in some sort of database
seriously just read the documentation mate
How to do it? Use google
@worthy storm i couldnt find any doscs regarding this
counting messages and saving to database
there is not a tutorial for fixing your inability to assemble python code by using the documentation
learn python
@worthy storm i couldnt find any doscs regarding this
here's tag lp
😦
https://automatetheboringstuff.com/ (for complete beginners to programming)
https://learnxinyminutes.com/docs/python3/ (for people who know programming already)
https://docs.python.org/3.5/tutorial/ (official tutorial)
http://python.swaroopch.com/ (useful book)
see also: http://www.codeabbey.com/ (exercises for beginners)
(tag learnpython, from the d.py support server (where you should be))
there isnt a function to make a ranking system. Again, Count amount of messages sent by a user and save the amount somewhere
can someone help me
you don't have to ask for someone to help you just ask
for some reason it just doesnt read my command folder and straight goes to error
hmm
😮
did client.command.get(command).execute(message, args); just not execute for some reason or am i missing something 
Oh
oh facepalm
that might be the issue
they should ahve different scopes
that shouldn't be the issue
at least, I don't think so
yeah thats what i think too idk.

im a noob 
what's the error?
like when you did not type the command correct, it will give a message. but the thing is i type it correctly but it counts as wrong
@solemn yoke I know absolutely nothing about JS, but when doing require('file'), do you have to specify which function in that file you have to require?
uhh. no if i recall
Oh
No, not required.
uhh hmm, is it open source?
no
Wait, send a screenshot of one of the command files
What's the issue?
scroll up
Can you show the screenshot of the error?
umm its not that kind of error
you know when a user type wrongly the prefix or command
there will be reply that you did type wrongly
it just constantly tells you your wrong when im not lol
basically skipped 1/3 of my codes
It's because of client.command
@solemn yoke it isn't very good practice to tell the user if they did a incorrect command, its better to fail silently
You need to show your message event listener. Can't say what's wrong there without seeing that.
@shrewd totem scroll up
maybe
but commands is a
line 36 is taking from the const command
?
commands is the file directory

sorry if i trigger people me noob
is what I'm suggesting unreal?
@solemn yoke wait what. if(commands.args && !args.length)
?
As you see in line 6, it's defined as client.commands, so in line 36, use client.commands.get()
Which part did you change?
line 36
Can you show what error you're getting in your console? That'd be much helpful
No, in your console
there is no error in console
it is just executing the last row the command
the catch
but not the ones before the catch
There's a console.error(error); line before that meow?! line, so it should be logging something!
(Read the error first)
That's what I was asking for
How do you fetch the user mentions out of a message in Eris 
Understand the error Joel?
not really..
Cannot read property username
OF
undefined
it says your command isn't defined
In your try block, before line 36, use console.log(command) and show the output.
well.. ok
@shrewd totem >what I just said
Yeah, I just saw
You're using the ping command?
it's just the name of the file, maybe?
it doesn't look like it's taking the object you were trying to load
yeah :(.
Before line 36, use console.log(client.commands.get(command)) and show the output.
something is bonked with your client.commands it seems
meh, gotta learn sometime tbh
Use console.log(client.commands) and show the output
ok
always print out your stuff that is giving you issues
k3rn seems to be helping you get there, no point in everyone else saying the same thing

Check your ping command's file.
try execute: function ()
Are you exporting it correctly.
instead
That's not the issue, otherwise at least command's name should be exported.
Have you saved your ping.js file?
yes
Looks like it's not saved though
Okay, before line 12, use console.log(command) and show the output
🤔
faceplam
yep
apparently
saving the complete folder is different from saving it individually
Visual Studio PLS
You didn't know that ?
Also you should restart your bot after saving, if you don't have any programing watching for changes.
🙇 yes. i will keep in mind that always
@trim plinth Use message.mentions
mk
New to development all together but have some knowledge. But looking to make a quick clear messages command any quick tips?
what library are you using? @merry wave
Currently Discord Bot maker but will be switching off once i get a grasp of everything
just by seing the first 4 words of your last message I already want to give up on you
Yea I know, i'm new.
Nah my friend bought it and we "Share" an acct

just saying, discord bots can do everything what discord users can, and by knowing that, you can easily just go for choosing a programming language and just do WAY more than what discord bot maker provides
Whats the best one to learn with?
there is no best, it's literal preference
if you are a beginner try js or python
if you want to go straight for a harder language go for it though
python is the easiest language out there, so you have big chances to go with that first
Okay, then js is Java Script correct?
ye
JS is almost as easy as python
Javascript was easy to pick up for me
so its a good choice for beginners
^
althrough js is shit sooo
eh
Okay. Well thanks a bunch, gonna go learn me some python :p
js is more for website scripting, not really treated as a real programming language, I think
tbh whats the difference even if i go with a harder language and a easier one?.
I would've rather went for a better language before getting sucked into the js blackhole 
true
it is a programming language but its better for website scripting than a full programming
oo why is that?
yeah I meant that, just didn't know how to word it
Who's to say that?
like? 😮
JS doesn't scale as easily as some other languages can
I'm going to drop this before I start a flame war
althrough it does scale
I heard a lot of people complaining about js being using for discord bot development, mainly from rythm bot devs, so I just went with their opinions cause I don't have my own
yeah i just went with it too. cause idk which to go with
rythm lol, like java is any better
at least java is a real programming langauge and not used for website scripting
"real". There really isn't a fake.
and im psure its a real programming language
JS is a real programming language
make a website != script a website
im not even sure what is your point
a scripting language is a programming language 
but yeah
^
true
^
yeah
this is technically development talk tho 
nah I think its just the wording
anyone know how to check someones id with disocrd js?
the message author's id?
ya
if so its message.author.id
I would look at the docs
ah
but ok
If you want all message properties use the docs
in discord.py if you get someone's id it returns as int, so you it would be str(message.author.id) in this case
he is using discord.js
mkk
console.error(error);
message.reply('meow?!');
}
});```
should i just make it return
it instead of replying

probably
yes
mentions aren't fun
true
Hi guys development isn't for you guys to hash out on what programming language is better. Everyone's opinions are different. 


did i do the presence wrong?
cause it aint showing
yeah you did
dammit.
in discord.js you do client.user.setActivity("string that you'd like here")
oh...
actually no
isn't activity game?
its activity lol
Anyone know how to set vscode programming lang
ik
the key is game
because renaming it would be a breaking change
which will most likely happen in gateway v7
@solemn yoke its setActivity lmao
😮 oh
I got it wrong the first time
woops. bangs head i need to relearn coding tbh
https://discord.js.org/#/docs/main/stable/typedef/PresenceData in discord.js it is game
This always work
oh thank you very much
Fuck
Stupid link
I accidently put setPresence instead of setActivity
https://discord.js.org/#/docs/main/stable/class/ClientUser?scrollTo=setPresence contains presencedata
not deprecated
yet
np
@inner jewel I assume there is no eta on gateway v7?
nope
how do i get an user object by providing a snowflake/mention?
well for the mention i know, but the snowflake...

lang?
I can't really help you then sorry
no problem
@steel tinsel You can do something like this:
// If the user is in the cache, do:
let user = client.users.get(snowflake);
// Otherwise
let user = await client.fetchUser(snowflake); // I recommend using this, because if user's already in the cache, it will get from the cache, otherwise it will fetch it.
Not necessarily, you can use promise chains like:
client.fetchUser(snowflake).then(user => {
// Use the `user` variable here.
}).catch(console.error);
ok
Is there a more efficient way to do this 😂
i can barely read that
;-;
can you past the actual code in a hastebin or smth
use an array

are there any chances of breaking a script with a switch case?
my bot went crazy after i added something inside a switch
code
/app/server.js:135
if(guild[guildid].badwords.some(word => message.content.includes(word)) ) {
^
TypeError: Cannot read property 'badwords' of undefined
at Client.client.on (/app/server.js:135:21)
at Client.emit (events.js:180:13)
at MessageCreateHandler.handle (/rbd/pnpm-volume/768faaa2-1c53-4031-b548-770885ea090a/node_modules/.registry.npmjs.org/discord.js/11.3.2/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/rbd/pnpm-volume/768faaa2-1c53-4031-b548-770885ea090a/node_modules/.registry.npmjs.org/discord.js/11.3.2/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (/rbd/pnpm-volume/768faaa2-1c53-4031-b548-770885ea090a/node_modules/.registry.npmjs.org/discord.js/11.3.2/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (/rbd/pnpm-volume/768faaa2-1c53-4031-b548-770885ea090a/node_modules/.registry.npmjs.org/discord.js/11.3.2/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
at WebSocket.onMessage (/rbd/pnpm-volume/768faaa2-1c53-4031-b548-770885ea090a/node_modules/.registry.npmjs.org/ws/4.1.0/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:180:13)
at Receiver._receiver.onmessage (/rbd/pnpm-volume/768faaa2-1c53-4031-b548-770885ea090a/node_modules/.registry.npmjs.org/ws/4.1.0/node_modules/ws/lib/websocket.js:137:47)
at Receiver.dataMessage (/rbd/pnpm-volume/768faaa2-1c53-4031-b548-770885ea090a/node_modules/.registry.npmjs.org/ws/4.1.0/node_modules/ws/lib/receiver.js:409:14)```
error
guildsettings.json:
{
"snowflake": {
"modroles": ["Admin"],
"exemptroles": ["something"],
"mutedrole": "Muted",
"badwords": ["some", "words"],
"modlogchannel": "9450985494894040589459"
},
}```
hmm?
with a script @earnest phoenix
Hey, is there a way to make a decent botinfo command (in discord.py async)...the one that my bot has is manual input
@nimble merlin look at embeds
ik
it just started working
wait, what did I just say?#
Sorry, I thought you said this in a different channel
¯_(ツ)_/¯
what do you mean by manual input tho?
this is throwing an error for some reason ;-;
;-;
the reason i say for some reason 😂
discord.js/commando
I'm not js, sorry
k,
@ruby dust I mean't that I had to use strings and not rely on a commands fetching data
By that I mean (for example) I didn't use ctx.message.author instead I would just use something like JackTEK
well this is my stats command
I'm on rewrite btw
you can take this as a reference and make your own
absolutely perfect, thank you....this helps ALOT
altho my bot is not open source, and I just gave a peace of code 
yea, I know
it's just weird to me lol
anyway, how would I prevent a bot from replying to other bots using on_command event?
or is there some kind of other event?
I have no idea what so ever
this is what I've tried, and yes
ohh, so it didn't work with that before because I didn't process commands 🤦
what was the code for it again?
await bot.process_commands(message)
thanks
Put that at the end of on_message
yea ik
Just to make sure. That won't work in on_command
but wait
what if I have all events as a cog? like a different file separated from all commands, including on_message
I know what a cog is
it works the same way
but only one on_message needs process_commands
or else each one with it will process commands
hmm, I see
And just like on_command you don't need the event decorator in a cog
bots dont work outside of testing channels and bothell
ok so it did not really work, is this the right way to do it? https://puu.sh/zJMah/a81fde8f9d.png
rip no embed, forgot
comon discord, don't be a douche and send my message
@oblique sequoia I'm back here, any solutions yet in mind?
Okay so you need to do the return in your on_command hook too
I actually had that at first, but turns out it doesn't do what I thought it would
it's just an extra action taken that does not affect the original command in any way
Use a debuger and see where he's going 🤷
Is there an OAuth2 Discord example for Python that isn't the one provided by Discord themselves?
for what?
either flask or sanic (does anyone even know what sanic is?)
i have a django lib
i've forked it and modified it, because the original was broken
i'll give it a try, thanks for the suggestion
i have my whole website of my bot and dashboard in django
nice
@ruby dust I have no idea, I think your best bet is to ask in discord.py
hey guys
I can get you an invite if you want
what's a website that you can use to make http requests
is the "write your first django app" a good tutorial to start out with @abstract crystal?
YES!
OK!
WHY ARE WE YELLING? /s
https://giphy.com/gifs/drake-and-josh-bell-parker-110MZt5qYxdrH2 @abstract crystal
whoops xd
lol
@oblique sequoia I just tried asking there, there was no point as they found out a different peace of code of mine to brag about instead, and now they are disqussing their own topic..
like I said, dapi and other related lib servers are pointless
jda guild is good
I forgot that if you don't put an on_message in your main file it doesn't overwrite the default one 🤦
all I understood from them is that I don't need to process commands, and that still didn't work
So in your main file
where you declare bot and everything
you need to put an on_message event with the @bot.event() decorator
then do the bot check and process commands there
🤔
bot = commands.Bot(command_prefix = '-')
```🤔
that was my thought at first, but they said there wouldn't be a difference 🤦
so, I'm simply moving the whole on_message to the main file?
no.
keep the other one
drop the process_commands and bot check bits
then make another one in the main file
oh, another one
that one needs the decorator though
yeah
then just do
if message.author.bot:
return
await bot.process_commands(message)
ok here's a thing
it didn't respond to the other bot now, but the console printed AttributeError: 'Bot' object has no attribute 'provess_commands'
oh
I'm blind
nice one
Can someone help me with the help command, it won't run and there are no errors.
https://hastebin.com/ufizuhibof.js
Please ping me if you know.
async def provolone_commands(self, message):
return await self.process_commands(message)
ok, so... I don't want to ping any mods, but please unmute my bot @tawdry ember cause I'm about to fix the "bug" it was muted for
eh, @inner jewel since you were just here you get to be pinged, I guess
I'm wondering how I use @commands.has_permissions()...when I place 'Administrator' within the parenthesis, the error message is @commands.has_permissions('Administrator') TypeError: has_permissions() takes 0 positional arguments but 1 was given ERROR:asyncio:Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x056DBDF0> how do I fix this????
I don't really remember, but it's either "Administrator" = True or Administrator = True
just add that True in there 😄
ok
if you wait a minute i can fish it out of my bot
I'm pretty sure my friend uses async, and he does it the way I just told you to
yeah, you just have to add that bool
in rewrite is like this, try it
ok
hi there
@ruby dust exacly
was told to use this cannel
trying to use this tutorial: https://anidiots.guide/getting-started/windows-tldr.html
but this is happening
what's going wrong? I don't undertsand what it's telling me
somewhere you have an uncaught promise
you'd be better to show the code without leaking the sensetive information, like bot token
gosh, I can't send a normal message without editing it for mistakes
timezone?
@ruby dust this is the code
@abstract crystal what's an uncaught promise exactly?
Nice editor
yeah well I'm into python, not js, sorry
that looks short for a token
oh yeah
same here, mainly web js
oh wow
no, user tokens are as big as bot token
why I try to run a command that checks for the administrator permission, it comes back saying that the check failed even though I have the permission....
it's literally copy pasted code that the tutorial says to copy just to test if the setup works
@earnest phoenix are you trying to selfbot
kek
@earnest phoenix you copied a secret, not a token
where did you get your bot token @earnest phoenix
^
lmaoooo
that's what she said
@ruby dust don't
Lmao
those reds are the same
Copied id
won't work
@earnest phoenix you copied id, not token
ah fuick
you must have a bot account, convert it somwhere in the bottom then copy the BOT TOKEN
@earnest phoenix
- there is no point in hiding the client id
- that's a client id, not a token
@ruby dust he thought that was sensitive information so he hid the id

OMG I leaked @ruby dust client id: 415570038175825930
Oml I just leaked @trim plinth's ID:
387043512232968193
lol
fuck im hacked for sure
lol
zulul
w e r k s
anyways this is getting shitposty
lets retreat before a mod gets mad
so anyway, @earnest phoenix a bot token can be found somewhere at the end of the bot's page
Anyway, when I try to check for a permission, the check fails even though I have that permission
k
http://prntscr.com/iso19g fix the problem @uncut slate
aliases=['MUTE', 'Mute'])
@commands.has_permissions(Administrator=True)
async def mute(ctx, user: discord.Member):
embed = discord.Embed(title='Mute Case:', description='{} Muted'.format(user.name), color=0xffee00)
embed.add_field(name='Name:', value='{}'.format(user.name), inline=True)
embed.add_field(name='ID:', value='{}'.format(user.id), inline=True)
embed.add_field(name='Status:', value='{}'.format(user.status), inline=True)
embed.add_field(name='Role:', value='{}'.format(user.top_role), inline=True)
embed.set_thumbnail(url=user.avatar_url)
await bot.send_message(discord.Object(id='423890604645285888'), embed=embed)
role = discord.utils.get(ctx.message.server.roles, name='Muted')
await bot.add_roles(user, role)```
btw, getting your or your bot's id is as simple as rightclicking on the account and copying the id, so it's completelly pointless to hide it @earnest phoenix
yea
have you tried administrator instead of Administrator
do
@bot.command(pass_context=True,
aliases=['MUTE', 'Mute'])
@commands.has_permissions(Administrator=True)
async def mute(ctx, user: discord.Member):
embed = discord.Embed(title='Mute Case:', description='{} Muted'.format(user.name), color=0xffee00)
embed.add_field(name='Name:', value='{}'.format(user.name), inline=True)
embed.add_field(name='ID:', value='{}'.format(user.id), inline=True)
embed.add_field(name='Status:', value='{}'.format(user.status), inline=True)
embed.add_field(name='Role:', value='{}'.format(user.top_role), inline=True)
embed.set_thumbnail(url=user.avatar_url)
await bot.send_message(discord.Object(id='423890604645285888'), embed=embed)
role = discord.utils.get(ctx.message.server.roles, name='Muted')
await bot.add_roles(user, role)
``` heres color
doesn't it have to be a string tho?
it was triggering me
hehehe same, but didn't bother
it worked lol
python rules... params are in lower case
@nimble merlin here's a list of permissions as a reference, just scroll down a little bit http://discordpy.readthedocs.io/en/rewrite/api.html#permissions
oi he is on async
oh god damn it
lol
manage_guild != manage_server
i'm good anyway
ik the rest now anyway
nope
doesnt even have nsfw checking functionality
ik
oh that reminds me, I wanted to make nsfw commands 😂
it's annoying that there is no NSFW cjeck in async
which is quite essential
It doesnt have one bc async is not being update and will never be updated
Rewrite is 😩
I don't like migrating to rewrite because it takes soooooo long
which is why rewrite exists
yeah async is feature frozen
you can convert using this: http://discordpy.readthedocs.io/en/rewrite/migrating.html
Danny was nice and did us a favor






