#development
1 messages ยท Page 1407 of 1
Like
it logged that
you need to enable a web dyno
I don't understand you, I use a bot to catch Pokemon, but for some reason I have numbers instead of emojis
how would i do that?
Don't spam
what the fuck
Tim i have another problem! when i do the "!start" command it says "TypeError: Cannot read property 'send' of undefined"
Some help for me?
do u know why?
Guys ๐ฅบ
somewhere in your heroku configuration, not sure exactly where, never used heroku
there should be an option for "dynos" and a toggle to switch a "web dyno" on or off
Help pls
scroll up an bit and follow my conversation with vanillataco, we are going over top.gg webhooks in heroku
why do you have an extra else there
but i dont think its the web dyno thingy
need to delete it?
oh god the syntax errors
ur return
does someone help me?
put it in the same line as if(message.author.bot)
that?
๐ฆ
no one help me
Done thaks
TypeError: Cannot read property 'send' of undefined
yes, enable web
still says it
aight
thanks
(node:11) Warning: Accessing non-existent property 'Message' of module exports inside circular dependency
uh
i also said how to fix that to vanillataco
:}
u remove the }
line 20\
(node:11) Warning: Accessing non-existent property 'Message' of module exports inside circular dependency
uh the error only pops into consol,e on my host, on my pc it wont have the error
idk if its important
you screwed up your module.exports
but msgs are very used in bots so idk if i needa fix quick
:(ok
thats syntax which is ez to fix so like its not something to like reinstall djs right
if i delete that one more err shows
ok aperantly that web dyno runs the npm start <file> script,how do i change it to the web dyno that u mentioned?
Those errors need to be solved too.
Whats the difference between them
that means you're making progress
not
pls someone help that
Worker i know it helps in keep app online
would it be in the index file or in a command file
But what is web?
So i need sum help with Js/Ejs and here is what i need help with.
Alright so on profile.js, I am trying to get example req.user.username into my ejs file so i have done
router.get('/', isAuthorized, (req, res) => {
res.render('profile', {
username: req.user.username,
email: req.user.email
});
});
And on the profile.ejs file I have done the following:
<%= username %>
So that way I would be able to display the users name on my html.
But every time I put <%= username %> in the ejs I don't see the username on the http://localhost:1000/profile and no errors.
All Images Below.
https://cdn.discordapp.com/attachments/730797139604668486/780801165482262539/unknown.png
https://cdn.discordapp.com/attachments/730797139604668486/780801480579350528/unknown.png
https://cdn.discordapp.com/attachments/730797139604668486/780802044453191720/unknown.png
web runs a webserver where you can receive requests
Ohh thanks
@solemn latch sorry for ping but can u elaborate if ur helping me on that msg
if not sry
because all my other bots dont have the error
it could be anywhere where you export and require stuff
and it looks the same
do you have exports in your index file?
no like
in command files i have module.exports
but in every file i have require()
ah ok
are you accidentally requiring in a circle?
require file A which requires file B which requires file A
any examples?
I mean, my files all require fs, djs, 2 json files
but index has like
other collections
// file A.js
require("./B.js");
// file B.js
require("./A.js")
if one of your files requires another one of your files
and that other file, requires the same file again
keep in mind that the error only cvomes on my host
if i run it on my pc it wont occur
or it wont log it
its the same code ('shjould be, i tranfered it like 30 mins ago')
did you transfer the node_modules folder?
yep
dont
uh
node_modules should never be transfered
well before i did it was an empty directory
so i cant run the bot like that,,,
unless it has built in feature to instlal things from package.lock?
npm i...
i cannot send cmds in the host console lol
you should transfer package.json, then run npm install in the host
wait i think i can
sorry
im dumb
im supprised only thar bot has the error then
cause ive always tranfered the node modules and my other bot is fine
Its a bad practice, especially when changing OS
it doesnt necessarily cause problems, but it opens up a lot of opportunities for problems to occur
shoot yea the host is on linux or sum yea
if you have a native module like sqlite, it will crash if you move it to a different OS
@quartz kindle hey sry for ping if i enable both web and worker it sends message double
i use json for storage AND BEFORE i get bombarded with ppl sayin its corruptible the bot is small so no one uses it anyway
You closed your { on the line before it
yes
idk but did he set his linter to do that or sum extension
Tim if i enable web and worker it sends message double
No, the IDE expects a ), not a const statement
[..................] / rollbackFailedOptional: verb npm-session 017a8967a25b61d [ ................] | loadDep:ws: sill install loadAllDepsIntoIdealTree [ ...........] \ postinstall: sill install executeActions [ ...........] / extract:fs: verb lock using /home/container/.npm/_locks/ [ ...........] / extract:fs: verb lock using /home/container/.npm/_locks/ [ ...........] / extract:fs: verb lock using /home/container/.npm/_locks/ [ ...........] / extract:fs: verb lock using /home/container/.npm/_locks/ [ ..........] / extract:mime-types: http fetch GET 200 https://registry. [ ......] / extract:tweetnacl: sill extract tweetnacl@1.0.3 extracte [ ......] / extract:tweetnacl: sill extract tweetnacl@1.0.3 extracte [ ......] - extract:discord.js: sill extract discord.js@12.4.1 extra [ ......] - extract:discord.js: sill extract discord.js@12.4.1 extra [ ......] - extract:discord.js: sill extract discord.js@12.4.1 extra [ ......] \ refresh-package-json:fs: timing action:finalize Complete npm WARN OXYGENSecurity@1.0.0 No description
npm WARN OXYGENSecurity@1.0.0 No repository field.
added 16 packages from 17 contributors and audited 16 packages in 0.844s
found 0 vulnerabilities
[WitherHosting] Server marked as OFF
[ .....] - prepare:container: sill install printInstalled
Server marked as ON
---------- Detected server process in a crashed state! ----------
Exit Code: 0
Out of Memory: false
Error Response:
Server process detected as entering a crashed state; rebooting.```
when i do npm i
for host
idk as vanilla how he did it. i dont use heroku
shoot do i needa delete package.lock?
seems to have worked
it turned off after it finished installing
i guess
oki thx
I deleted my code
lol ok
I did it tomorow
sorry im dumb at coding lol i started coding like 4 months ago and never formally learned i only read docs
dont worry about that, you're doing good
no prob
A lot of issues are just bad practices you learn over time.
also are you able to write a bot in a js file linked to a html? like to run a bot linked to a webpage
Yeah
technically yes, but its a whole different story
show your resources page
?
If i enable both web and worker it sends this
worker as the startup cmd in heroku?
Yep it keps bot online
not node <entryfile>?
Tim ^^
Oof wait
do it in landscape mode
wait so
what if you disable worker and edit web to node index.js instead of npm start?
@quartz kindle how to do that cauz its defaulf web npm start
the edit button?
Ohk
i get offline my bot to remake the code
need to did it again
๐ฅบ
Is it kepp bot online?
No
I turn off
When i finish i wrote the on command
(node index.js)
procfile
i think edit lets u change dyno type
which is like free, paid, or etc
i used procfile when i used heroku
Mee6 has a dev team
I thinks thats not works
https://discord.com/developers/docs/topics/permissions
can someone tell me wahts the Bitwise permission flag for this. can't find it on documentation
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
that works
i start it using that 15 times
Vote webhook working but im not sure about bot can stay online!
nah doesn't work
oop
wait
its not a permisison in bits right?
you needa manually give it per channel
or like the bot requires it in invite
Hes looking for the bitwise of the permission
Yeah I can't seem to find it either
๐ฅบ ๐
that weird
i got it
its actually MANAGE_ROLES
also @solemn latch remember the postman thing not working
it was because i didn['[t have the agent installed and apparently there's a limit without the agent
IS there way to fetch invites from a another shard, I have the guild id?
ping me , when u have a anwser
Depends on the library
discord js 
You can broadcast eval that.
okay
If I add this method to String prototype it only works on the file I made the modification, how do I change it in all documents?
String.prototype.getEmojiID = function () {
return this.split(':')[2].split('>')[0];
};```
don't attach it to a prototype just make a separate file for it and import it where you need it
or have a file full of utility functions
You mean make it like a normal function? Not a prototype method?
correct
Why do you want it there? I don't think so
Ok thank you man!
is it possible to know if 4 values in a row in a list are same ? Like for a connect 4 if 4 values are in a row, we are winner.
Without list all the possibilities (in python)
Which one is better?
I am brasilian, I think it would be better for google cloud which has recommended region
I dont like aws.
Their performance per price is meh until you start getting into higher cost VPS's.
That is for MongoDB, if you haven't noticed
Mongo Cloud or whatever you call it
So you should get something that's close to your VPS location
if(err) return console.log(err)
files.forEach(file => {
if(!file.endsWith('.js')) return
const event = require(`./events/${file}`)
const eventName = file.split(".")[0]
client.on(eventName, event.bind(null, client))
delete require.cache[require.resolve(`./events/${file}`)]
})
})```
Keep getting require.resolve is not a function
which one would be a good command handler?
do u guys have any suggestion
u got something for me? idk which one to choose
you can choose one from here
ait
anyone know why the error is happening ^^^^
are you running that code in node.js?
yes
which version?
what does console.log(require.resolve) show?
How install serenity
Por rust
nothing
can you show the full file?
const Discord = require('discord.js');
const Config = require('./config.json');
const fs = require('fs');
const TOKEN = Config.token;
const PREFIX = Config.prefix;
const client = new Discord.Client()
client.commands = new Discord.Collection()
client.cooldowns = new Discord.Collection()
const commandFiles = fs.readdirSync('./commands').filter(f => f.endsWith('.js'))
for(const file of commandFiles) {
const command = require(`./commands/${file}`)
client.commands.set(command.name, command)
}
fs.readdir('./events/', (err, files) => {
if(err) return console.log(err)
files.forEach(file => {
if(!file.endsWith('.js')) return
const event = require(`./events/${file}`)
const eventName = file.split(".")[0]
client.on(eventName, event.bind(null, client))
console.log(require.resolve)
delete require.cache[require.resolve(`./events/${file}`)]
})
})
client.login(TOKEN)
and you just run that file with node filename.js?
how about console.log(process.version, require.resolve.toString())
TypeError: Cannot read property 'toString' of undefined
then require.toString()
``` delete require.cache[require.resolve(./events/${file})]
^
TypeError: require.resolve is not a function```
same error
but what does the console show
it should log something before that
your node version is v12 not v15?
Hi! My bot (developed using discord.py) is not answering commands if other bot send it (but it does when a user send the command). How can I let the bot answer to other bot text? I defined the commands using the @client.command() decorator
node is not something you put in your package, unless you're hosting on an app manager like glitch or replit
where are you hosting?
repl
replit does not allow you to change node version
oh oof
when you created your project, did you select node.js as the project type?
anyone knows how or why? ๐ฆ
i think it's because you have a return function if the user is defined as a bot
so it ignores the command if the user is a bot
it seems the issue is with repl.it, i just tested here with a blank project and require.resolve is indeed undefined
repl.it is doing something weird with their node.js version
hm well
is there any other way i can
call the events without that function
its basically a message event so it detects a cmd
you can try without the delete line
^
TypeError: event.bind is not a function```
doesnt have event.bind
either
this is sad
well couldnt i just replace that block of code with my msg.js
but it errors if i do that
well i did put my msg.js in my index
but
now its not responding to cmds
any reason why?
module.exports = (client, message) => {
const commandFiles = fs.readdirSync('./commands').filter(f => f.endsWith('.js'))
for(const file of commandFiles) {
const command = require(`./commands/${file}`)
client.commands.set(command.name, command)
}
if(!message.content.startsWith(PREFIX)) return
if(message.author.bot) return
if(message.channel.type == 'dm') return
const args = message.content.substring(PREFIX.length).split(" ")
const command = client.commands.get(args[0])
|| client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(args[0]))
if(!command) return
if(!client.cooldowns.has(command.name)){
client.cooldowns.set(command.name, new Discord.Collection())
}
const now = Date.now()
const timestamps = client.cooldowns.get(command.name)
const cooldownAmount = (command.cooldown || 0) * 1000
if(timestamps.has(message.author.id)){
const expirationDate = timestamps.get(message.author.id) + cooldownAmount
if(now < expirationDate){
const timeLeft = (expirationDate - now) / 1000
return message.channel.send(`Please wait ${timeLeft.toFixed(1)} before reusing the ${command.name} command`)
}
}
timestamps.set(message.author.id, now)
setTimeout(() => timestamps.delete(message.author.id), cooldownAmount)
try{
command.execute(message, args, client)
}catch (error){
console.log(error)
return message.channel.send("There was an error executing this command. Please contact a staff member if you believe this is a bug.")
}
}
client.login(TOKEN)
module.exports = (client) => {
console.log(`Logged in as ${client.user.tag}!`)
}
const giveMeAJoke = require("discord-jokes");
module.exports = {
cnjoke: function cnjoke() {
try {
giveMeAJoke.getRandomCNJoke(function (jokee) {
return jokee;
})
} catch (err) {
throw new Error("An error occurred , error: " + err);
}
}
}```
My code is this
but problem is
it returns undefined
Can we not have a func in a func
Nope. You should return a promise
return new Promise(resolve => {
// inside the function, do (resolve(jokee)
};
hmmm I checked it anyway but nope.
Thanks anyway. We was trying to use a tester bot to test our bot, but at least we will test using the traditional way hahaha
logging.info("Reading bot config data")
intents = discord.Intents.all()
self.client = discord_commands.Bot(os.getenv('DISCORD_PREFIX'), guild_subscriptions=True, intents=intents)
self.token = os.getenv('DISCORD_TOKEN')
self.index = 0
self.client.remove_command('help')
logging.info("Reading bot functions")
@self.client.command()
async def help(ctx):
...
If someone have any idea it will be appreciated โค๏ธ
So I need to do this in the function of jokee
cnjoke
I still don't get it fully
ok
Can anyone help me please ๐ฅบ
dont ask to ask
I use a bot to catch Pokemons, but for some reason I have numbers instead of emojis
Like this
Pleaseee, help me๐
is your bot in the same server as the emojis?
does your bot have "use external emojis" permission?
It must not be having permission
When the joke api is a joke 
Kek
Yeah
But I can see emoji in my PC
In that server only I have this problem
@static marsh you were already told very clearly that you cannot show emojis inside codeblocks.
Asking again does not change that answer.
Oh yeah
How can I style only the Invite button.
I cant find the selector
I don't understand what is codeblocks
And for reference: ` is the codeblock
this is code
you cannot have emojis inside code. Or mentions. Or anything, really, it's meant to show code.
If you want emojis to show, remove the backticks (`) around the text.
Evie your pfp is correct representation of work you do while reviewing bots XD
Well, no, it's the correct representation of me having to show people things that should be relatively clear ๐
aka "schooling noobs" (not here, specifically, but overall on Discord, Facebook, and at work)
I often refer to the concept of "mashing away at the keyboard" so I love that avatar for that ๐
๐
How I can to do this?
uhm, remove them from the embed code?
React native
https://hasteb.in/rulovehi.js
I am trying to have that small lock centered, I can't figure out what I am doing wrong.
I am not getting any help from the other react server and it's been over 15 hours so ๐
yes I tried that
๐
I don't understand why isn't anyone helping I am just tryna learn this stuff and it's probably very easy for them ๐
You're asking a specific question that would require someone to have more knowledge of react native than yourself. This, particularly, is a guild where you will not get a whole lotta people with that knowledge.
Can rust use .env files and if so, how?
yes
If you have a .env file in the root project of your directory, you need to use the dotenv crate.
You can use the env!() macro to get the environment variable's value, but it'll cause a panic if it doesn't exist.
Hey friends! So, I'm trying to add the "total users" thing to my bot and I used to have it working. But now, I can't seem to figure it out for the life of me. I could do the client.users.cache.size but then it would look weird in servers that are inactive.
"100 servers"
"60 users" type of thing.
I can't seem to figure out how to fetch all the members.
It's been a long time since I've done any actual work to my bot so I'm a bit rusty. whoops.
I'm heading to work though, so if anyone has an answer, ping me ๐
If you don't want the panic behavior to happen, use std::env::var: https://doc.rust-lang.org/std/env/fn.var.html
API documentation for the Rust var fn in crate std.
Thanks lad :3
Yeah I'm using env::var
Just got confused when my env file was readn't
If you're talking about some client plugin, don't. This is against the terms of service, and you will not receive help for this on this guild, as we follow the terms of service and the discord community guidelines.
@sonic copper you'll need to iterate over guild and add up the guild's .memberCount
You can use the .reduce method on <Client>.guilds.cache to add up the total.
const giveMeAJoke = require("discord-jokes");
module.exports = {
cnjoke: function cnjoke() {
try {
giveMeAJoke.getRandomCNJoke(function (jokee) {
return new Promise(resolve => {
resolve(jokee)
})
})
} catch (err) {
throw new Error("An error occurred , error: " + err);
}
}
}
Don't laugh at me
What am I doing wrong just guide peacefully no violence or abusive language
Thanks and take care
This code returns me a undefined
But it should return the joke
The cnjoke should return the promise not the callback to the other function
bruh are you seriously using a package to get jokes
Yes
Means ?
how do i install crates without it throwing the no binaries found err? I edit my cargo.toml and i get the intellisense but when compiling i get a can't find crate error
@pure lion can you show the error message
Most developers will use the serenity library.
Well I mean is there any other way ?
I wanted to try use api with no crates but I'm so stupid to do it
Yes, you could write your own API around it.
Though you probably won't use no crates
For example, hyper for HTTP requests.
i fixed it and am proud of myself for learning the typedefs
If a bot adds roles to a user upon joining a server, doesn't it show in the audit logs? The reason I ask is because I have the Patreon bot on my server and when people link Discord to their Patreon account before joining, then join my support server, it doesn't show Patreon bot adding roles in the server audit logs. It also doesn't show up any sort of roles being added in mod logs through bots like YAGPDB or Probot, yet the user has the roles. How is that achieved? On the GuildMemberAdd event?
It should show, but that's more of a Discord issue than a programming one, tbh.
Yeah. Basically, I have my own bot that checks if a guild member gets updated with any of the patreon roles and if so it adds them to the db as a Patron and unlocks the patreon features automatically. It doesn't work if the user links Patreon before joining the server though. So I guess I need to add similar code to GuildMemberAdd event on my bot?
is there any way i could make my main fn async?
I'm just wondering, can I even check if the user has roles in the guildMemberAdd event on my bot if the Patreon bot is adding roles in the same event ๐ค
if the member just joined, they won't have any roles
everyone gets the same member object in the event
Well according to Discord that isn't true since it doesn't show the member getting modified. My question is if a bot assigns roles in the guildMemberAdd event, can another bot check for those roles in their guildMemberAdd event?
Not unless you wait a bit and get the member again from cache
Yeah I was thinking of that.
Probably the easiest option
But I can put that in the guildMemberAdd event right?
yeah I don't think you even have to get the member again from the cache
Don't want to run a cron type function or anything
you can use a setTimeout
Yeah that's what I was hoping to do
But if I do setTimeout in the guildMemberAdd event it should work right?
yeah why wouldn't it work
You can also save when the user joined in a map or somewhere else, and listen to the memberUpdate event (I think it's called something else) and see if they get a role in X milliseconds
my mongodb completely broke earlier today, but sadly I can't completely uninstall it because I have no backups of the data it holds.
I am only getting the errors in the screenshot below, and I've been trying to fix this for the past 8 hours, reinstalling, restarting the VPS, doing literally everything possible, nothing is working, nothing I've done is able to fix it.
But setTimeout is the easier approach
Hmm
let env_token : Result<String, env::VarError> = env::var("CLIENT_TOKEN");
```how could i parse this to a string so i can use it as a client token?
nvm
You could use pattern matching (if let Some(t) = t {...}), unwraping (.unwrap(), will cause a panic if it doesn't exist), .expect, etc.
legit one second
i did .expect
also now im having an async issue, i made an async func and called it in main but it says it requires .await or .poll and poll looks ehhh-
If you're using tokio you can annotate the main function with the #[tokio::main] attribute. Then you can mark the main function as async (async fn main() {...})
yeah
sic
a lot of crates (and I think serenity too) already use it so it won't be much of a toll
i was confused before; i tried to use tokio::main and it looked like it was already installed but ig not afgadsga
hm
hmmmmm
oooo
i can specify a version
ok that's useful
is it possible to have a list value position ? like I have a value at a list position named grille[0][3] and I would like to have it as a grille[x][y+3]
python language
@leaden lake you'd need a 2 dimensional array
add a main function?
how can i make the manage button inline with Server 1 but keep it floated right? heres the css:
use a flex box and some padding
im not a frontend dev so uh
a quick fix would be setting both the button and the server 1 to vertical-align:middle
@quartz kindle that didnt make a difference
make them both inline-block
default should be display:block
display:inline-block will enable vertical align to work
this is how it looks now
does the vertical align stop working if you add the float back?
well ii cant have float and display inline-block
well another option would be to use float and manually center it with padding
flex-grow
or just change everything to flexbox
^
or have 2 container divs with width 50% and set them to text-align left and right
xD
or make everything text-align center and then separate them with % margins
the possibilities are endless
cani see the top of your main function @pure lion
and what serenity version are you using
@strong tundra i fixed it
oh lol
hmm not sure
ohh
oh it works
it passes a ref to the object you put the ampersand on
so &String makes it str
yeah
Use std::process::exit(code)
yeah you need to fix that
I had that issue a while back but forgot how I fixed it
can you show your main file
alrighty
extern crate serenity;
extern crate dotenv;
use serenity::prelude::*;
use serenity::model::prelude::*;
use serenity::Client;
use serenity::framework::standard::{
StandardFramework,
CommandResult,
macros::{
command,
group
}
};
use std::env;
struct Handler;
struct General;
impl EventHandler for Handler {}
#[tokio::main]
async fn main() {
dotenv::dotenv().ok();
start_client().await;
std::process::exit(0);
}
async fn start_client() {
let token = env::var("CLIENT_TOKEN").expect("token");
let prefix = env::var("PREFIX").expect("prefix");
let framework = StandardFramework::new().configure(|c| c.prefix(&prefix));
println!("{}", &prefix);
println!("{}", &token );
let mut client = Client::builder(token).event_handler(Handler).framework(framework).await.expect("Error creating client");
if let Err(error) = client.start().await {
println!("An error has occurred when trying to run the client: {}", error)
}
}
yeah didn't work anyway

also is formatting good? uWu
It may be due to serenity requiring tokio's version to be between 0.2.0 and 0.3.0 (exclusive). However, you're probably using the latest version (0.3.4). If you try downgrading to some version like 0.2.23, does it work?
Hello, so I got a question. Everytime I restart my bot all the reactions do not work anymore. I know for fact that I have to gain access to the json which I created but after a restart the bot is not "opening" the JSON-file. Where did I do something wrong?
ctx.message?
like
wait_for("message")?
exactly
thanks
is there any easier ways of using wait_for('message') instead of hard coding it?
wdym hardcoding
variables in the place of the string "message" I'd assume
like having a billion ifs and checking the user's msg a billion times
i'm trying something lets see if it works
wait_for('message')
you're waiting for a message?
how is that hardcoding
what does that have to do with the ifs
thats how my cmd works...?
yes but what are you checking for in your command
i give options and wait for the author's msg then check if the msg he sent is a b or c
understood?
yeah
and then i'd have to redo the same thing over and over for how many times i want
so where does this come into play
i was wondering if theres a way to have like something that keeps checking the user's msg after each msg the bot sends
you get it?
well you might need to rework the command to better fit discord then
yeah you could..
a while loop would fit it
well the way i am using it is
if the user responds with a b or c then the loop is over
if he responds with something else
repeat
until he does it correct
yeah
...
you can add that into the check function
Yeah
btw does something like
while True:
if 1 == 1:
print("genuis")
return False
else:
return True
``` work?
I'd say a while-loop is appropriate here
unless you can make on_message work with it
maybe?
when this is already built into the library
hold on ill send a link
Well, it depends, Cloud
I'd say it'd be valid if there was some kind of a response for incorrect input
Other than that, disregarding everything and letting d.py rely on the check function
I'm sorry what
oh that's true
btw does something like
while True:
if 1 == 1:
print("genuis")
return False
else:
return True
``` work?
what does THAT have to do with this case
yEs/nO?
what does it take to selfhost a mongodb?
just wondering
It will work
to show the check function because it didnt seem like unicode knows how to use it
just the DB?
yes
return m.content.lower == "A"
does it have to be a
you are trying to check if an uppercase character is included in a message where you lower everything
await ctx.send("a,b,c")
def check(m):
return m.content.lower() == "a":
await wait_for('message', check=check)
await ctx.send("You got it finally")
def check(m):
return m.content.lower() == "b":
await wait_for('message', check=check)
await ctx.send("huh")
def check(m):
return m.content.lower() == "c":
await wait_for('message', check=check)
await ctx.send("Learn me some code")
so thats how i'll use it?
brlgh
And don't put colon after a return
what is a colon?
:
owh ye
Command raised an exception: NameError: name 'wait_for' is not defined
do i need to import something?
It's attached to your bot object
self.bot.wait_for
that self bs
alr
@setup.command()
async def cash(self, ctx):
await ctx.send("What would you like to manage?\n(``A``) Starting amount\n(``B``) Idk")
def check(m):
return m.content.lower() == ['a','b']
msg = await self.client.wait_for('message', check=check)
if msg.lower() == "a":
await ctx.send("How much would you like the starting amount to be?")
def check(m):
return m.content.type == int
msg = await self.client.wait_for('message', check=check)
await ctx.send(f"Your new starting amount has been set yo {msg}")
elif msg.lower() == "b":
await ctx.send("later")
soooooooooo....
any ideas why that ain't working?
i am sure its from the check
OHHHH
it needs to be in
Command raised an exception: AttributeError: 'Message' object has no attribute 'lower'
nice
lmao
@setup.command()
async def cash(self, ctx):
await ctx.send("What would you like to manage?\n(``A``) Starting amount\n(``B``) Idk")
def check(m):
return m.content.lower() in ['a','b']
msg = await self.client.wait_for('message', check=check)
if msg == "a":
await ctx.send("How much would you like the starting amount to be?")
def check(m):
return m.content.type == int
msg = await self.client.wait_for('message', check=check)
await ctx.send(f"Your new starting amount has been set yo {msg}")
elif msg == "b":
await ctx.send("later")
seriously now why it doesn't work?
return m.content.type == int???
that's not how it works
use type(var)
or isinstance
makes sense tbh
@wise quartz you need to use a try/except statement
aint this getting a bit overcomplocated?
@pure lion yeah i realize that
yeah..
there were just too many problems
Ah
and i looked over that
what other problems are there?
cuz the msg before the second check aint working
i'd like to fix that u know
elif msg == "b":
What do you want to happen and what's not happening
Yeah
alr
msg returns the actual message object
yeah makes sense now
Epico
alr fixed
thanks
can u remind me how to make a command require specific permissions?
Not sure with that one, I'd recommend looking at the docs
@wise quartz reference the docs: https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.has_permissions
alr np
ty
@commands.has_permissions(administrator=True)
just reading the link made me remember it
lol
Lol
https://mystb.in/ChadDiveWalked.prolog
Does anyone can tell me why when I play on one game, it plays on the 2 grids ? (python language)
are audit logs return in order of recent to oldest?
๐ for me it is
oh god
because I didn't know how to made one for this
I know ๐
for num in range(len(list)):
for num2 in range(len(list[num])):
print(list[num][num2])
Wrong way but similar
To the actual solution to your problem
aight i get this error when im testing to receive votes
at=error code=H14 desc="No web processes running" method=POST path="/dblwebhook" host=beatsdcbot.herokuapp.com request_id=646b4a71-5ac8-4a63-88fc-bc53e330996d fwd="165.22.130.154" dyno= connect= service= status=503 bytes= protocol=https
didnt you enable the web dyno?
command(client, 'setup', (message) => {
if(message.author.bot) return;
message.channel.send('are you new to discord yes or no')
})
i want it to respond to a user if you say yes or no
can some one help
does anyone here know how to create a ot
how reaction.message.id works on a command ?? Because when I try to print it I got an error (python language)
or am i stupid
Hello
@earnest phoenix Does your long description have a custom CSS element for the bot icon by chance?
No
btw
The image appeared at the beginning
But when I changed it, it disappeared
I mean you can try using a custom CSS element to force it
Oh
well, I will see
tysm
But
I am bad at "CSS"
I just can put codes in "JS"
Can I change it by a web or smth like that?
Until the bug is fixed, the only potential workaround is the CSS element.
To fix the bug? No clue.
np.
@tasks.loop(hours=24)
async def my_loop(*args, **kwargs):
now = datetime.datetime.utcnow()
next = now + datetime.timedelta(hours=24)
data = {}
with open('progress.json', 'w') as f:
json.dump(data, f)
with open('correctpotd.json', 'w') as s:
json.dump(data, s)
with open('incorrectpotd.json', 'w') as d:
json.dump(data, d)
with open('POTD.json', 'r') as p:
bruh = json.load(p)
guild = client.get_guild(764893841068261447)
role = guild.get_role(765213445997068319)
for member in guild.members:
if role in member.roles:
await member.remove_roles(role)
channel = client.get_channel(764903892081180682)
today = date.today()
todaypotd = bruh[str(today)]
todayproblem = todaypotd["problem"]
yesterday = today - timedelta(days = 1)
yesterdaypotd= bruh[str(yesterday)]
yesterdaysource = yesterdaypotd["source"]
yesterdayanswer = yesterdaypotd["answer"]
yesterdaypoints = yesterdaypotd["points"]
await channel.send(f"Source: ||{yesterdaysource}||")
await channel.send(f"Answer: ||{yesterdayanswer}||")
await channel.send(f"Points Received: ||{yesterdaypoints}||")
for role in guild.roles:
if role.id == 765410849254277150:
await channel.send(f"{role.mention} New POTD! DM your answers to me! Do ``;potd`` to receive the problem! Problem: {todayproblem}")
congrats = client.get_channel(764903893409857586)
await congrats.send(f"----------------------POTD Of {str(today)}----------------------")
now = datetime.datetime.utcnow()
interval = next - now
self.change_interval(hours=interval.hours, minutes=interval.minutes, seconds=interval.seconds)
@my_loop.before_loop
async def my_loop_before():
now = datetime.datetime.utcnow()
next = datetime.datetime.utcnow()
next.replace(hour=23, minute=27, second=0)
if next < now:
next.replace(day=now.day + 1)
await asyncio.sleep((next - now).total_seconds())
i wrote this code for daily tasks
which i got from docs
it doesnt send anything
and im not finding any places to fix
heya, does anybody here make npm packages? I'm having some trouble
fs.readFileSync() and fs.readdirSync() work but require() doesn't
it requires inside the npm package itself instead of in the file that I'm requiring the npm package in
sorry if that doesn't make any sense
yeah
const cmdInit = (client, path) => {
const commandFolders = fs.readdirSync(path);
let commandlist = ['']
for (const folder of commandFolders) {
const commandFiles = fs.readdirSync(`${path}/${folder}`).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const commander = require(`${path}/${folder}/${file}`);
client.commands.set(commander.name, commander);
commandlist.push(commander.name);
}
}
return commandlist;
}
@quartz kindle
(sorry for the ping)
and this is inside a package that you install from npm?
yes
whats the path you're giving it?
const companion = require('little-api-companion')
const commandlist = companion.cmdInit(client, "./commands");
make it require(${process.cwd()}/${path}/${folder}/${file});
then just give it "commands" as the path
kk lemme test
uh what
what is it doing
@quartz kindle
oh wait that was from one of my commands, requiring my old code
well, not my old code, but the old location I had the code
OMG YESSSS IT WORKS
TYSM
Someone help me please
Error: Error parsing info: Unable to retrieve video metadata
i just started getting this error
my music bot would be working fine
anyone know how i would go about incorporating an api like dog.ceo into my javascript bot with an embed
Learn js
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
ah im getting this error when im testing to recieve webhooks
at=error code=H14 desc="No web processes running" method=GET path="/dblwebhook" host=beatsdcbot.herokuapp.com request_id=9ee38fca-175a-491a-ad6f-f9a1ea5b8937 fwd="165.22.130.154" dyno= connect= service= status=503 bytes= protocol=https
@sage bobcat Never mind i'm just stupid and forgot to put something in my code
One message removed from a suspended account.
no
oh
it gives me this error tho when i tried testing it
did you not enable the web dyno?
that just runs a npm start script
disable the worker and edit the web dyno to run node index.js
or whatever your worker does
aight imma try that
Someone help me please
Error: Error parsing info: Unable to retrieve video metadata```
idk why
ask whoever made the library you use
Ok so I'm working on a bot for a client to get Top.gg votes.. is there any examples I can refer to? I'm also curios of where they get their dbl token from
they need to be verified in top.gg
then the token will be available in the bot's edit page
Well they want to get the votes for their server not their bot.. so would that token be in the same place? I think they should be verified they have 85,000+ members
ah
how would i make a webhook url?
in dpy?
webhooks dont need a token
for top.gg votes?
Ahh I actually think I was looking at the API for bots. So will I be able to get data specifically the user who voted from a webhook?
i think so, not sure what are the contents of the server webhooks
Can you refer me to the page or docs on that because I'm only finding the DBL API
not sure there are docs lol
but in theory it should work the same way as the bot webhooks
there is no library for it tho, afaik, you need to setup a webserver yourself
but its pretty trivial
Ahh ok. I was hoping their was an API like how the bots have. Guess I'll try to figure out something
just setup a webserver like express (assuming js)
and give its url in the server's edit page
then log the data you receive
Alright and I'm actually using Python. I've not done anything like this before but I'm going to give it a try
i believe most python users recommend flask or sanic
Alright thanks for the info
flask is pretty nice and lightweight
Is Microsoft powershell ok or will it make the bot lag to much when the bot gets more active
yo guys i have a probleme with my playlist command, when i use it, it show only the last music on the playlist
my code :
what i get is only the last music added with the !p command
var list = [];
oh I get it. you're defining the embed inside your loop but sending it one outside the loop. makes sense
what you're doing is ```
for each list item {
msg = a brand new embed
}
send(msg)
local util = require("commandUtil")
return function(msg, timeout, maxPeople, channel, emoji, description)
msg:delete()
print(type(msg.channel))
timeout = type(timeout) == "number" and timeout or 600
maxPeople = type(maxPeople) == "number" and maxPeople or 15
channel = type(channel) == "table" and channel or msg.channel
emoji = type(emoji) == "string" and emoji or "๐บ"
description = description or "React to this message if you want to play Werewolves! We need %d reactions to start."
msg:reply(emoji)
msg:reply(string.format(description, maxPeople))
msg:addReaction(emoji)
end
{"message": "405: Method Not Allowed", "code": 0}
it replies with the correct emoji too
im confused how u make the bot send a different message everytime u use the cmd
a cmd*
any help?
<#id>
Should be
ok?
how can i check if the channel exisits lmao?
You can check if its in cache.
like if the channel is in that server?
Does py not use guild.channels ?
Is there a way to send a test vote for servers like how you can for bots?
how do u make the bot send a different message everytime u use the cmd
any example?
fordjs
djs*
Ok.. also yes py uses guild.channels
I would use an array and pick an item from that array
any example?
It returns a list of channel objects
random message?
ye
yes
from a list
yes, but channel names, ids object?
i only know python
The whole channel object
From what I can tell
bot: no u
but in python its like list = ["pp", "poopoo"]
and u select a random one
ok
Arrays are practically the same as a python list.
Its just a list
nope doesnt work
What doesnt, what did you try.
idk if ok?
let random = Math.floor(Math.random() * 3);
if (command === 'beg') {
message.channel.send(`***Dank Memer*** has Donated 500 coins to @${message.author.username}!`)
};```
Uhh what is going on here
Put the reply array and the index in your send
The variable random would be your index.
a = b[2,19]
print (len(a))```
anyone help?
gave error
a = b[2,19]
TypeError: string indices must be integers
I am trying to obtain a normal emoji from a DB but it gives me an error
https://i.imgur.com/idF8n5U.png
https://i.imgur.com/EH1cyR2.png
https://i.imgur.com/IKavKTT.png
and it doesnt reacts
Emojis are such a pain sometimes.
ye
can u send an example how tochange it
Is your db configured to store that type of data?
script?
you just need to use replies[random] @red coral
when i do console.log of the data that contains the emoji
So, I had a simular issue before.
I belive I had to change the encoding type for the emojis in the db.
I belive it would console log the emoji correctly.
I think discords a bit more picky about it.
Ik this is late but you could convert it to unicode and save that @ember lodge
so i tried using canvacord and discord-xp to try build up a rank card
i got this
const member = message.mentions.members.first() || message.member;
const user = await Levels.fetch(member.id, message.guild.id);
const requiredXP = Levels.xpFor(parseInt(user.level) + 1);
if(!user) return message.channel.send('You have no rank. Try sending some messages first!')
const rank = new canvacord.Rank()
.setAvatar(member.user.displayAvatarURL({ dynamic: false, format: 'png' }))
.setCurrentXP(user.xp)
.setRequiredXP(requiredXP)
.setStatus(member.user.presence.status)
.setProgressBar('#FFA500', 'COLOR')
.setUsername(member.user.username)
.setDiscriminator(member.user.discriminator)
rank.build()
.then(data => {
const attachment = new Discord.MessageAttachment(data, 'https://media.discordapp.net/attachments/735897160943534121/778864919092789259/PicsArt_11-19-02.11.02.jpg?width=1442&height=320')
message.channel.send(attachment);
})```
it logs no error or something and at the same time it does nothing
What are you trying to do? Are you trying to slice the list, or grab two elements from it?
What do you expect a to be after you run that?
@drifting wedge to slice, you do b[2:20]. Though, i don't think IDs are the same length. So another approach would be:
b.strip('<#>')''.join([i for i in b if i.isdigit()])
But what are you trying to do? If you were to make a command that takes channel mention, it's better to type hint the parameter instead
You can type hint to discord.TextChannel
discord.Channel isn't a thing?
Fixed