#development
1 messages · Page 1379 of 1
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
"Private notifications" like "You changed your nickname from x to y" are done client-side
That might change however
@sage bobcat 👀
One message removed from a suspended account.
loadClientMessage(member,function(){
)}```
we need this
wdym?
Or, what did they mean, by natural?
Implement more features like polls and slash commands that will be connected to bots
slash commands, cant you already make that
if(msg.content.toLowerCase().startsWith("/command")) {
Yup, but they'll be more "convenient" and similar to the ones Discord client has (/nick, /giphy, etc.)
One message removed from a suspended account.
oh
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
no, @earnest phoenix
the point of it is that its not just polls
its whatever you want
How do i pick something random from a array? Current code:
let toPickFrom = ["Hi", "Hello"]
let picked = Math.floor(Math.random() * toPickFrom.length) - 1 + 1
console.log(picked)
Prints “1” in the console
idk i just tried something
let picked is a random number
its a random number that corresponds to a part of the array
so just put that number into the array
and it should work
js do be weird
its just random.choice(List) in python
How do I put it in place of array number? lol
learn javascript
toPickFrom[picked]
^ or that
Does JavaScript have a specification on how Math.random should be seeded
its a random number between 0 and 1
that's not the seed
oh i see what u meant
how it's generated is the seeding part
?
is it possible to create an announcement channel with discord.js?
i tried putting the type in guild.channels.create as news but nada
One message removed from a suspended account.
lol he deleted the message
@earnest phoenix I want a hypad squad bravery tag
How can I get @earnest phoenix
do u know js?
for inappropriate purposes
Do not ask for help with breaking tos in this server
^
This will be your only warning
is it possible to create an announcement channel with discord.js?
i tried putting the type inguild.channels.createas news but nada
lmao like we would help with tat
Can u. Tell me about this things @earnest phoenix
Means
Do not ask for help with that thing. It’s not allowed on discord
what
But how will I able to know about all this things
inappropriate message.
Your message
@vital anvil it’s not allowed. Stop asking
Don’t start drama val
It’s not needed
@earnest phoenix bro u also have the tag of hypad squad bravery I also want the same
How can I get
bruh
haha
here, simple and quick answer
@opal plank it's not coming in my device
open on desktop
This channel is for development support. Not discord support
@opal plank this will come in pc
@vital anvil this is not the channel for that. Look at discord support for help with it
did you bother reading what the mod told you?
Means for what is this channel ????
Programming, Coding, Development.
So can I ask for bot making
We do not make bots
You can ask for programming help, within the rules.
It’s for code help, not code giving
@umbral zealot im messing around with your enmap module and its pretty cool, nice job
Yes, that's pretty much the entire point of 90% of members on this server.
please consider reading the "discord guide" If you're new here! hoist
@earnest phoenix do u know how to make bot
wait how do you make discord bot
yes i know how to make a bot
@earnest phoenix will u plzzz tell me how to make
i reccomend you learn about the language you're going to use for the bot
Im not going to spoon feed you
@vital anvil #502193464054644737 message
@mint thicket and u r having a bot developer tag also
i reccomend you learn about the language you're going to use for the bot
@earnest phoenix english
...
i have impl with comand how do i use impl to connect to discord client libary
i program my bots in spanish
he really said bean can make it.
Make what, exactly
@vital anvil I didnt mean verbal language, i meant programming language
Bean, he's not taking u seriously. We need action!
I think I know what im doing, thanks
im pretty sure hes a troll yeah
Emma lmao what are you doing
big nate discord bot
he just doesn’t understand english very well i believe
but im actually doing it lmao
English , hindi
Oh my
How to make a bot
Step 1) learn a programming language (javascript, python, etc)
Step 2) choose a library in that language (discord.js, discord,py)
Step 3) actually start writing the bot
Step 4) ask for specific help if you need it
What lang is that?
impl apparently
@earnest phoenix now u tell how can I make bot
looks like a special snowflake language lol
What lang is that?
@slender thistle which??

"Industrial Modeling and Programming Language" ?

Anyone plss tell me how to make a bot
@vital anvil #development message
#502193464054644737 message
no sorry i dont know how 2 code
People have been trying to help you
And you are ignoring them
If you actually want help, I suggest you listen to them
Yeah I am listening g
You aren’t
But I am not understanding
You are ignoring the help and repeating your question
😶 😶
Coding a bot involves learning how to code and reading things. No one is just going to tell you how to do it. It’s not that simple
Then use what people are giving you. Look at the channel pins, the links
i suggest learning how to program in general first
There are so many resources, you just need to use them
yeah lol
We aren’t here to hold your hand and show you every little step
Because your name was hoisted
Means
Has special characters in the front
To put you at the top of the list
It’s not allowed here
So. If I was to route a NAS setup from my apartment, to my dedicated server in Germany, how terrible would that be on a scale of 1-10
My speed to the dedi is sitting at 120mb/s
I'm debating how "worth it" it is to rent block storage monthly vs buying a few hdds
What's this
where in the world are you
You have a Server in Germany? How come
Cheaper
if you're in the usa i dunno if i'd do that
I'm in the US yeah thats why I'm like ehhh
It'd be a lot of hops for any sort of file transfer so
probably depends full on your site, since its an german server
I'd most likely use ZeroTier as the network manager
yeah it depends what you're doing
Moving files back and forth
is it possible to create an announcement channel with discord.js?
i tried putting the type inguild.channels.createas news but nada
ah interesting
But tbh, i dont know how the German Server can be the cheapest.
Its 100$ a month for most block storage providers for 1tb
I have 16tb raid myself
So its like. debatable I guess
never heard of those, anyway. depends fully on your Site, i cannot tell you how it will be in the end.
True yeah
moving so much data from a to b seems kinda dangerous.
yeah
Yeah
because you dont know what will happend if you lose like 100gb data for example.
Maybe its time to buy a rack server of my own lol
So before I buy a domain, how exactly do I hook it up to my express?
Yeah
Its all about DNS setup
The only problem I see here is that who will sacrifice themselves to say that it was their fault if data is lost.
invest
haha
Nah they are usually around 100
hmm
didnt knew.
id recommend doing your dns on cloudflare if possible
makes everything super easy imo
better if you dont rent a server around the world
but anyways point an A record to your VPS's ip address and you should be good
if you use nginx or apache or another proxy/server youd have to set that up as well
i can't help too much on that as there are a ton of stuff you can do and i barely know nginx and don't use apache
and it just spams the thing
https://hastebin.com/pofepixiqa.js (i know its terrible code)
With flask, how can I get the input from a text box and put it in a body tag?
Ping pls
Hello developers
Hi
a bot is just like a user
When searching for it
Other then the properties it returns
${}??
so you can call .createdAt()
iirc yes
@clever vector client.user.createdAt
i knew it
Thanks bro because i go to whois and find the user created at
Thanks 🙏
ok np
Hi
Hi
hi
With flask, how can I get the input from a text box and put it in a body tag?
@drifting wedge blind poke into the dark: see if request.form does what you need
How do I show how many servers my bot is on on topgg?
I know I need the topgg apo
But I can't find how to do it
my friend had a problem with his code...
PS C:\Users\erezm\OneDrive\Desktop\desktop\GAMES\discord\mybot\node_modules> node .
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'C:\Users\erezm\OneDrive\Desktop\desktop\GAMES\discord\mybot\node_modules'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
PS C:\Users\erezm\OneDrive\Desktop\desktop\GAMES\discord\mybot\node_modules>
thats the error
you are executing node . in node_modules directory
okay i will tell him
@clever vector where is your bot hosted
@summer torrent Heroku
hey could anyone help me on installing docker on wsl 2 in windows
sudo apt install docker if ur on debian/ubuntu
actually i have a two options i think while installing the docker
one i can use this https://docs.docker.com/docker-for-windows/wsl
or other is yours using apt command
i wanted to ask if there will be a difference afterwards if i install using this link
or they are the same
https://docs.docker.com/engine/install/ubuntu/ i have this link too
use that first one
should i install docker for windows or docker for linux !!
use that first one
@storm cliff i am kinda concern about what if run into some problem afterwards !!
cause i will be downloading on ubuntu(which is linux vm or something )
how do you make emojis not take any space?
i want the emojis to be joined so that it looks like a "bar"
hi im new to discord.py i started it 2 days ago
but there's a gap between them
so does anyone know how you can make a cmd handler in py?
how do you make emojis not take any space?
@crystal wigeon dude just go to the left of the second emoji and hit backspace
lmao
i even cropped the exact shape ;-;
idk then
without additional space
so i wrote this today.... pull requests welcome, if you think it can be improved.
https://github.com/brainboxdotcc/tutorials-and-howto/wiki/Discord-Bot-verification-in-plain-English
Make one in scottish
Scottish is identical to English, just pronunciation of words is different.
Unless you mean Scottish Gaelic
can we pass an array to check if the bot has all the required permissions?
bot says it has "EMBED_LINKS" permission even when it doesn't th?
is there any api whose help I can take to auto backup database files in python
if (guild.me.hasPermission("EMBED_LINKS")) is this statement correct? it returns true even when the bot has no embed permission but then while sending the actual embed it says missing permissions
check channel overwrites too; channel.permissionsFor(guild.me).has("EMBED_LINKS")
since it checks for the permission globally, which is under the roles settings
channels can have permission overwrites which overwrites those "global" permissions specifically on that channel
I'm trying to add an image to my embed, but for some reason it doesnt want to send the image inside of the embed
const {body} = await superagent.get("https://minecraftskinstealer.com/achievement/a.php").query({i: 1, h: "Achievement get!", t: text});
let achievementEmbed = new MessageEmbed().setColor("#eab437").attachFiles(body).setImage(`attachment://body.png`);
message.channel.send(achievementEmbed);
Do you have css code to change the button colors of the bot page
attachFiles() takes an object as a parameter and should be used like
<MessageEmbed>.attachFiles({
attachment: <BufferResolvable>,
name: <String>
})``` @kind thicket
ah, thanks!
so i have this error
TypeError: Cannot read property 'users' of undefined
This is code.
const user = message.mention.users.first();
message.mention isnt a thing
message.mentions may be what you want
does anyone know about Core Java ?
what
how do I fix this
Error: input stream: Error parsing info: Unable to retrieve video metadata
at getWatchPage (/home/runner/Discord-MusicBot-19/node_modules/ytdl-core/lib/info.js:75:13)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async exports.getBasicInfo (/home/runner/Discord-MusicBot-19/node_modules/ytdl-core/lib/info.js:84:22)
at async Map.getOrSet (/home/runner/Discord-MusicBot-19/node_modules/ytdl-core/lib/cache.js:24:19)
at async exports.getInfo (/home/runner/Discord-MusicBot-19/node_modules/ytdl-core/lib/info.js:226:14)
at async Map.getOrSet (/home/runner/Discord-MusicBot-19/node_modules/ytdl-core/lib/cache.js:24:19)
Which version of ytdl-core are you using
How do I find out
In terminal do npm ls ytdl-core
ytdl-core@3.4.2
Done.
Now restart the bot and try again


I got another issue
from 1 of my other music bots
Segmentation fault (core dumped)
it uses ytdl-core@4.0.3
I have a question about DBL vote bot. How to make it to send a message every time some1 upvotes the server
@green kestrel probably putting nicknames in the Data collection is a bad example, that falls under end user data
or at least mention that keeping end user data is a VERY, VERY bad idea overall unless you got your database properly encrypted(which most dont)
@supple oriole Are you using ubuntu
Nope
Linux?
@drifting wedge blind poke into the dark: see if request.form does what you need
@slender thistle it does, but not exactly, I want it to update live
const { play } = require("../include/play");
const { YOUTUBE_API_KEY, SOUNDCLOUD_CLIENT_ID } = require("../config.json");
const { MessageEmbed } = require("discord.js");
const ytdl = require("ytdl-core");
const YouTubeAPI = require("simple-youtube-api");
const youtube = new YouTubeAPI(YOUTUBE_API_KEY);
const scdl = require("soundcloud-downloader");
Is it possible?
@supple oriole That doesn't help
Is a bot dev
Doesn't know if he uses linux or ubuntu or whatever
I have a question about DBL vote bot. How to make it to send a message every time some1 upvotes the server
Is a bot dev
Doesn't know if he uses linux or ubuntu or whatever
@earnest phoenix yes
pog right there
@tranquil yoke webhooks, and you need to tell us which language you using
.
@opal plank what should i do
im gonna pretend i didnt read that
How to
Wrong server then
?
?
go to that server for support for dbl vote 4head
alr alr
const entry1 = await guild .fetchAuditLogs({ type: "MEMBER_KICK" }) .then(audit => audit.entries.first()); console.log(entry1.executor.username);
const entry = entry1.executor;
iguild.members.cache .get(entry.id) .ban()
});```
Why this code is don't work
I mean like a guildBanAdd
you need guildMemberRemove lol
let me check
Ok
my friend is trying to make a music command, and i dont remember how to download ffmpeg
@tardy hornet
sudo apt-get install ffmpeg
npm install ffmpeg-static
I've got a question
So I have this fancy play/pause button thingy for my stuff where when you press it it changes from play to pause or vice-versa and the audio does what it's supposed to. The buttons are just an img element inside a blank button element.
But everytime I click it, the image has to be reloaded again from the server and it takes a significant time to load. Is there a way to "preload" media so the browser can just re-use it whenever it's needed (instead of loading it again from the server)?
@pale vessel i use this but don't work i use
bot.on("guildMemberRemove", async member => {
const entry1 = await member.guild .fetchAuditLogs({ type: "MEMBER_KICK" }) .then(audit => audit.entries.first()); console.log(entry1.executor.username);
const entry = entry1.executor;
member.guild.members.cache .get(entry.id) .ban()
})
thanks
do you have the guild members intent?
you need that intent for events that involve with members
@pale vessel i can't turn on it
then you need to ask support for those
@umbral zealot how i can,
i need fix it fast because my security bot in 760 guilds
Ow i don't like it 😅
poison destroys poison
discord kills discord
Nobody does, but then, everyone had 6 months to prepare and were given ample warning, and a chance to request them during verification.
if i just send a GET request to a resource on my server through JS and use it later in the HTML document the browser won't reload it right?
wdym if you "just sent a get request"
Instead of... y'know... just <link rel="preload"> ?
if you keep it in a variable somewhere, it wouldn't reload, i guess that's what you mean?
thonk
like so:
<script>
axios.get("some resource");
</script>
<!-- later down in document -->
<img src="some resource">

preload works in the background but i want the page to load AFTER the preload
(fancy way of saying synchronous)
why in heavens would you need that
¯_(ツ)_/¯
sounds like an x/y problem
i wanna load the resource AFTER page load then use it later after it's done loading
So instead of pre-loading, you want to post-load and wait for it, making your page loads longer?
how does that make sense?
what the fuck
idk
Like, the link I sent, all you need to do is to add the <link rel and then use the image normally, you don't even need a script
doesn't it already do that? the image loads after the page is done loading
yeah literally that's what an <img> tag does, load the resource after the page has loaded and display it once it's done 😂
the interactable stuff like buttons and input elements load faster than the images and audio files so if for whatever fucking reason people try to use those before the media files are loaded it just breaks
bruh
Oh so this has literally nothing to do with images and it has to do with audio files then
i said media earlier but used an img example
Guess you're gonna need to learn how to check whether an audio file has finished loading and disable the button until it's done.
how to google (2020) by Evie Codes
I mean honestly, that's literally what a good dev is
someone with higher google-fu skills
yeah, i got used to coding by googling problems that i encounter
works 90% of the time
docs help too
how i can remove 1 item from db like ["item1", "item2"] i want to remove item2
(quick.db)
@dense topaz
thanks
any docs or guide on how to make a bot give role when a member votes for a server on top.gg ?
so guys, I have my bot, but the way I do it's testing is by updating the bot itself. How do I create a clone without copying the whole code just for testing before updating?
Create a separate account for your bot and use its token in replacement of the main bot.
That's how I do it.
seems like a good idea, ty
Hi
Can I see the user number for a guild with my bot with the API Discord.py v1.5.1 please ?
@bot.event
async def on_message(message):
if message.author != bot.user and message.content:
global counter
if counter == None:
counter = 0
else:
counter += 1
print(counter)
hi
it says counter isnt defined
plz help
what are you doing
global 
@vale garden You count a member when he send a message ?
They help me?
Someone tell me how my bot makes it play music with a link, it works with discord.py
you're creating a global on every message
Define the variable on module level, probably right after declaring the bot object
then just edit it
I can see the user number for a guild when my bot join or I must wait a message from every member ?
@hard anchor
hi
if u choose youtube
yea
... with youtube I dont know how to stream music with youtube api
and this is ilegal
Which one would you recommend?
and if u download youtube song is ilegal to
xD
my bot...?? my doesn't have music commands
but
streaming music from youtube on any other service than youtube is illegal but youtube is relaxed about it
but u have pytube
appears
spotify on the other hand is willing to take you to court lol
@hard anchor if u want to download songs u can use pytube
and then with
ffmpeg play music
u have to pip install pytube
and pip install ffmpeg
I just need code, I am using ffmpeg
Thanks

Can you pass the code to me through discord or through github?
Ok
spotify on the other hand is willing to take you to court lol
@earnest phoenix so if you use songs in your stream, that’s illegal?
from Spotify
yep
bruh
How do I get my bot to send memes? I may seem very stupid but I don't know lol
Button in my bot page is not working.
@hard anchor ...
I am very new to python
thanks
This button in which Add To Discord is written is not working
Show the html
How can I create guild invite url?
does it have the <a> element?
Show the html
@thin turret me?
Yes
ok
can i use github?
yes
thanks x2!
<button class="glow-on-hover" onclick=" window.open('https://discord.com/api/oauth2/authorize?client_id=756482934533259315&permissions=8&scope=bot','_blank')" type="button">ADD TO DISCORD</button>
</div>```
it would be easier to put the button inside of a <a> element imo
A way to simplify would be to use
<a href="http://link.com">
<button>Btn</button>
</a>
but if u want to have other language memes u have to use oficial Reddit api
api needed for github? I didn't know that haha
nop
thanks
api is a part of code that makes ur life more easyer
github is a plataform where u can post ur code and more things
are completely different
@thin turret yup xD
in short github is just a place where people post open source for other people to use, or they make a private repo to host code on a cloud like heroku
in short github is just a place where people post open source for other people to use, or they make a private repo to host code on a cloud like heroku
@vital geyser hummmm.
that's a nowhere near a correct definition
it's a git repository host
just because the code is open source does not mean you can steal it and use it
licenses exist
yeah basically its used for people to post code
So where can I host memes?
and github is made for open source
a CDN
get a small server to host it on or upload your memes to an image hoster
using a github repository as an image hoster goes against their guidelines
and no it isnt @vital geyser
yeah github sites, a feature they provide
How much is it to host sites
it’s free
Pogchamp
but you have to pay to make ur repo private
I see
but that isn’t bad since you can use .env or SQLite for database stuff
Im just looking to make a simple static site so it wont be a big deal
yeah github sites is made for that
Private repositories are free, no?
up to 3 for basic accounts iirc
Private repositories are free, no?
@slender thistle GitHub pages requires you to have pro to private them.
hi can someone help me out im new to py
def check(m):
return m.author.id == message.author.id
msg = await bot.wait_for('message', check = check)
if msg.content.lower() == pkmn_list[rand_no][0]:
await message.channel.send(f"Congratulations {message.author}! You caught a {pkmn_list[rand_no][1]}!")
else:
await message.channel.send("That is the wrong pokémon!")
check()
over here i need to execute the function again when i hit the else block but i have to also specify the value of m, so does anyone know what i can do
And I assume github sites enables the use of fullstack node applications?
let xx = db.get(rns_${guild.id})
if (xx === null) xx = "None"
but i got array [] and i wont to set it to "none"
like if(xx === "[]") xx = "None"
any help

I'm sorry what
You want to set an array to "none" if its empty?
yes
SetRedditPost(msg, "meme");
}, 5000);``` Didn't work.
@dense topaz if(!xx.length)
I want that function to run every 5000 seconds, but it didn't work.
5 seconds or 5000 seconds
Interval is not a function
Yeah.
Are you trying to do Interval() anywhere?
Yes.
Well dont
You would have to wrap it in a function
setInterval returns a number, corresponding to the interval id, in case you want to stop it some time
thanks Tim
Otherwise the moment you create a setInterval, it already starts running
Oh. I was trying to get it to run every 5 seconds.
Its alrwady running every 5 seconds
hi can someone help me out im new to py
def check(m):
return m.author.id == message.author.id
msg = await bot.wait_for('message', check = check)
if msg.content.lower() == pkmn_list[rand_no][0]:
await message.channel.send(f"Congratulations {message.author}! You caught a {pkmn_list[rand_no][1]}!")
else:
await message.channel.send("That is the wrong pokémon!")
check()
over here i need to recurse the check function when i hit the else block but i have to also specify the value of m, so does anyone know what i can do
^^ posting this again coz no one answered
You dont need to do anything
Ye
var Interval = setInterval(function() {
SetRedditPost(msg, "meme");
}, 5000);
} ```
So just like that?
You dont even need the Interval variable if you plan to make it run forever
ah
^ lol
So I should delete the var?
Ask your question
Ye
Don’t ask if you can get help just ask
i already did
hi can someone help me out im new to py
def check(m): return m.author.id == message.author.id msg = await bot.wait_for('message', check = check) if msg.content.lower() == pkmn_list[rand_no][0]: await message.channel.send(f"Congratulations {message.author}! You caught a {pkmn_list[rand_no][1]}!") else: await message.channel.send("That is the wrong pokémon!") check()over here i need to recurse the check function when i hit the else block but i have to also specify the value of m, so does anyone know what i can do
^^ posting this again coz no one answered
@vale garden
Oh
Thanks.
I don’t do py with discord bots I do it with other stuff so can’t really help lol
kk
you want to say the value of m?
m
yes i do
Is that rewrite python?
should be m.content then
rewrite discord.py*
rewrite or old one
uhh idk
rewrite
wait where are you putting it?
yea in the else block
wouldn't that be a loop?
you need to provide the same context, otherwise m in the next function would not be defined
check(m)
can i even do that outside its function
is there a way to see all server names & ids with an eval command?
(for support & research purposes)
Yes, but it will likely exceed the character limit
Yes
U
huh
can i even do that outside its function
@vale garden not outside, inside
here
just provide m to the function so that it won't be undefined

@vale garden not outside, inside
@pale vessel but when i put the entire thing inside the check function the messages arent sent for some reason
can you show the code?
def check(m):
return m.author.id == message.author.id
msg = await bot.wait_for('message', check = check)
if msg.content.lower() == pkmn_list[rand_no][0]:
await message.channel.send(f"Congratulations {message.author}! You caught a {pkmn_list[rand_no][1]}!")
else:
await message.channel.send("That is the wrong pokémon!")
check(m)
this is how it would look if everything was inside
i'm not sure why you need to repeat the function anyway
if it's the wrong pokemon then it's wrong...?
ah, isee, you're using wait_for
you should separate all code after return inside a command
check is only for checking whether the author is the same as message author
and remove that check(m) inside that else block
yeah ik
so i just need the if else
right
@pale vessel
def check(m):
return m.author.id == message.author.id
bot.command()
async def catch(ctx, arg):
global rand_no
global pkmn_list
if arg.lower() == pkmn_list[rand_no][0]:
await ctx.send(f"Congratulations {ctx.author}! You caught a {pkmn_list[rand_no][1]}!")
else:
await ctx.send("That is the wrong pokémon!")
i did this
and now for some reason
it doesnt send anything
why are you using your args?
i thought you wanted to wait for new messages
also, it's @bot.command()
oh shit
lmao how did i not realize
tq
now i had to type the name of the pokemon
which is now an arg
it was supposed to be like this by the end anyways
why don't you use wait_for inside the command?
no cuz the command is p!catch <pokemon> so i dont need a collector
btw i fixed it but it still doesnt work
you can still use a collector
ic
why is there py global rand_no global pkmn_list
wouldn't the random number be the same on every message then?
whats the new code
import discord
import os
import random
from discord.ext import commands
bot = commands.Bot(command_prefix = "p!")
counter = 0
pkmn_list = [["pidgey", "Pidgey", "https://bit.ly/3mnlSnt"], ["pidgeotto", "Pidgeotto", "https://bit.ly/2TpN9t5"], ["pidgeot", "Pidgeot", "https://bit.ly/3jswCPO"]]
@bot.event
async def on_ready():
print("Hi!")
await bot.change_presence(activity = discord.Activity(type = discord.ActivityType.playing, name = f'p!help on {str(len(bot.guilds))} servers'))
@bot.event
async def on_message(message):
global counter
global pkmn_list
rand_no = random.randint(0, len(pkmn_list) - 1)
if message.author != bot.user:
counter += 1
if counter % 3 == 0:
embed = discord.Embed(
title = "A wild pokémon has appeared!",
description = "Guess the pokémon and type `p!catch <pokémon>` to catch it!",
color = 0x00ff00
)
embed.set_image(url = pkmn_list[rand_no][2])
await message.channel.send(embed = embed)
def check(m):
return m.author.id == message.author.id
@bot.command()
async def catch(ctx, arg):
global rand_no
global pkmn_list
if arg.lower() == pkmn_list[rand_no][0]:
await ctx.send(f"Congratulations {ctx.author}! You caught a {pkmn_list[rand_no][1]}!")
else:
await ctx.send("That is the wrong pokémon!")
this is the full code
without the token part
ok thx
Hey uh
Whenever I am clicking on embed links to join a vc
Bot doesn't make me join vc
help pls
ReferenceError: member is not defined
client.commands.get('kick').execute(member, message, args);
execute(member, message, args){
whats member defined as
Learn js
and learn js
how to define a variable?
(kidding)
Is there like a way to use readline in discord? I know I can use awaitMessages and message collectors, but is it possible? Just wondering
hey is it possible to create a announcement channel in discord.js? i tried doing let announcement= await message.guild.channels.create('announcement',{ type:"news" }); but nada
readline can only view local interfaces - discord isn't a local interface, @midnight blaze
I see
messages come in through the message event, or collectors as you already know.
So I'm making an auto responder for my bot. I have an array of objects each object contains trigger and a response. If i add a auto response with trigger test and then add another trigger called test123 it will still respond to me with response of test trigger.
Here is my code for finding the triggers
const foundRes = data.autoRes.find(x => message.content.includes(x.trigger));
anyway i can fix that?
the code I'm using returns me an first object that the app found in responses array
I need i bot cazino ?
message.content.split(" ").map(y => y.includes(x.trigger)).includes(true)
Callum will it return a boolean or the object it found in the array
const foundRes = data.autoRes.find(x => message.content.split(" ").map(y => y == x.trigger).includes(true));
??
message.content.split(" ").map(y => y.includes(x.trigger)).includes(true)
@snow urchin wtf
Try my one above, I updated the message, had a typo
ok
i don't think that's what they want
ok now that works
what then just use data.autoRes.find(x => message.content == x.trigger);
oh wait nvm
split the spaces if you need to
split the spaces if you need to
need to what
it doesn't work if its somewhere in the message now
it wont work if its in- yea
hmm
so data.autoRes.find(x => message.content.split(" ").includes(x.trigger));
Am I allowed to request some help with discord.py?
yes you are
You are not allowed to ask if you are allowed
oh
$m
I mean I have a bit of a problem. So I've been trying to add a ''changeprefix'' command to my bot, how it works is that it puts the individual prefixes for each server/guild in a separate json file. I've imported json, but it still cannot find the file. Its in the same directory. I'm on Windows 10 and have Python 3.8.1 if that helps
How are you loading it? Can you show the code?
okay
Yeah show how your calling the file
import discord
import json
import datetime
import random
from discord.ext import commands
from discord import Intents
def get_prefix(client, message):
if not message.guild:
return commands.when_mentioned_or(">")(client, message)
with open('prefixes.json', 'r') as f:
prefixes = json.load(f)
if str(message.guild.id) not in prefixes:
return commands.when_mentioned_or(">")(client, message)
prefix = prefixes[str(message.guild.id)]
return commands.when_mentioned_or(prefix)(client, message)
client = commands.Bot(command_prefix = get_prefix, case_insensitive=True, intents=Intents.all())
client.remove_command('help')
and then uh
@client.event
async def on_guild_join(guild):
with open('prefixes.json', 'r') as f:
prefixes = json.load(f)
prefixes[str(guild.id)] = '.'
with open('prefixes.json', 'w') as f:
json.dump(prefixes, f)
oh
I left the imports at the top on purpose just so you guys could see that I've imported json
I've been trying to fix this issue for almost two hours now
And I knew there were some pretty talented coders in this discord, so I just came here for help :(
yeah
The script loads up and connects to discord
then when I try to use a command
starts the FileNotFound error
Probably should have mentioned that first, apologies
Can you show the full error?
Oh my god
I am so sorry
File "C:\Users\XXX\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\utils.py", line 331, in maybe_coroutine
value = f(*args, **kwargs)
File "c:/Users/XXX/Documents/XXX Data/XXX/XXX Dev/XXX.py", line 15, in get_prefix
with open('prefixes.json', 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'prefixes.json'
any docs or guide on how to make a bot give role when a member votes for a server on top.gg , or log the vote in a channel?
hi, im getting "NameError: name 'ctx' is not defined" in my kick command. anyone know why? heres the code:
@commands.has_permissions(kick_members = True)
async def kick(ctx, member: discord.Member , *, reason = f"Kicked by {ctx.author.name}"):
await ctx.send(f"{member.mention} has been kicked from {ctx.guild.name}. ")
await member.send(f"You Have Been Kicked from {ctx.guild.name} . Reason = {reason}")
#if no reason is provided then the reason will be kicked by <name of the person who kicked>
await member.kick(reason = reason)```
is there a way to do app.use() for multiple endpoints at once (express)
@earnest phoenix does it say what line
await member.send(f"You Have Been Kicked from {ctx.guild.name} . Reason = {reason}") this one
wait wrong one
s
async def kick(ctx, member: discord.Member , *, reason = f"Kicked by {ctx.author.name}"): this one
dont know why
What are some good sites to practice programming skills (similar to Leetcode)?
wait
you have to set the default reason inside the function
There's some good websites like W3 schools, but there's also a few good small coding youtube channels like o2 Coding or Lukas
What are some good sites to practice programming skills (similar to Leetcode)?
idk what the hell that means
bruh
@proven cliff he is a pogrammer not learning
i know im a idiot
nah you're not
kanye you use py
yes
i'm an idiot for not explaining
use brain too
Minoteur I'm talking about websites where you basically solve a problem they give you.
For example, if they ask you to reverse a string, you write a program and they test it
Ah yeah I get what you mean
reverse a string eh
w3 schools used to have that
that cant be too hard
No idea if they still offer it
ask voltrex i think he knows
Dice yeah that's easy (I just came up with that one on the spot). the actual questions are quite difficult for me
is there a way to do app.use() for multiple endpoints at once (express)
also if anyone could nyAAAAAAA that would be nice
example
app.use("/", [array of routes])
yay i fixed it
also git stage doesnt seem to work for me, ive tried git stage filename and git stage . (and then pushing) but it workn't
yay i fixed it
@earnest phoenix can i see what you did, just curious
yea hold on
fLaZePe PePeMoN
can you put gifs into embeds? I can't remember if this was possible
help me
async def kick(ctx, member: discord.Member , *, reason=None):
can you put gifs into embeds? I can't remember if this was possible
i believe so, with theimagearg
can you put gifs into embeds? I can't remember if this was possible
@split siren yes
also i made my first embed its very cool
fun stuff
and did you have something like this or whatpy if reason is None: reason = f"Kicked by {ctx.author.name}"
idek if that would work tbh
revert commit
get the desktop client
S h i t
git, saving the day
the stupid content tracker
One hours dev
Spotify activies detection and progress Bar xD thx @earnest phoenix ur inspir me
xD
I don't know how to revert send help

@pure lion wdym
I mean
When I try to commit it says that everything is up to date
But the files on my vps don't match those on the repo
pull from origin
Why
wdym
you said it doesn't match the repo
pull the repo again and it'll detect changes on your vps
Ah
is there any way for me to tell how much time has elapsed since the start of a js program?
yes
It says already up to date
process.uptime()
ok thx
it's in seconds
is that in node.js?
yes
@pure lion did you fetch it first
dont think you need to though
git pull already does that
thanks
@pale vessel its nOt WORKiNg
give me access to your vps and repo so that i can delete everything /s
have you tried looking at your files in filezilla
@pure lion cant find the repo
is it public
its like one file
Exactly
dude
:)
i thought you already reverted them like i said
My vps
No I'm on my phone
I do
but?
It's currently ssh
what
Yes
is it running windows
so git revert
wait no
s
the files are there?
not on the repo
no you mean it's not updated on github
is it possible to check a user is in a guild using discordjs without using cache (due to privileged gateway intents)
guild.member(ID)
that uses the cache lol
that's cache
guild.members.fetch
wait you can do that?
yes
you just can't fetch all members at once
cries
im not sure if that does REST or WS though, im guessing WS if options are defined
yeah if you have withPresences on then it will use WS
i am officially the dumbest human alive




