#development
1 messages Β· Page 1334 of 1
@dawn harbor link?
@normal sage
If you use javascript here is one... https://www.npmjs.com/package/mee6-levels-api
thanks!
π
In theory it is going to work
@random maple Well not really complicated to create an array including your command and adding entries with new commands to it
With a command
if(Math.floor(Math.random() * 10000) == 1) //do stuff
@chilly bison 0.01% chance wtf
Actually better than the lottery
yeah
even better chance
Hello. I'm having problems when I add my bot on other servers, because they are sharing the same code and giving problems when people from both servers execute the commands. How do I solve this? Any api resources? any programming practice? I'm really stuck on it :/
Just assuming heβs doing something like this, yikes
Hello. I'm having problems when I add my bot on other servers, because they are sharing the same code and giving problems when people from both servers execute the commands. How do I solve this? Any api resources? any programming practice? I'm really stuck on it :/
@haughty bough
Just assuming heβs doing something like this, yikes
@boreal iron
Hmm also possible
Hello. I'm having problems when I add my bot on other servers, because they are sharing the same code and giving problems when people from both servers execute the commands. How do I solve this? Any api resources? any programming practice? I'm really stuck on it :/
@haughty bough I never had that kind of problem. Let's start with the basics: try to turn off and on your bot
@chilly bison imagine creating an administration command with a chance of 1/10 to kick/ban the author instead of the target
That would be fun tho
Life is not funny If there is no risk, right?
Aye
Hm, a good idea what to add to my bot...
lmao
@haughty bough I never had that kind of problem. Let's start with the basics: try to turn off and on your bot
@random maple I'll give you an example: A command that puts the music in a queue and to play in the future, but that list ends up being shared on all servers, but I don't want that. I think programming techniques are lacking to make each server have its list, but I really don't know how to do that
Just create an array including the guild id
assign a guild value
For example:
like a collection
<blah>.collection.get(guild)
idk bad at explaining
also might be better ways depending on what your doing
queue[guild_id][] = song1,
queue[guild_id][] = song2 etc
Maybe use server variables? idk I'm working on moderation bot and I have never tried to do something with voice chats.
Just a simple array you can push or shift entries to
Does anyone want to 2v2 in Fortnite
Wrong channel or weβre not 12, so nope
how do i run code on button press html?
What channel do I go to
i couldnt find anything
JS?
yea should be
Interesting, I will do that. One last doubt: Is there a pattern for creating bots in the discord that you recommend? Techniques to make the code better, for example
comment your code
js function?
so you donβt end up like me
Easiest example is using onclick=βjs_function()β

specified in html?
yea?
lmao
but like how would i show an html thing with js?
Iβve been getting into jquery and stuff
slightly more fun that djs because itβs something to learn
B)
Aye
jQuery is a really nice framework
Or people wanna call it library
Modern society shit...
Really nice to build own fancy site with it
If you wanna do it with your own hands not using bootstrap or templates etc
Well gonna get some sleep now. See ya
@drifting wedge there are many ways to do that, depends exactly what you want to do
you can create/remove elements from html, or you can hide/show elements by changing the css from js
you can edit the content of elements with js as well
jQuery is a really nice framework
lmao
I use flask lol
Could someone please help me? I'm trying to make a discord library with deno in typescript and I got this error. https://srcb.in/8325d5a276 My code is here for the WebSocketManager.ts: https://srcb.in/39e58ca698. Any other code is here https://github.com/RadonDevs/silk
no need to send all ur code btw
@digital ibex Just incase you have to see the rest of the code so I don't have to send like 10 sourceb.in links π
@compact echo the value of msg isn't parsable to JSON. You could log what msg is beforehand.
Ok
Returned this
{"t":null,"s":null,"op":10,"d":{"heartbeat_interval":41250,"_trace":["[\"gateway-prd-main-9540\",{\"micros\":0.0}]"]}}
{ code: 4004, reason: "Authentication failed." }```
oh maybe my discord bot token isn't valid
Search online ig?
lmao
Oh lol
My discord bot token was invalid π€¦ββοΈ
anyone has an image api for me
@earnest phoenix wdym image api? Like cat image or dog image?
or like meme or smth
preferly dog/cat but mostly just images of an whole host of subjects
oh
https://aws.random.cat//meow for cat
If you need any tutorials on how to use them just ping or dm me and I can give you some π
well i do need to know how to grab json from the web and make it an json object
Ok
I suggest watching this video due to the person explaining it super well and stuff. Just tell me if you need help! https://www.youtube.com/watch?v=LjbUq4RzWvg&t=44s
Check out these awesome videos for this week! Hope you're enjoying this weeks pretty much daily content!
Read description for links!
----------------------------------------ΒΒ---------------------------------------Β-Β--
Need Help?
Require help with your code? Why not head o...
some-random-api has cat, dog and meme apis
I get a error saying manager is not ready when running !start 30m #deleted-channel 1 TEST
Manager code:
const { GiveawaysManager } = require('discord-giveaways');
client.giveawaysManager = new GiveawaysManager(client, {
storage: "./database.json",
updateCountdownEvery: 3000,
default: {
botsCanWin: false,
embedColor: "#FF0000",
reaction: "π"
}
});
Start Manager Code:
client.giveawaysManager.start(giveawayChannel, {
time: ms(giveawayDuration),
prize: giveawayPrize,
winnerCount: giveawayNumberWinners,
hostedBy: client.config.hostedBy ? message.author : null,
messages: {
giveaway: (client.config.everyoneMention ? "@everyone\n\n" : "")+"ππ **GIVEAWAY** ππ",
giveawayEnded: (client.config.everyoneMention ? "@everyone\n\n" : "")+"ππ **GIVEAWAY ENDED** ππ",
timeRemaining: "Time remaining: **{duration}**!",
inviteToParticipate: "React with π to participate!",
winMessage: "Congratulations, {winners}! You won **{prize}**!",
embedFooter: "Giveaways",
noWinner: "Giveaway cancelled, no valid participations.",
hostedBy: "Hosted by: {user}",
winners: "winner(s)",
endedAt: "Ended at",
units: {
seconds: "seconds",
minutes: "minutes",
hours: "hours",
days: "days",
pluralS: false
}
}
async def enlarge(ctx, emoji):
embed = discord.Embed(title = f"Enlarged Emoji!" , description = f"**Emoji Name** : ``{emoji}" , colour = discord.Colour.red())
embed.set_image(url = f"{emoji_url}")
embed.set_footer(text = f"Requested by {ctx.author.name}")
await ctx.send(embed=embed)```
What's wrong in this code
The error came out as Name "emoji_url" is not defined
Where did you define emoji_url?
I didn't defined it. π¦
Then that's the root of your problem.
is there a selfbot here
π€
whats with the random reactions
kek
sorry, just sciencin
You may want to use one of the converters (Emoji). Read up on them here: https://discordpy.readthedocs.io/en/latest/ext/commands/commands.html#converters
@sick fable what I think you'll want to do is set the type of the parameter emoji.
Kk
const client = require('alexflipnote.js');
const alexclient = new client();
module.exports = {
name: "phlogo",
category: "image",
description: "PornHub Logo",
run: async (bot, message, args) => {
let text = args.join(" ").slice(" | ")
let text2 = args.slice(1).join(" ")
let image = await alexclient.image.pornhub(text, text2)
let attachment = new Discord.MessageAttachment(image)
message.channel.send(attachment)
}
}```
whats the problem?
Bad request made to the host.
should look at the docs for the library you are using
^
their is nothing related to host in the docs
whatcha mean
its working in other bots
okay, did you look at the docs to make sure you are performing your requests correctly?
The requests are being made incorrectly is the reason it throws HTTP Error 400. It will be best if you read the docs again and try making a burner application to test it.
burner application ?
An application made specifically for one task only.
k
am i crazy, or is your split mechanism not doing what you think it does
me?
yeah
i think its fine
An application made specifically for one task only.
@still cliff burner would imply it is no longer useful after being used or temporary. Right?
yeah, just something you throw together to quickly test a library
or anything
and then when you understand it throw it away
or move what you tested into your main code.
For the guy who declined my bot, no working help command? Ye it's not the prettiest but it works
I wish there was a way to know who declined your bot, so he could see this
(or she)
@mental furnace search for your bot in modlogs with the search bar (enter the ID)
You'll see who denied it and when.
cmds is a non obvious command
a new user who doesnt know your bot might not know to do cmds
It literally says it in the status every 10 seconds
changing status?
π€·ββοΈ whens the last time you looked at a bots status for more than 10 seconds
if &help works then im on your side ;p
Yo
@glad charm I looked at the logs, you didn't give him webhook permissions
Sorry for second ping
Lemme fix that in my bot page
The bot didn't say anything about perms nor did the page.
Right so the bot didn't error or anything.
Xd
Could you rename me to "sbot50"
Exactly, @faint prism.
I use them all the time to test packages and extract useful code. πΉ
Anyway I'll submit again and wait another 3 months
Anyway I'll submit again and wait another 3 months
@mental furnace nvm, 8 months
maybe by the time your bots accepted all the new bot reviewers will be trained and reviewing
Ye I also submitted, so I may even be doing that
just review your own bot 4head
No
I don't think that's allowed
And I also don't think I would even get my own bots in a list of bots to accept
The average review time is ridiculous but I can say it's worth the wait.
Not if it gets denied because the reviewer forgot a perm because I forgot a perm
My bot achieved like 15 servers in 3-5 days once it got approved...
I'll make a new page later today, it's 7am
bots are reviewed with 0 perms
Shitpost much. I'll stop.
its not forgotten, its intentionally that way
bots are reviewed with 0 perms
@solemn latch no, they are reviewed with the provided bot link
thats not true
If that's not true, then how was my other bott accepted
It uses embeds
And those are also a perm
Bruh then the bots can't function
all bots i invite i give 0 permissions for
if they cant function they need to error and if i choose to add it i do π€·ββοΈ
all bots i invite i give 0 permissions for
@solemn latch invites moderation bot with 0 perms WhY DoEsN'T It FuNcTiOn
it should properly send an error message
if it doesnt function
not that hard π€
I do
if i need a bot with mute perms and thats it, i shouldnt give it admin
just the perm it needs
I have a mod bot and the only perms it needs is mΓ©nage messages and kick/ban
Also
Kick/ban aren't needed if you don't set it up to do that
and does it properly inform the mod when it tries kicking someone but the bot doesnt have perms?
No since it's not out yet
didnt you submit it for review π€
you shouldnt submit until its ready to be public
or almost ready to be public
for most bots, the first few weeks after acceptation on top.gg is where they make it or die.
didnt you submit it for review π€
@solemn latch no?
then how was it denied
No
The mod bot isn't even out yet
No since it's not out yet
@mental furnace
then how was it denied
@solemn latch it wasnt
It's not out
Response from API
{
ret: 'OK',
pow: '0',
mode: '3',
adv: '',
stemp: '22.5',
shum: '0',
dt1: '21.0',
dt2: 'M',
dt3: '22.5',
dt4: '21.5',
dt5: '21.5',
dt7: '21.0',
dh1: '0',
dh2: '0',
dh3: '0',
dh4: '0',
dh5: '0',
dh7: '0',
dhh: '50',
b_mode: '3',
b_stemp: '22.5',
b_shum: '0',
alert: '255',
f_rate: 'A',
f_dir: '0',
b_f_rate: 'A',
b_f_dir: '0',
dfr1: 'A',
dfr2: 'A',
dfr3: 'A',
dfr4: 'A',
dfr5: 'A',
dfr6: 'A',
dfr7: 'A',
dfrh: '5',
dfd1: '0',
dfd2: '0',
dfd3: '0',
dfd4: '0',
dfd5: '0',
dfd6: '0',
dfd7: '0',
dfdh: '0',
dmnd_run: '0',
en_demand: '0'
}
Only data I need
interface controlInfo {
ret: string;
pow: string;
mode: string;
stemp: string;
shum: string;
f_rate: string;
f_dir: string;
alert: string;
}
Is it possible to automatically strip JSON objects if the property isn't typed?
I can't find anything about it on da web
Some sort of serialization
Yeah, I could, but that feels redundant
let final = [..Object.entries(response)].filter(key, val => key == ret || pow || mode ||...)```
thats the shortest one liner i can thinkof
Hmm
let embed = new $()
.setTitle(`${message.author.username}'s Inventory`)
.setColor(config.color)
.setThumbnail(message.author.displayAvatarURL({ dynamic: true, size: 512 }));
Money.findOne({
userID: message.author.id
}, (err, money) => {
if (err) console.log(err);
if (!money) {
const newMoney = new Money({
userID: message.author.id,
money: 0
});
newMoney.save().catch(err => console.log(err));
embed.addField("Account Balance", '0');
} else {
embed.addField("Account Balance", money.money);
}
not adding fields. it jsut ends an empty embeds
@sacred cypress
one liner
like i said, thats the best i can think of to make it short
just assign an array with the keys you need
and then restructure the array back into an object
wdym
Like patreon, etc
And how much is like average?
idk
PayPal API is what me and Xig are prob gonna use, I recommend it if youre above 18
PayPal API is what me and Xig are prob gonna use, I recommend it if youre above 18
@sacred cypress u and xig have a bot? Cool
@sacred cypress js? And also how will payment work? Like literally PayPal, or u have some interface?
But 18+?
And that
Is patreon any good?
Their API hard as fuck, some say the worst one a professional payment gateway can make
Patreon takes a big piece of the cake
But yeah, I guess...
What my team thought of doing is like have patreon give you a role, and one of our bots detecting it and adding it to db
But thatβs terribly inefficient
Lmfao
Are you 18+?
Byeeeeee
I never said anything about that
You said bye
stripe? stripe has such a good api
Yes, that is not a yes or no
I mean the thing is stripe is like u put ur credit card in my website?
Ppl wonβt really trust it
What's the rest that paypal can provide?
What is user friendly ?
Bank transfer?
Lolll
Yeah, local per country
So literally everyone can use it
Owh and their fees low as shit
Wait wut?
My relationship with pp is love and hate though
Can I detect webhooks?
Yes. It has everything
Like, can I like read webhooks?
Yeah
Pog
U can even scan if someone refunds
I mean for patreon?
So u can revoke their purchase
Pp might come later
Patreon stopping webhook apis but allowing endpoints and related it seems
wait just kidding
looks like I just read the form wrong? idk https://www.patreon.com/portal/registration/register-webhooks
Can I like run a bot that reads webhook content? Basically?
idk
Can I read webhook content, like is it even possible?
when you're hosting a webhook, they send data to you
so in the patreon panel, just yeet your webhook uri into there and they'll post u with data whenever something happens
oh hm good point
Can I put an input form?
I mean, if you are fine with doing it manually, most people would be happy to join your support server after buying premium, and patreon has a discord bot that will role them with connected discord accounts
I mean, if you are fine with doing it manually, most people would be happy to join your support server after buying premium, and patreon has a discord bot that will role them with connected discord accounts
@tame kestrel true
Iβll do webhooks
Can I like make a input form?
Cuz like idk how I would identify the buyer
Β―_(γ)_/Β―
Hmmm
Patreon allows subs to dm u
there's always that
It looks like their api allows u to see if they have a discord attached
so like when they sub, you at the very least get their patreon user id
and can use that to fetch the discord profile information
I have an idea
So in webhook, bot gets webhook patreon id and adds to db
Then user can go into bots website and put their ID, and get premium?
no, because how would an average user know their own id?
How about when someone subscribes, if you dont get discord info off the bat, you fetch their profile, and end up with their user id, as well as their discord user id.
so if they had discord to begin with connected, you know it off the bat
if they don't and they try activating it later on in a server right or trying a premium feature
just be like, believe this is an error? join support server
and you can like, do something about it
Ok Iβll prob do that
@drifting wedge looks like they have a "member update" webhook, maybe that could tell you when they change their profile?
Alright, have a nice night
console.log(userid);
let member = client.users.cache.find(user=>user.id===userid);
console.log(member);
member.send("Verify Success");```
This returns ``TypeError: Cannot read property 'send' of undefined``
also userid returns the correct user id
any help y'all?
why not just user.send
one sec
why are you trying to find a "member" and then send to them
it's not a member anyway, it's a user
since it's from client.users
what is user?
its the object user
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
that's the dapi docs
you're using a library
the user object has a structure and methods attached to it
ah ok thanks will see this
const client = new Discord.Client();
const DiscordOauth2 = require("discord-oauth2");
const oauth = new DiscordOauth2()
oauth.tokenRequest({
clientId: "000",
clientSecret: "000",
code: accessCode,
scope: "identify guilds guilds.join",
grantType: "authorization_code",
redirectUri: "http://localhost:5500",
}).then(m=>{
const access_token = m.access_token;
oauth.getUser(access_token).then(user=>{
console.log("Hi");
const refreshtoken = m.refresh_token;
db.set(`${user.id}`,access_token);
db.set(`${user.id}_refresh`,refreshtoken);
user.send("Verif");
})
})```
this is my entire code
oh you mean literally raw user
ye
then the user you're trying to get is not cached
try client.users.fetch(user.id).then(user => user.send("test"))
one sec
fetch gets it from the cache if exists, if not, the api
it's a promise so you have to await it or use .then()
it gives either a user or an error
one sec just trying what u told
TypeError: Cannot read property 'id' of null
thats the error i get
ah ok
it still gives me TypeError: Cannot read property 'id' of null error
also userid returns the correct user id
@ivory seal
idk man
sounds like it's a you problem
?
@pale vessel the userid returns the userid const returns with the userid
client.users.fetch(userid).then(user =>console.log(user)); returns my user raw
but user.send() doesn't work it returns TypeError: Cannot read property 'id' of null
let bal;
Money.findOne({
userID: message.author.id
}, (err, money) => {
if (err) console.log(err);
if (!money) {
const newMoney = new Money({
userID: message.author.id,
money: 0
});
newMoney.save().catch(err => console.log(err));
bal = 0;
} else {
bal = money.money;
}
});
console.log(bal) //undefined
```why undefined :((
Because the callback in findOne executes after the console.log
pls help me too
Because the callback in
findOneexecutes after the console.log
@cinder patio howe do i make it before
client.users.fetch(userid).then(user =>console.log(user));returns my user raw
but user.send() doesn't work it returns TypeError: Cannot read property 'id' of null
plz help
@ivory seal show what it logs in the console
one sec @earnest phoenix
@earnest phoenix User.findOne is not a function duh
are you sure User is a mongodb collection
yup
it consoles my userid
then says TypeError: Cannot read property 'id' of null
and that the spelling and capitalization is correcr
it consoles my userid
then saysTypeError: Cannot read property 'id' of null
@ivory seal screenshot what it logs
yep its right. User and User from collections are both right. the typo is just here in questions
732563712136970290
(node:5204) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null
at User.createDM (C:\Users\user\Desktop\Advanced\node_modules\discord.js\src\structures\User.js:250:63)
at User.send (C:\Users\user\Desktop\Advanced\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:158:19)
at C:\Users\user\Desktop\Advanced\index.js:53:47
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:5204) 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: 3)
(node:5204) [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.```
where did you define the collection
thats wat it logs
@ivory seal that means you passed the wrong id
client.users.fetch("wrong id here");
it says Cannot read property id of null which means whoever guy's id you're passing is not a real guy
is it a string
yes
one sec
const client = new Discord.Client();
const DiscordOauth2 = require("discord-oauth2");
const oauth = new DiscordOauth2()
oauth.tokenRequest({
clientId: "000",
clientSecret: "000",
code: accessCode,
scope: "identify guilds guilds.join",
grantType: "authorization_code",
redirectUri: "http://localhost:5500",
}).then(m=>{
const access_token = m.access_token;
oauth.getUser(access_token).then(user=>{
console.log("Hi");
const refreshtoken = m.refresh_token;
db.set(`${user.id}`,access_token);
db.set(`${user.id}_refresh`,refreshtoken);
const userid=user.id;
console.log(userid);
client.users.fetch(userid).then(user =>user.send("hi"));
})
})```
@ivory seal oauth.getUser(access_token) might be wrong so it's returning null as the user
Looking for discord.py peeps who can help me
client.users.fetch(userid).then(user => user.send("hi"));
the error is originating here
where did you define the collection
@earnest phoenix const User = require('../cardgame/collections/user')
why is user defined twice
ah ok so i should jsut change user to somethign else?
@earnest phoenix that's not how you do mongodb collections iirc
ah ok so i should jsut change user to somethign else?
@ivory seal make it fetchedUser ig
nvm thank you.
one sec
(node:10412) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null
at User.createDM (C:\Users\user\Desktop\Advanced\node_modules\discord.js\src\structures\User.js:250:63)
at User.send (C:\Users\user\Desktop\Advanced\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:158:19)
at C:\Users\user\Desktop\Advanced\index.js:53:46
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:10412) 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: 3)
(node:10412) [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.```
still an error
client.users.fetch(userid).then(mem => mem.send("Hi"))
wat i did
@earnest phoenix try doing this:
(I'm not very experienced with mongodb don't expect this to fully work)
const User = <mongodb client>.db("db name").collection("collection name");
@ivory seal what's on line 53
the error says it's on that line
client.users.fetch(userid).then(mem => mem.send("Hi"))
@ivory seal this is on line 53
change it to this just for temporary testing:
client.users.fetch(userid).then(mem => console.log);
this is node.js ??
@acoustic veldt yes
kk
you can ask for anything bot development related here
it doesn't return anything
I am looking for peeps who know discord.py so that I can get some help
check console
wait shouldn;t it be console.log(mem)
@acoustic veldt Don't ask to ask, just post your question here and someone may help you
Ok 
wait shouldn;t it be
console.log(mem)
@ivory seal yeah my bad
cause if i do that
id: '732563712136970290',
username: 'The_Real_Sahhas',
bot: false,
discriminator: '0001',
avatar: 'a_1286b555a379309632951c8d4c5e3e90',
flags: UserFlags { bitfield: 64 },
lastMessageID: null,
lastMessageChannelID: null
}``` i get the user object
message.author.name is a thing?
.username
or message.author.username
username
k
also there is no username for GuildMember(s) there is only nickname
and for his logo its:
message.author.iconURL()
?
no
avatar
k
@ivory seal change the console.log(mem); to console.log(mem.send);
i did
(don't put brackets around send)
oh ok one sec
also you renamed it to mem so user.send(); shouldn't work anyways
try doing mem.send(); now
client.users.fetch(userid).then(mem => console.log(mem.send("hi"));
like this or
client.users.fetch(userid).then(mem => mem.send("Hi'))l
second one
the console log stuff were just for testing
Pro debugging tip: If you don't put () around a function it will just return the whole function which you can console log to see what it does
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null still returns this
ah oakay
idt tim is online
@ivory seal try going to discord.gg/plexidev
ok
How do I tell someone why Json db is bad?
any one here is really good at reaction collector and want to make a deal?
command for command
How do I tell someone why Json db is bad?
@silver lintel #development message copy this
or carry on and let them do their own thing
yea itβs not our fault if their database is fucked and their bot is absolutely fucking destroyed with errors and everyoneβs mad that they lost all their data and the botβs offline and basically just use a different database
I'd rather people worry about their business than someone else's 
I'd rather people worry about their business than someone else's :catshrug:
@slender thistle so you're basically telling us not to help other people since it's not our business
and you guys shitted on me like fuck to make me a good programmer which i probably wouldn't have been if you guys didn't do that
Helping is one thing, insisting on why X is very dependent on the case, especially seeing how mad people get when they see a JSON db
Main point is, if you are going to insist on why X is bad, be civil about it, thanks
ok
(P.S. helping can also be bad in some cases, so all I can say is it depends on how good you are at helping and explaining)
(shivaco is a god)
someone here that know reaction collector DM me please
someone here that know reaction collector DM me please
@tardy hornet just ask here please
well Plexi development didn't help me either lolz
import discord
from discord.ext import commands
import asyncio
bot = commands.Bot
class DMCog(commands.Cog, name="DM Webhook Set-up"):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_message(self, message):
if message.content.startswith('nya!dm'):
await message.author.remove_roles(message.guild.get_role(767654541541244970), reason="DM Webhook created")
print('Role removed successfully!')
pass
def setup(bot):
bot.add_cog(DMCog(bot))
```Outputs nothing in Python
Maybe print what the message.content contains and check that the bot is receiving the message
if (message.react.id === '755303924671578151')
will it work?
message.react isn't valid in discord.py could you send your whole code @tardy hornet
im using js
ah
sorry my bad (was looking at the message above for language xD)
discord.js or other?
Maybe print what the
message.contentcontains and check that the bot is receiving the message
@shrewd parrot Huh?
@commands.Cog.listener()
async def on_message(self, message):
if message.content.startswith('nya!dm'):
print(message.content)
await message.author.remove_roles(message.guild.get_role(767654541541244970), reason="DM Webhook created")
print('Role removed successfully!')
pass
sorry my bad (was looking at the message above for language xD)
@shrewd parrot
its ok i have new question,
how do i make that a embed will get more then 1 reaction,
like that?
.then(msg => reactEmojies(msg, ['id'], ['id'], ['id'], ['id'], ['id']))
?
.then(msg=> msg.react(emoji))
then I'm pretty sure you have to loop that to add multiple reactions
@shrewd parrot We have determined that the cog does not run past the if statement and the on_message event in the core does not run
are you loading the cog in the main file?
I can try that
i fixed that,
@shrewd parrot I was loading in via a command
now i want that if they react to red it will edit the message to something else
const start = message.createdTimestamp;
const end = pingMessage.createdTimestamp;
const subtraction = end - start;
pingMessage.edit(`you lost! red was not an impostor!`)
})```
like that?
message.react.id isn't valid in d.js
unless your getting message from somewhere that I don't know
Do someone know how I can stop running a bot even if I never launched it ? I'm using VSC and did run and stop the debugger, yet the bot is launched by another way but I do not know how.
I waited many hours.
Then yeah, reset your token
And it is not the first time I have this problem, also I would like to do not often reset the token.
message.react.idisn't valid in d.js
@shrewd parrot
ik. then how to i make that if they react to this emoji then
@hasty mulch I'm having to go so someone in the d.py server might be able to help you load the cog/get the listener working
@tardy hornet you can check what emojinis reacted with. Check the docs they contain a good amount of help
And it is not the first time I have this problem, also I would like to do not often reset the token.
@random forum I would make sure the entire bot is shutdown, and donβt run it inside the program. Run it in Console/Terminal
Why to do not run it with debugger ?
The debugger is better to debug. ;_;
But not to run the bot
I find I can do more debugging with console.logs/their equivalents than a debugger
^
why
How I can make bot command?
when will u aprove my bot
hello, if i want to host a discord python bot on my own computer instead of a server, can i do that?
@spiral crag yes, you can do that. I would suggest not doing it because I presume you turn your computer off when not using it which would turn the bot off too.
some people said using a cron job but i am not sure what is it
You will have to do some searching
But you canβt host it on your computer and expect 24/7 uptime if you turn your computer off.
also, if i make a google cloud account and use the free tier, can i set it in a mode where it will stop providing me the service if i go past free tier instead of charging me
also, if i make a google cloud account and use the free tier, can i set it in a mode where it will stop providing me the service if i go past free tier instead of charging me
@spiral crag no
I don't think they will allow this
is there any other linux virtual machine provider with a free tier which would do that
You can just cancel it before it ends
I donβt know a lot of free hosts, but I know some cheap ones
Like 10 dollars a month
i am not an adult so that is why it is a problem
I know one thatβs 5 dollars a month?
Frankly I don't think anyone will do it for free
It costs to provide hosting so you charge people to use it
5 dollars is too much in our country
i heard that aws has a free tier as well can i use it in a way i will not go past free tier
You can use free services but they expire after the free trial
-faq 1 @earnest phoenix if you want to submit your bot to top.gg. Please don't send invites in this server
@earnest phoenix
how to make the messagereactionadd trigger if a reaction is added to a uncached message in djs?
} else if (message.content.startsWith(`${PREFIX}lyrics`)) {
const genius = require("genius-lyrics")
const G = new genius.Client(process.env.GENIUS)
G.tracks.search(message.content.split(' ').slice(1).join(' '), {limit: 1})
.then(results => {
const song = results[0]
message.channel.send(`**${song.artist.name} - ${song.title}**\n<${song.url}>`)
})
.catch(err => message.reply(err))
}
})
currently making a lyrics command with Genius's api, everytime i run the command, it keeps returning the error 'Cannot read property 'search' of undefined'
@tight plinth it's not documented but it's client.on("raw", fn). this event sends raw web socket data. you can check for message reaction add event for example:js client.on("raw", data => { if (data.t === "MESSAGE_REACTION_ADD") { data.d // { user_id, message_id, ... } } });
ohk, thanks ^^
this is what the data looks like
@lament meteor ^ do that for me i have to go k thx
ok
last time i used partials for a bot i had to rewrite 99% of the code, so no thanks
lmao
ok so
yes
@pale vessel the raw event triggers, but this code doesnt:
switch (p.t) {
case "MESSAGE_REACTION_ADD":
radd({ message: p.d.message_id, guild: p.d.guild_id, emoji: p.d.emoji }, c.users.cache.get(p.d.user_id))
break;
case "MESSAGE_REACTION_REMOVE":
rrem({ message: p.d.message_id, guild: p.d.guild_id, emoji: p.d.emoji }, c.users.cache.get(p.d.user_id))
break;
}```p being the data. Any idea why?
the console.log line before that works
but not the code after
can you show both of the functions (radd and rrem)?
put console log in functions
its basically the code i have in my messageReactionAdd and messageReactionRemove events, and these two works
can we see it?
no
as ur wish
function radd(reaction, user) {
let r = c.db.get(`${reaction.message.guild ? reaction.message.guild.id : reaction.guild}.rr.${reaction.message.id ? reaction.message.id : reaction.message}.${reaction.emoji.id || reaction.emoji.name}`)
if (!r) return;
if (user.bot) return;
let member = reaction.message.guild.members.cache.get(user.id)
member.roles.add(r)
}
function rrem(reaction, user) {
let r = c.db.get(`${reaction.message.guild ? reaction.message.guild.id : reaction.guild}.rr.${reaction.message.id ? reaction.message.id : reaction.message}.${reaction.emoji.id || reaction.emoji.name}`)
if (!r) return;
if (!reaction.me) {
c.db.set(`${reaction.message.guild ? reaction.message.guild.id : reaction.guild}.rr.${reaction.message.id ? reaction.message.id : reaction.message}`, undefined)
} else {
let member = reaction.message.guild.members.cache.get(user.id) || c.guilds.cache.get(reaction.guild).members.cache.get(user.id)
member.roles.remove(r)
}
}```
i also tried to do a client.emit thing but it never triggered
yeah ik the code is bad
ok so
in my code, i always have to put _'s in the first args
because the item names in the JSON file are like: "DIAMOND_SWORD"
is there any way to change it? so it will be something like $heat uncooked fish 2
You could replace the spaces in user input with underscores
but wouldnt that be uncooked_fish_2 ?
@tight plinth this seems fishy
it works
but wouldnt that be
uncooked_fish_2?
@gentle lynx uppercase it
so shhh
ik
hello can someone help me with my code please π₯Ί
but message can be an id sometimes?
i'm not sure what doesn't work. is r defined?
the problem is that the funtion never triggers with the raw event
oh
ye
can you show the whole event?
are you sure the function never triggered?
have you tried adding a console.log() inside the function
it works o the first line tho
so it did trigger, it's just that r is not defined, making it return
hm
try logging js console.log(`${reaction.message.guild ? reaction.message.guild.id : reaction.guild}.rr.${reaction.message.id ? reaction.message.id : reaction.message}.${reaction.emoji.id || reaction.emoji.name}`)on the first line to make sure that it's the correct property for the role
how do patreon webhooks work?
like i put mine and when i click test it doesnt work
if I have an array
["TEST", "175, "LM", "7"]
how can I remove "175" and "7"?
the "numbers"
@tight plinth where did the console.log stopped working inside the function? if the db property is correct, then r should be defined
so it's the function
the first console.log works
check your db i guess
still doesn't work?
you should probably fix this then
@thick gull ye yesterday we are tolking abiut my problem in code I found it in single command module there is defined command like message.content.slice(2) but 2 is length of normal prefix so when custom prefix is less or bigger than normal then it doesnt reposne ππ im idiot i know π
what
can anyone help me? patreon webhooks arent working
hey @keen anvil im in a bit of a pickle, i know dank memer uses patreon and I was wondering how do you log / get the user who became a patron, thanks and sorry for the ping
does anyone have any clue how i can make a bot that plays spotify playlists in a voice chat?
in js
i have a problem. i'm using imdb to take movie information. the problem is when it doesn't have any movie poster, it'll return N/A, so i got UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body embed.thumbnail.url: Not a well formed URL.
i'm trying to use this trick:
'N/A': "other_photo_link",
}``` and in the thumbnail
```.setThumbnail(`${poster[movie.poster]}`)```
and yes, it works (for non poster movie), but not in movie that have a poster. so, in this case, i want to send image when it give us "N/A" and just bypass it when it have poster.
srry for slow responding if you answered my question : D
this is for movie that have poster
_yearData: '2018',
year: 2018,
rated: 'PG-13',
released: 2018-04-26T17:00:00.000Z,
runtime: '149 min',
genres: 'Action, Adventure, Sci-Fi',
director: 'Anthony Russo, Joe Russo',
writer: 'too long ;-;',
actors: 'safe space',
plot: 'safe space again',
languages: 'English',
country: 'USA',
awards: 'Nominated for 1 Oscar. Another 46 wins & 73 nominations.',
poster: 'https://m.media-amazon.com/images/M/MV5BMjMxNjY2MDU1OV5BMl5BanBnXkFtZTgwNzY1MTUwNTM@._V1_SX300.jpg',
metascore: '68',
rating: 8.4,
votes: '805,496',
imdbid: 'tt4154756',```
and this is for movie that doesn't have poster
_yearData: '1993',
year: 1993,
rated: 'N/A',
writer: 'N/A',
actors: 'Tetsuo Kurata',
plot: 'N/A',
languages: 'N/A',
country: 'N/A',
awards: 'N/A',
poster: 'N/A',
metascore: 'N/A',```
Array.join()
thanks!
@pearl trail do you use the movie object or the poster object for the url?
poster
is it this?
yes
that's a string
so...
this confused me
you can use setThumbnail(object.poster || "unavailable url") for example
i mean, when it show poster: 'N/A',, it'll send other photo link
ah
yes, i've tried that
you can use object.poster === "N/A" ? "unavailable url" : object.poster
guys is it just me or is discord.py not working properly
just you
do you use it?
no
well then how do you know itβs just me
because other bots would've stopped working
how do u guys use premium in ur bots?
You might want to take a look at the Patreon API docs for that, @drifting wedge.
To sell premium features in a bot?
yea
There are multiple ways to do that.
hey elian 
People use Patreon, PayPal integrations on a website that makes a call to the bot which is listening for them.
It's pretty complex and you need to research a lot if you happen to be a newbie.
dw im a pro π
add <style> css </style> in your description
oh thanks!
the html style tag allows you to add css styling inside the description
thats rly cool tysm!
Hey could some1 who made a dashboard for their bot dm me? (I DONT NEED UR CODE ETC)
I got a question
But i cant ask here
not me
Rip
Its a small question
How about you ask the question here instead
Cant

If there's anything you'd tell a stranger in DMs, you can tell strangers in a server.
There's literally nothing that can be said in DMs with a rando from a server that can't also be said in a server.
(not when it comes to development)
ah well. good luck with your problem then
Is it possible for a bot to read another bots embeds and parse the information from it?
Is it possible for a bot to read another bots embeds and parse the information from it?
@hollow otter yes
message objects have the embeds property
Your bot in front of approximately 0% of the queue.
100% when

check pins in #support
he was asking if the guy who is making him the bot dashboard and asking him for his bot token is scamming him
@earnest phoenix stfu
U idiot
How to host you're site to your domain (selfhosting)
is paypal integration hard?
I have a message event in it i require some external files to operate, does require stay in cache after the operations have been complete or no?
is paypal integration hard?
@drifting wedge hard? no, not at all
risky? maybe
so i know all the beginner concepts in python and want to learn the intermediate concepts like generators async and stuff. can anyone please suggest an intermediate python tutorial ? I searched up but there is not enough tutorials for intermediate stuff unlike beginner stuff
that was quite a satisfyingly descriptive question
thanks
will see! thanks
so i know all the beginner concepts in python and want to learn the intermediate concepts like generators async and stuff. can anyone please suggest an intermediate python tutorial ? I searched up but there is not enough tutorials for intermediate stuff unlike beginner stuff
@spiral crag I learned a lot of Python from Hyperskill, but they're going to a subscription model seen. Though, if you sign up before 2021, you get 3-4 months free.
is there any good embed generator thing online that easily allows users to create embeds and sends a json output? I'm searching one for my bot
is there any good embed generator thing online that easily allows users to create embeds and sends a json output? I'm searching one for my bot
@tight plinth tim has one iirc
lemme find the link in his astro dev server
k
nevermind it's the highlight.js thingu
oof
but I'm sure you can find some embed generator things on bing google
ye im trying
https://discohook.org kinda works
but they are shit, mad for webhooks or output python/js code
and when i mean code
i mean real code
this one is made fr webhooks
How to selfhost you're website (its in html)
I keep asking it, if no one responses : P
@earnest phoenix use a vpn
@tight plinth wait what
there's a lot of generators
Hugo wdym. Don't you want a JSON output?
The one I was going to link to is the same code917 linked to.
Then why not just parse it, then get the first element in the array.
You can send JSON
You don't need to create a messageembed
Then you can get the first element in the embeds array and send that, no?
yes
bruh
JSON.parse("json data").message returns the complete message. All the other data is purely for webhooks.
and discord.js has a very similar syntax to just yeeting the message to the discord API without a wrapper so it won't be that fucking hard to figure smth out
am i the only one that just absolutely stalks this channel to steal ideas
I don't steal ideas, lol. But I lurk a good amount
am i the only one that just absolutely stalks this channel to steal ideas
noop, but learn
eh i already know how to do it
so sometimes i just fix stuff for ppl and then steal it
ive done that a few times
Define what you mean by "steal". Are you copy/pasting, or just see a pic and go, "oh, I want that", and build it yourself?
anyone know why i keep getting errors with import requests
import json
import datetime
import sqlite3
from datetime import timedelta
def cashappTable():
conn = sqlite3.connect('definitelynotadb.db')
c = conn.cursor()
c.execute(
'CREATE TABLE IF NOT EXISTS cashappPayments (sender TEXT, amount TEXT, time TEXT, status TEXT)')
conn.close()
im using vsc
and python
@rich ether can you send the error/stacktrace?
eh i already know how to do it
learn as in I like this channel to learn from how others may solve a problem.
Does anyone have a lot of experience in Spring boot with mongodb?
Do you have a question for them if someone does?
yes question
Just ask it then
Querring this in Mongo Compass gives me the correct results
{$or:
[
{'title': {$regex : "po", $options: 'i'} },
{'tags': {$elemMatch: {$regex : "po", $options: 'i'} } },
{'categories': {$elemMatch: {$regex : "po", $options: 'i'} } }
]
}
However querring this in spring boot gives the following error:
Error: "Query failed with error code 2 and error message '$elemMatch needs an Object'"
@Query("{$or: [" +
"{'title': {$regex: ?0, $options: 'i'} }, " +
"{'tags': {$elemMatch: {$regex: ?0, $options: 'i'} } }," +
"{'categories': {$elemMatch: {$regex: ?0, $options: 'i'} } }" +
"] }")
List<Product> search(String input);
It's weird, they both have the same querry, but in spring boot I use parameters.
Which shouldn't be the problem, because I've also tested hardcoded
Write a migration script.
There was a npm package
@delicate shore Wha- that's a lazy approach. I'd just design your code so you can easily swap out databases whenever you want like in the picture
How to selfhost a website ?
First you need to buy a domain and Second there are host that gives you domain and host for 5$
bruh im sped the error was from me mispelling sqlite3.connect
@delicate shore Wha- that's a lazy approach. I'd just design your code so you can easily swap out databases whenever you want like in the picture
@faint prism
Wait you can ?
You mean you'll do it for me ?
You mean you'll do it for me ?
@delicate shore "I'd just" Meaning, if i was you, I would do {X} vs your approach.
So, no? lol
is there a way to see the user role that is giving him the displaycolor?
couldnt find anything
someone here want command for command? (i will give him one of my commands for him to make me one)
if yes DM me
const client = new Discord.Client();
const DiscordOauth2 = require("discord-oauth2");
const oauth = new DiscordOauth2();
oauth.tokenRequest({
clientId: "b",
clientSecret: "a",
code: accessCode,
scope: "identify guilds guilds.join",
grantType: "authorization_code",
redirectUri: "http://localhost:5500",
}).then(m=>{
const access_token = m.access_token;
oauth.getUser(access_token).then(user=>{
let guild = client.guilds.cache.find("761736406669852672");
user.add("767760486702776361");
});
})
client.login("NzY3MDIxNDY1Njc2NTQ2MTE4.X4r2Zw.7eOTjh9eObrHpkXpc3Rx90Uty8Y");
``` it returns ``TypeError: user.add is not a function``
we can see your token
nice token
and read the error
That's a rip for me
its a wrong token ofc lolz
and read the error
nice fake token
Abcdb
yes but according to guides thats the fnction
What does this error mean? ```JS
(node:22) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized
2020-10-19T14:56:43.203486+00:00 app[worker.1]: at IncomingMessage.<anonymous> (/app/node_modules/dblapi.js/src/index.js:118:25)
2020-10-19T14:56:43.203486+00:00 app[worker.1]: at IncomingMessage.emit (events.js:326:22)
2020-10-19T14:56:43.203487+00:00 app[worker.1]: at endReadableNT (_stream_readable.js:1223:12)
2020-10-19T14:56:43.203487+00:00 app[worker.1]: at processTicksAndRejections (internal/process/task_queues.js:84:21)
2020-10-19T14:56:43.203585+00:00 app[worker.1]: (node:22) 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)
2020-10-19T14:56:43.203668+00:00 app[worker.1]: (node:22) [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.
its unaothrized
which means your token is invalid
Uhhhh
or some other net request you do, can't tell from line numbers alone
lemme regen and use again
this is oauth right @sharp hollow ?
not discord oauth
so oauth lmao
which means your token is invalid
@faint prism lol, error solved
Client ID + Client Secret => Token (OAuth btw)
How to selfhost a server in HTML, could someone please help me?
I am asking this now for a while π
How to selffhost a server in HTML, could someone please help me?
@earnest phoenix That's Easy what language are you wanting to use
And don't say English
Html
ye i litterly said it
No, I mean what backend language

You derp
css?
you don't need backend if you're going to use html

You mean?
just setup a webserver
Hosting can't be done with HTML
How?
and host html files
How tho
I'm asking for the BE/hosting language
you don't need it
Some something that isn't markup
you can use html as is
okay, fine
How to start a webserver
The webserver is what I'm refering to
I referring to the Backend service that provides the html pages for a GET request. ie. The web "server"
someone here want command for command? (i will give him one of my commands for him to make me one)
if yes DM me
(lang: js)
(in cases)
yep, those are what i thought when you said languages
command for command is such a weird concept
I don't get what you are saying
Maybe your broken tooth is causing you problem in speaking
someone here want command for command? (you will make me a command that i need+dont know how to make, and i will give you one of the commands i made)
if yes DM me
(lang: js)
(in cases)
better ?
It's just a weird concept
@delicate shore
ik
Yes
Ok I give you my command you gimme your
if(message.content = "megay"){
message.channel.send("yes you gay")}
Now gimme your economy command
user left the channel
Think I broke something, anyone able to help?
lol downloaded it
for the lazy people
https://hastebin.com/enaruzamof.properties
yes.
yup
"info This module is OPTIONAL, you can safely ignore this error success Saved 1 new dependency."
and yet
is it a thing?





