#development
1 messages · Page 1184 of 1
ok
Now, back to our Python crap.
Python is mostly OOP, so you can create different objects for a class. That's done by appending () to the class name and providing parameters inside of those parentheses
Anyone able to help me out with mongodb?
ok
Now, what would Teacher(name="Andrew", skill="Professional") tell you in Python?
basically
there is a teacher named andrew, and he is proffesional at teaching
Professional*
A professional teacher named Andrew
right @slender thistle ?
Mhm
@slender thistle i gtg right now bc i got to eat lunch. can we do this convo through DM's?
Sure, I'll probably be asleep in a few hours though
is there a way to show search results from google
I don't think Google has an official search API except for custom search (which is not for developers to get results from google searches).
One option would be to use scraping but it's not uncommon for requests to be blocked.
@sudden geyser what is scrapin
Where you get/download the HTML webpage then filter out stuff you want from the raw html
You can't just give your users raw HTML. You'd need to manually parse the content to get what you want, but I wouldn't recommend it as it's not ideal. I've seen some other APIs that try to use Google's search and parse it for you, so some Googling may help.
what's the best way of going about rolling punishments? like say you can do like 3 infractions goes for mute and then if someone does it again 5 times they get kicked or sumn like that
i was thinking like
[
{
amount: 3,
punishment: 0, // mute
time: 20
},
{
amount: 5,
punishment: 1, // kick
time: null
}
]```
or sumn like that but then idek how i would display that on the dashboard and how i would manage that in the db
in discordpy
just send the link
or in embeds if you want a hyperlink its text
only works in description and fields iirc
wait so it would be like this:
await ctx.send(f'{[text](link)} yay')
oh really?
only works in description and fields iirc
@misty sigil how would i format it?
discord.Embed
but couldn't find it
no like how to get the hyperlinks
embed = discord.Embed("what goes here?")
it will only work in embed description and field values
ok
embed = discord.Embed(title = "great")
embed.add_field(name = 'ok', value = 'What goes here')
embed.add_field(name = 'ok', value = '[text](link)')
Yes
yup
ok
thanq
Alright I have a question
so when i run the following code:
@client.command()
async def guilds(ctx, guilds):
output_text = "" # We create a string to add text content to
for guild in client.guilds: # iterate over our guilds
output_text += f"__Name of Server__ : {guild.name}\n __Number of Members__ : {guild.member_count}\n" # in this line, we generate a string like "ServerName: 50" where 50 is the member count of the server
embed = discord.Embed(title = output_text)
await ctx.send(embed = embed)
nothing works
do u know why?
too long?
oh i see
would this work:
@client.command()
async def guilds(ctx, guilds):
embed = discord.Embed(title = "Servers!", description = "These are all the servers that the Math Bot is in:")
for guild in client.guilds: # iterate over our guilds
embed.add_field(name = f'__Name of Server__ : {guild.name}\n __Number of Members__ : {guild.member_count}')
await ctx.send(embed = embed)
it still doesn't work @misty sigil
i dunno?
@slender thistle any clue?
@client.command()
async def guilds(ctx, guilds):
embed = discord.Embed(title = "Servers!", description = "These are all the servers that the Math Bot is in:")
for guild in client.guilds: # iterate over our guilds
embed.add_field(name = f'__Name of Server__ : {guild.name}\n __Number of Members__ : {guild.member_count}')
await ctx.send(embed = embed)
y this isn't working
Is there an error message?
What's the guilds in the function
@client.command()
async def guilds(ctx, guild):
embed = discord.Embed(title = "Servers!", description = "These are all the servers that the Math Bot is in:")
for guild in client.guilds: # iterate over our guilds
embed.add_field(name = f'__Name of Server__ : ``{guild.name}``\n __Number of Members__ : ``{guild.member_count}``')
await ctx.send(embed = embed)
new code
error message:
discord.ext.commands.errors.MissingRequiredArgument: guild is a required argument that is missing.
Remove guild from the function parameters
running it
error code:
In embed.fields.1.value: This field is required
In embed.fields.2.value: This field is required
In embed.fields.3.value: This field is required
In embed.fields.4.value: This field is required
In embed.fields.5.value: This field is required
In embed.fields.6.value: This field is required```
I feel like I am doing exactly what you are with my eval command lol @modest smelt
||+eval string o = string.Empty; foreach (var g in Context.Client.Guilds) { o += $"{g} ({g.Users.Count})\n"; } return o;||
Ah
lol
i set it outside the loop?
value =
wdym
@client.command()
async def guilds(ctx):
embed = discord.Embed(title = "Servers!", description = "These are all the servers that the Math Bot is in:")
for guild in client.guilds: # iterate over our guilds
embed.add_field(name = f'__Name of Server__ : ``{guild.name}``\n __Number of Members__ : ``{guild.member_count}``', value = "")
await ctx.send(embed = embed)
sorry forgot to put the new code
Have a question how can I write a block function in my bot in the dm command? I search the internet the whole time I can't find anything I want my bot to block directly after a message.
do i need something insde the value = ""?
yeah
You probably want to add the name of the server in the field name and number of members in value
yes that is what i did
running it
yay it worked!
thanks @slender thistle
and @faint prism and @misty sigil
I wouldn’t make it public tho
why?
against tos
oh actually?
Privacy breach, yeah
oh
make it owner only
idk how it works in py but in js it’s one if statement
Have a question how can I write a block function in my bot in the dm command? I search the internet the whole time I can't find anything I want my bot to block directly after a message.
@slender thistle how do i set it so that only i can access the command?
@commands.is_owner() iirc
oh ok
@commands.is_owner()iirc
@slender thistle does this mean they are owner of the bot or owner of the server
bot owner
ok
but one of my programmers can't do that
is there any way to fix that?
@slender thistle
ok
WTF
create a list of IDs and check if message author's ID is included in the list
where should i create the list?
@slender thistle is there a way to let a user use a command only with their ID?
so how can i use thi:
def check_if_it_is_me(ctx):
return ctx.message.author.id == 85309593344815104
No idea
hmmm, thanks you
for Tarek
@modest smelt To allow more than 2 people, either a list and then use the in operator or do stuff like authorid == x or authorid == y
devs = [id1, id2]
my_id in devs
so i would do
async def guilds(ctx):
if my_id in devs:
do the code
``` or does the if my_id part go outside the async def?
bleh
def predicate(ctx):
return ctx.author.id in devs
@commands.check(predicate)
@client.command()
etc etc```
how can i make my bot repeat a command ever (2 hours) or so? even if nobody requested?
for example: i want my bot to tell me to drink water every 2 hours so it would be (@person, heres a reminder to drink water!)
setinterval?
Yeah
^
can someone help me with json deserialization in c#
When I type "node index.js" it should immediately mean my bot is online. Instead, it says "PS C:\Users\capod\Documents\Bot Creation>".
Also, this is super cool
class stonks
{
public string o;
public string h;
public string l;
public string c;
public string pc;
}
class stocks : BaseCommandModule
{
[Command("stocks")]
[Description("Displays Stocks")]
[Aliases("stock")]
public async Task stock(CommandContext ctx, [RemainingText] string Reason)
{
string json;
using (WebClient wc = new WebClient())
{
json = wc.DownloadString($"https://finnhub.io/api/v1/quote?symbol={Reason}&token=");
}
string content = JsonConvert.DeserializeObject<stonks>(json);
string permalink = (string)content[0].data.children[0].data.o;
string rImage = (string)content[0].data.children[0].data.h;
string rTitle = (string)content[0].data.children[0].data.l;
string rUpvotes = (string)content[0].data.children[0].data.c;
string rDownvotes = (string)content[0].data.children[0].data.pc;
await ctx.RespondAsync($"Open price: " + permalink );
await ctx.RespondAsync($"High price: " + rImage);
await ctx.RespondAsync($"Low price: " + rTitle);
await ctx.RespondAsync($"Current price: " + rUpvotes);
await ctx.RespondAsync($"Prev Close Price: " + rDownvotes);
await ctx.RespondAsync(json);
}
}
it doesnt respond with the stock prices
@faint prism
it doesnt respond with the stock prices
@thin tapir It returns for me
no i mean in the response from the bot
how do i take away all the roles through discordpy
@modest smelt pls help @faint prism
I think an easier question to solve would be: How do I get all of a user's roles
@slender thistle can u help bobthegod78
he is one of my programmers i was talking about
member.remove_roles(*member.roles)
how do we get those roles?
Yes, you do
kk
oh ok
lemme try that
how do we get those roles?
@modest smeltmemberneeds to be a Member object
@slender thistle how would we give them back the roles then?
store the roles somewhere
where?
Ehh
i can't put them in a json file
in some sort of a bot variable/property
and i don't know how to use sql
no i mean in the response from the bot
@thin tapir Oh. Content shouldn't be a string, it should be a stonks object. Then for the responce just reference the content.o, content.h, content.l, etc
@slender thistle i do that and get this
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10011): Unknown Role
Is member.roles empty?
do i store member.roles somewhere?
What are you trying to do, actually
async def mute(ctx, member: discord.Member):
guild= ctx.guild
role22 = "Muted"
role = discord.utils.get(member.guild.roles, name= role22)
if member == ctx.message.author:
await ctx.channel.send('You cannot mute yourself. It\'s just not possible.')
elif member is None:
await ctx.channel.send('You cannot mute nobody dum dum!')
else:
if role in guild.roles:
role = ctx.guild.default_role
perms = role.permissions
perms.send_messages = False
await role.edit(permissions=perms)
role = discord.utils.get(member.guild.roles, name= role22)
await member.add_roles(role)
for role in member.roles:
await member.remove_roles(role)
embed=discord.Embed(title="User Muted!", description="**{0}** was muted by **{1}**!".format(member, ctx.message.author), color=0xff00f6)
await ctx.send(embed=embed)
else:
permission = discord.Permissions(send_messages=False, read_messages=True)
role = ctx.guild.default_role
perms = role.permissions
perms.send_messages = False
await role.edit(permissions=perms)
await guild.create_role(name="Muted", colour=discord.Colour(0x0062ff), permissions=permission)
role = discord.utils.get(ctx.guild.roles, name="Muted")
await member.add_roles(role)
embed=discord.Embed(title="User Muted!", description="**{0}** was muted by **{1}**!".format(member, ctx.message.author), color=0xff00f6)
await ctx.send(embed=embed)
im tryna mute someone
code is @above
is it viable to use enmap over storing data in mongodb?
is there anyway to constantly repeat a command ever couple of minutes or so?
@slender thistle code is above
im trying to make a bot that will tell you to drink water every hour or so, any way i can make that command repeat constantly?
@modest smelt Right after you define client, do client.member_roles = {}
at the client.event?
That will be a dictionary, where a key will be a guild ID
and value will be another dictionary
inside of that nested dictionary, you would assign a member's ID their member.roles
At the top of your file
ok
where you do client =
over here:
?
@client.event
async def on_ready():
print(f'Logged in as {client.user}')
no, that snippet of code simply creates an event
doesnt send anything
is there anyway to constantly repeat a command ever couple of minutes or so?
@ionic warren Yes with SetInterval
its so confusing aghhhh
Well that's how you do it @ionic warren
the mute didn't work @slender thistle
@slender thistle TypeError: on_guild_channel_update() takes 1 positional argument but 2 were given
thats the error
i'll give u teh errors
wdym role.id
there are supposed to be before and after (2) parameters
where before is old version of the channel and after is the changed one
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10011): Unknown Role
yea
but in the bottom
i say like the role id
omega lul
1 sec
this is what i have for channel update
@slender thistle
i have put my error
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10011): Unknown Role
@modest smelt which line is causing that error
it doesn't say anything about that
it just says unknown role thing
maybe because of this:
client = commands.Bot('>')
client.member_roles = {}
?
@slender thistle can u please dm me anything u find
i gtg
is there python canavacord?
shivaco
TypeError: on_guild_channel_update() takes 1 positional argument but 2 were given
thats my error
there are supposed to be
beforeandafter(2) parameters
the parameters need to go in on_guild_channel_update
oh wait what
am I too sleepy to comprehend this now
what is your code like rn
1 sec
@client.event
async def on_guild_channel_update(member):
channel = discord.utils.get(member.guild.text_channels, name='arch-logs')
embed = discord.Embed(
colour = discord.Colour.blue()
)
embed.set_author(name=f"Channel Edited", icon_url=f"{client.user.avatar_url}")
embed.add_field(name=f":archedit: Channel '{member}' has been edited", value=f"", inline=False)
embed.set_footer(text=f"ID: {channel.id}")
embed.timestamp = datetime.datetime.utcnow()
await channel.send(embed=embed)```
oooh 1 sec
oooh
omfg i wasent understanding u lol
i thought u werew talking abt the docs
fair enough 
Basically just rename everything that's member to after
how do I make a reaction on a specific message with the id?
same error @slender thistle
embed.add_field(name=f":archedit: Channel '{after}' has been edited", value=f"", inline=False)
how do I make a reaction on a specific message with the id?
@radiant patio reply reaction or emoji?
ehh slap \u200b to be sure 😂
What's the error, again?
Yeah
TypeError: on_guild_channel_update() takes 1 positional argument but 2 were given
how do I make a reaction on a specific message with the id?
@radiant patio ?
Hello all, I am trying to make a command that provides song lyrics, but sometimes songs have really really long amounts of lyrics. can anyone help me with providing some embed page code pleading eyes
for instance, I created this which is a basic multipage embed.
https://gyazo.com/062a165faddc3152278457d9452d2173
but it is hardcoded and only does 2 pages. I am trying to make it sense the number of lyrics, sense paragraph breaks, and also have static pages so that if there is more than 4096 lyrics it adds a third page and so on.
i get them from a npm import
@sweet ruin Just create a string, populate it with lyrics, if the length is > 2000 in length, split into a string array, check the last index for > 2000 length, if yes, repeat... etc
Then create pages based on elements in the array
You probably want a do/while loop for that btw
@sweet ruin
Sound like a good approach to what you wanted?
hm
Strings (text datatype) has a length (the character count)
Discord msgs can only be 2k characters
while (myLyrics[myLyrics.Size].Length > 2000) do a split
Make a page for each element in myLyrics[]
Reply with embed
can someone help me code the mute com
@sweet ruin does that clear it up a bit?
you'll also have to avoid breaking the words and paragraphs
🤷♂️
var song = args.slice(0).join(' ');
if (!song) {
return message.reply("Please provide a song you would like me to get the lyrics for.\nBeing Descriptive with the author is very helpful aswell.")
}
var lyrics = await solenolyrics.requestLyricsFor(song);
var title = await solenolyrics.requestTitleFor(song);
var songicon = await solenolyrics.requestIconFor(song);
var author = await solenolyrics.requestAuthorFor(song);
let lyrics1 = lyrics.slice(0, 2048)
let lyrics2 = lyrics.slice(2048, 4096)
let lyrics3 = lyrics.slice(4096)
// if (lyrics.length >= 2048) lyrics = "Song has too many lyrics right now!"
if (lyrics.length < 2048) {
const e = new Discord.MessageEmbed()
.setTitle(`${title} by ${author}`)
.setThumbnail(songicon)
.setDescription(lyrics)
.setColor("ORANGE")
message.channel.send(e)
} else {
const right = '▶'
const left = "◀"
const e = new Discord.MessageEmbed()
.setTitle(`${title} by ${author}`)
.setThumbnail(songicon)
.setDescription(lyrics1)
.setFooter("Page: 1")
.setColor("ORANGE")
let m = await message.channel.send(e);
await m.react(left)
await m.react(right);
const filter = (reaction, user) => {
return (reaction.emoji.name === right && user.id === message.author.id) || (reaction.emoji.name === left && user.id === message.author.id);
};```
const collector = m.createReactionCollector(filter, { time: 120000 });
collector.on('collect', async (reaction, user) => {
if (reaction.emoji.name === right) {
e.setDescription(lyrics2)
e.setFooter("Page: 2")
await m.edit(e);
await m.reactions.resolve(right).users.remove(message.author.id);
} else if (reaction.emoji.name === left) {
e.setDescription(lyrics1)
e.setFooter("Page: 1")
await m.edit(e);
await m.reactions.resolve(left).users.remove(message.author.id);
} else return;
});```
that's evertyhing
embed.add_field(name=f"Roles ({len(roles)})", value=f"".join([role.mention for role in roles]), inline=True)
So where you have lyrics 1 2 3, just use an array
how do i not send the @everyone
and not send two @ @
roles = [role for role in member.roles]
Well arrays are an essential data structure in computer science
let lyricsarray = [lyrics1, lyrics2, lyrics3]?
how do i not send the @everyone
@drifting wedge add a zero width space (\u200b) between@ande
Not sure how you do it in JS. Might need a js dev to help you with that.
let lyricsarray = [lyrics1, lyrics2, lyrics3]?
@sweet ruin the array will replace you using those 3 variables ideally
im late but is there a difference between <@ and <@! and what are they
FFmpeg/avconv not found!
im late but is there a difference between <@ and <@! and what are they
<@!is for nickname mention i think
@sweet ruin I can give you an example in a different programming language that I know.
Note: This might not work. Just a quick example
string entireLyrics = SomeLyricsApi(songTitle); // Get huge block of lyrics. Example, entireLyrics = 8k characters
string[] lyricPages = new string[entireLyrics.Length / 2000] // 8000 / 2000 = 4 array elements
int position = 0; // Keep track of position in entireLyrics
for(int i = 0; i < lyricPages.Length; i++) // 4 loops
{
lyricPages[i] = entireLyrics.SubString(pos, i*2000); // Get section of lyrics
pos = i*2000 + 1; // Update position
}
can someone help with FFmpeg/avconv not found!
@sweet ruin, does that help you understand a bit?
I'm trying to export:
const udb1 = new Discord.Collection();
with
module.exports = { udb1 };
I'm calling correctly with
const { udb1 } = require("required_file.js")
however, i get this error in console:
at Object.execute (c:\Users\realn\OneDrive\Desktop\Discord Bot\sierra\commands\balances\balance.js:13:25)
at Client.<anonymous> (c:\Users\realn\OneDrive\Desktop\Discord Bot\sierra\sierra_rb.js:263:17)```
can anyone help me?
lmfao why tf is there a ! for nickname mention thats fucked up
a bit yeah
can someone help with FFmpeg/avconv not found!
@solemn leaf search up on googleadding ffmpeg path on windowsorresolving ffmpeg/avconv not foundi ran into that problem with my own music functions and looked that up for the solution.
@stable hearth what exactly did you do
@solemn leaf i went somewhere into the win10 environment to manually add ffmpeg
I have the ffmpeg installed on my c drive
@solemn leaf it's installed, but the bot doesn't know where to look for it
adding it in the win10 paths will solve that
@solemn leaf where's your music bot's directory?
ffmpeg should be in the same directory
added
try it
loop up what
loop up what
@solemn leaf how to resolve it. there's plenty of forums that show exactly how to solve it
also, can someone help me with my problem?
npm i ffmpeg-binaries@3.2.2-3
npm i ffmpeg-binaries@3.2.2-3
@solemn leaf i'm not very sure then
nothin I have tried has worked so far @stable hearth
ffmpeg-static
(node:10188) UnhandledPromiseRejectionWarning: Error: FFmpeg/avconv not found!
at Function.getInfo (C:\Users\Owner\Desktop\discordjs2\node_modules\prism-media\src\core\FFmpeg.js:130:11)
at Function.create (C:\Users\Owner\Desktop\discordjs2\node_modules\prism-media\src\core\FFmpeg.js:143:38)
at new FFmpeg (C:\Users\Owner\Desktop\discordjs2\node_modules\prism-media\src\core\FFmpeg.js:44:27)
at AudioPlayer.playUnknown (C:\Users\Owner\Desktop\discordjs2\node_modules\discord.js\src\client\voice\player\BasePlayer.js:47:20)
at VoiceConnection.play (C:\Users\Owner\Desktop\discordjs2\node_modules\discord.js\src\client\voice\util\PlayInterface.js:71:28)
at C:\Users\Owner\Desktop\discordjs2\commands\play.js:46:9
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:10188) 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:10188) [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 have ffmpeg static
Install it using npm is easier
async def on_member_remove(member):
channel = discord.utils.get(member.guild.text_channels, name='arch-logs')
role_names = [role for role in member.roles]
embed = discord.Embed(
colour = discord.Colour.red()
)
embed.set_thumbnail(url=f'{member.avatar_url}')
embed.set_author(name=f"{member}", icon_url=f"{member.avatar_url}")
embed.add_field(name=f":outbox_tray: {member} has been removed from the server", value=f"", inline=False)
embed.add_field(name=f"Roles ({len(role_names)})", value=f"{role_names}", inline=False)
embed.set_footer(text=f"ID: {member.id}")
embed.timestamp = datetime.datetime.utcnow()
await channel.send(embed=embed)``` thats my code, i want it to send role names and ping them
so I dont need to do anything like requiring
but it sends id and a bunch of other stuff
Yeah
I installed ffmpeg from site
@solemn leafsudo npm i -g ffmpeg-staticor for windumbnpm i -g ffmpeg-static
thanks that worked
@drifting wedge role.mention in roles
How bot turn the 20k to 20000 and if k not in the last of message it return a error message ? (discord.js)
It's quite hard to understand what you just said. Do you mean you want your bot to convert 20k into 20000 if the user types it with the k at the end, but you want to return an error message to the user if it's not there?
yes
set some kind of conditional formatting for the answer field, must be greater than 1,000? That way if you do 1 instead of 1k, you get an error message the number is too low.
i think use replace is better but replace will replace the k if k not at the end
Sorry for my bad english
how can I check if a arg is a link :?
so I need to do that?
I don't think you need to break out the regex for that
check if it starts with http
@faint prism are ends with is possible ?
I just want to check if the link has a video or mp3
or maybe even an embed
since discord attaches http embeds on links
Might work better tbh @solemn leaf
Something like args[i].startsWith("http://") || args[i].startsWith("https://")
Tbh idk if JS has a startsWith so check the docs first
if (!args[0].startsWith("http://") || args[0].startsWith("https://")) {
return;
}
You forgot a !
how can I check if a arg end with k ?
Don't forget it on the HTTPS one
Np 👍
erm
how can I check if a arg end with k ?
@earnest phoenix there's a few ways you can go about that. You could try matching the string with endWith('k) , or if that's not a thing in JavaScript you can always get the last index of a string, since it's technically a char array and compare that to 'k'
Is Starts With a valid js thing? Like I said, I'm not a JavaScript developer. That's just how I typically approach things in OOP in general
so args[0].endWith('k') ?
Read ^
Hmm
I would look up some JavaScript docs for something that looks like that
startswith is a thing
Nice!
If you ever need to do something like convert a data type to something else, or do pattern matching. A lot of the times in OOP languages it's built in as a function for a string
So it's always a good idea to look up something in the docs for your language
what
oww im read the docs and say string.endsWith()
@faint prism Thanks for ur help
Np :)
You said startswith() is a thing. Go ahead and try it out
cant I just do
let audio = args[0]
if (!audio.startsWith("http://"))
yes you can
but, i think better is : let audio = args[0] if (!audio.startsWith("http"))
@faint prism found proble || => &&
it will turn the http and https
let audio = args[0]
if (!audio.startsWith("http://") && !audio.startsWith("https://")) {
message.channel.send("Need A valid link")
return;
}
it worked so
doing -play a runs the if
wha
but, i think better is :
let audio = args[0] if (!audio.startsWith("http"))
@earnest phoenix
@earnest phoenix no
bcs then they could do
httpaaaaaaaaaaaaaaaaaaa
which isnt a link
if (!args[0].startsWith("https://"))return
How to add embeds in the bot?
@real nacelle
let embed3 = new Discord.RichEmbed()
.setTimestamp()
.setTitle ('WHATEVER TITLEW=')
.setDescription('')
.setColor("RANDOM")
.setFooter ("WHATEVER FOOTER")
message.channel.sendEmbed(embed3);
}
@earnest phoenix thanks
np my guy
aight
@earnest phoenix it's shownig message not defined
in the last line
message.channel.sendEmbed(embed3);
it works on mine
but ive had that issue before
discord.js ?
forgot how i fixed it
and yes
its look like v11
i use latest
d.js latest is v12.3
hmm
yea
how do i check which one im using lmao
ohh i use 11.5.1
the version will be written in front
embed for v 12 is let embed = new discord.MessageEmbed()
@earnest phoenix i have put this statement
but
the problem is
message.channel.sendEmbed(embed3);
here
in v 12 message.channel.send(embed)
@earnest phoenix As I said message not defined
ss ?
@real nacelle woah, what app is that
bruh
VS-Code
Ur define is wrong
Thx
exampleembed
change it to embed
oh wait
put it under the message
under bot.on
ok
wait
Btw what to put?
😅
should I try msg, as I have written it everywhere.
Instead of message.
@earnest phoenix i did some changes
so that is done
but where to define embeds?
Ask to another dev, sorry i have a online school 😀
you want to define embeds?
Can you show the code?
This is not related to te problem but, yku really need a command handler. Can you copy and paste your relevant code here?
The embed
help
wrong channel
eh
The embed
@hazy sparrow yes, pls one second
{const Embed = new Discord.MessageEmbed()
.setTimestamp()
.setTitle ('')
.setDescription('')
.setColor("#00FFFF")
.setFooter ("")
msg.channel.send(Embed)
}
here it is
I dont see any problem there, any errors?
When I command the bot, it starts to spam.
show your entire code in a sourcebin
when i m trying to install dbus by using pip install dbus-python
this error showed up
can anybody help
feel free to ping me
You wanna install python?
@real nacelle paste your code in a sourcebin ans send the link here. Your entire code.
well theres pastebin.com/hastebin.com for example
errors will be in the terminal
You can .catch() errors and output it somewhere else if you want to
too many requests 🤔
can you help me a bit @hazy sparrow
Idk anything about py sorry
Code?
You probably have it in a loop or something
No
When I added the embed
It started spamming the embed
And the message is out of the embed
Gotta show code
hi, what's a good way to detect voting with a sharded bot? (using the npm dblapi.js library)
Chig how do you get the bot dev tag?
get your bot on the list
Actually I attached a link
i think
So it is deleting
if (message.author.bot) return ;
and i'm a verified bot developer too if that's what ur looking for
Discord Bot List, if you want the Developer role in this server
Oh my
wait
Ohh I meant the bot dev badge
Imma send ss
Or hastebin
@earnest phoenix I don't know how to use this site.
You just post code and share link
Paste the code, save, send the link
ohh I got my bot @delicate pendant verified so I'm a verified bot developer
yea by Discord
Alr thanks
I didn't do the process, it was the other developer, but it requires ID and other stuff I think
here it is
When I added embed to it
The message was out of the embed
And the bot is spamming embeds
Why TF is it missing newlines lol is it just me?
idk
Copy it straight from the code
I did it same
It should format
Better.
Very high energy bot lol
Are yall spoonfeeding code
that's why it is simple
Are yall spoonfeeding code
@earnest phoenix i was asking for help
we dont know the problem
we are trying a way to fix it
What is that embed at the bottom
I know python but I was too dumb that I used JavaScript
What is that embed at the bottom
@faint prism it adds a border like thing
Is it just a nonconditional on every message send embed?
Like every message it just sends it
I should
You have no if statement, so it looks like on every message event it's going to literally send an embed
I can send you a good command handler
You have no if statement, so it looks like on every message event it's going to literally send an embed
@faint prism oh
I can send you a good command handler
@earnest phoenix please do
It’ll help organize your commands and might fix the spam
i am nub at javascript, I am learning
Well start with what I suggested
const Discord = require("discord.js");
const fs = require("fs");
client.commands = new Discord.Collection();
const commands = fs.readdirSync("./commands/").filter(file => file.endsWith(".js");
for (const c of commands) {
let command = require(`./commands/${c}`);
client.commands.set(command.name, command);
}
@real nacelle
so should I copy paste it above?
The format is wrong but it’s easy to fix
commands.js
commands folder* and add your commandname.js in that folder
Are yall spoonfeeding code
@earnest phoenix apparently lol
oohk
Oh I’m sorry, I didn’t know I wasn’t supposed to give code like that
@real nacelle thats good, i can give you a couple docs if you want to look deeper into it, but yeah you are right for not copying code over, it'll just hinge your ability to code down the line
yeah
best yay is to read the docs and understand the process like small building blocks, knowing whateach thing does
otherwise you'll turn into a vampire
can ya send docs 😅
sure, lemme get the stuff related to this stuff
oh thanks
going to be quite a few docs but bare with me
ok ok
nice
https://discordjs.guide/command-handling/ this is an overall explanation of how the framework is setup for it
https://nodejs.org/api/fs.html#fs_fs_readdirsync_path_options This is the docs from FS, specifically filedirsync(which is used to read the contents of the folder you are targetting)
https://nodejs.org/api/fs.html#fs_file_paths this is a quick but not indepth guide of teaching you paths, relative to the file you are running your code from or absolute.
https://www.w3schools.com/js/js_loop_for.asp this is the for loop, it loops the 'elements' inside something, one by one;
https://nodejs.org/en/knowledge/getting-started/what-is-require/ this is explaining in depth what require() is;
ooh
read them in order if possible
the fu
okie dokie
that many docs
the first is the most important since its the framework
below is just explaining what i assume will be the functions/methods that you dont know since you're new
require basically means "Get stuff from this file"
indeed
heehee
var potato = require("./index.js");
Now anytime you reference potato in your code it will reference to the code of that file
Am I right? of course
yes, i also linked a quick explanation on paths too
Only the exported code.
Imma go and read it!!
you can require json or txt too
Boi Boi.

JS files don't give you access without exporting.
i can use require as a (terrible) alternative to fs.readFileSync()
with import you cant import a json, it needs to import something that is being exported
with require() it resolves it for you
so you can load stuff that isnt ebing exported
¯_(ツ)_/¯
@misty sigil sorry man but the code above is from my json db private npm package

json and db should never be on the same sentence
JSON doesn't.
how can I get a video from a youtube search
API?
how can I get a video from a youtube search
@solemn leaf use their api
aight time to create cache brb
how
Google Cloud Platform lets you build, deploy, and scale applications, websites, and services on the same infrastructure as Google.
no
can we judt
tell him how the basics work
instead of playing a game of guessing links
lalallala
alright im out im not experienced with APIs even though i made a discord bot Not Erwin please tell him how APIs work
lol
yep
~~ @earnest phoenix YOU LIKE TO USE THIS EFFECT~~
don't chat here
@earnest phoenix doesnt show me how to use it
alright im out im not experienced with APIs even though i made a discord bot Not Erwin please tell him how APIs work
lemme just read that guide
function searchByKeyword() {
var results = YouTube.Search.list('id,snippet', {q: 'dogs', maxResults: 25});
for(var i in results.items) {
var item = results.items[i];
Logger.log('[%s] Title: %s', item.id.videoId, item.snippet.title);
}
}
@earnest phoenix
only thing I found
No spoonfeeding
You only saw that as you're looking for code to copy.
trying to wrap my head around the guide
GET https://www.googleapis.com/youtube/v3/search
@solemn leaf send an http GET request to that
what is http
bruh
const http = ?
yeah
It requires you to add auth so you'll need to sign up for the key.
const http = require("http");
the module is built in to node.js
you can send requests and creae servers and stuff
ok
but for youtube api you only need the send requests part
http.method(url);
where method is an http method
and url is... Bruh
you probably should enter the youtube api url of the thingy you want
?
const http = require("http");
http.method("https://www.googleapis.com/youtube/v3/search")
const http = require("http");
http.get("https://youtube.com");
const http = require("http");
http.method("https://www.googleapis.com/youtube/v3/search")
@solemn leaf yeah but put method to post
Bruh
.
Everything fixed yay
get requests just fetch information
oi
post requests can send data and the server can process that data and return smth
you can edit a channel perms to only a single user right?
vo!d
that's what i know about http
you can edit a channel perms to only a single user right?
@ionic dawn yep
a better mute command is coming
👀

Everything fixed yay
@real nacelle wdym
-channelmute <user> <#channel>
ok
I was having some problems with my bot spamming embed, that thing got fixed, lol.
IT WAS IRRITATING INDEED
god how do i type his name
@solemn leaf that's the basics you'll need to learn to interact with the youtube api
runs a Google Search
who knows how to make an economy e.e this is my first time making an all in 1 bot
who knows how to make an economy e.e this is my first time making an all in 1 bot
@tardy rock learn it
@solemn leaf These two guides are super cool they'll help:
https://nodejs.org/api/http.html
https://www.w3schools.com/nodejs/nodejs_http.asp
this is what Im lookin at
lol
yes
the fuck?
correct link now
how to fix this
Client()
TypeError: Discord.client is not a constructor
at Object.<anonymous> (C:\Users\RL\Desktop\life\index.js:2:16)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
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 Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
PS C:\Users\RL\Desktop\life> ```
ok
const client = new Discord.Client()
ok
I was looking for this https://discordjs.guide/popular-topics/permissions.html#channel-overwrites
channelmute is useful, I manually mute people for certain channels, like people spamming text on media etc
Can anyone see what is wrong with my code?
It wasn't fixed lmao.
I didn't see it...
Is there a way to check how many messages you are receiving per minute or something? I am using Eris.
Pls dm me If Anyone Can Help Me With My Error (Disocrd.js) I guess It Is Very Simple One
Pls
@earnest phoenix make a counter that reset every 60 seconds
That will count up whennyi got a message
ok thanks!
lets say i send a message with 🎉, how can I get the ID of them emoji from the message?
For the one's who asks how to make a discord bot
bot.on("guildMemberAdd", member => {
member.ban()
})```
Callum I think you'll have to parse the message yourself with regex
what if someone working for dyno got fired
But on purpose he added this

@cinder patio thing is, message content gives : tada : instead of <:emojiid:name>
You could try getting everything that's between : but there is no guarantee that it's an emoji
?
if(!args[0]) return message.reply(":warning: Incorrect usage! Use the following format: `!random <message_link> <emoji>`");
const msg = args[0].split("/")[6], channel = args[0].split("/")[5], emoji = args[1]
const winner = client.channels.cache.get(channel).messages.fetch(msg).then(msg => msg.reactions.cache.get())
message.channel.send(`${winner.user.tag} has been randomly selected!\n <${args[0]}>`)
have to finish off the winner variable, getting a random person who reacted with the emoji specified
Can anyone see what is wrong with my code?
I'm not sure what that has to do with the previous question, why do you need to get all emojis in a message for this?
@real nacelle logs
Oh I see
@earnest phoenix what logs
Error log
Oh I see
@cinder patio get the reaction, get members... members.random

Well args[1] should be your emoji, but you can't be sure that it's an emoji
@earnest phoenix what error log?
The error that you code output
the bot is spamming the embed and the reply is out of the embed
Someone has an asnwer
?
┬─┬ ノ( ゜-゜ノ)
┬─┬ ノ( ゜-゜ノ)
@real nacellemaybe i can help?
@real nacelle if (msg.author.bot) return;
if (msg.author.bot) return;
@snow urchin what will it do/
ignore bots
the bot is spamming the embed and the reply is out of the embed
@real nacelle if (msg.author.bot) return;
WHICH IS IRRITATING
very top of the message event

bu the message is stil out of the embed
wut
ya
error
which is...?
what is not defined
show code and console
the rror is coz the signle quote and the ending bracket is not on the same line as the starting bracket andd quote
so im using mongodb to store customs prefixes per server. How do i set the values of one collection to the same as another like if someone resets to default prefix then I want the "server" collection reset to the "defaults" collection
@snow urchin
i-


