#development
1 messages Β· Page 793 of 1
1 cpu, 1gb ram
there's 3 bots on mine
oh nvm actually
it's like 60k guilds total
i have 2gb ram and like twice the storage
contabo
oh yeah
i was considering contabo
but i had to buy a domain with it, and
and i was impatient and didnt want to figure their website out 
contabo's prices + the ugly design makes it look like a scam
but their actual services aint bad
hello! can someone give some tips how to make customizable prefixes for servers? i'm using discord.js, mysql and mysql library and but can't figure it out
adding to database and so on was quite easy but the prefixes, i just can't get it
create a table for guilds
good
now for starters, when you receive a message, make a database query to retrieve the guild row and get its prefix
if the query doesnt return anything, default it to the default prefix
a sample code would be something like this js client.on("message", message => { database.query(`SELECT * FROM guilds WHERE guildid = ${message.guild.id}`).then(result => { let prefix = result ? result.prefix : "defaultprefix"; }) })
assuming your db library supports promises
now this is enough for a basic bot, but as your bot grows, you will need to add a cache layer
to avoid hitting the database too frequently
a sample code would be js client.on("message", async message => { let prefix = prefixCache.get(message.guild.id); if(!prefix) { await database.query(`SELECT * FROM guilds WHERE guildid = ${message.guild.id}`); if(result) { prefixCache.set(message.guild.id,result.prefix); prefix = result.prefix; } else { prefix = defaultPrefix; // optionally set it to cache as well, so it doesnt attempt to repeatedly query the database for non-existent guilds } } })
me
thanks a lot!
def get_prefix(bot, message):
prefixes = ['%','>']
if not message.guild:
return '%'
return commands.when_mentioned_or(*prefixes)(bot,message)
bot = commands.Bot(command_prefix=get_prefix)
π
js doesnt have something similar?
and also wtf are promises. i hear the word a lot
async futures being returned
discord.js does not have a built in prefix handler
also, your example shows predefined prefixes, not user-defined prefixes stored in a database
well yea
but it can be stored in a db
but ansura doesnt have configurable prefixes yet
also you have a syntax error iirc in that code
nope
either that or youre attempting to index a tuple with a tuple
on a function aswell
xD
btw i'm pretty sure commands.when_mentioned_or returns a function @modest maple
btw does d.py still have that default "invalid command" message? o was it already removed
its still a thing if it cant find the command
ye.
but
class ErrorHandler(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
print("Error handler loaded")
@commands.Cog.listener()
async def on_command_error(self, ctx: commands.Context, error: Exception):
if hasattr(ctx.command, 'on_error'):
return
ignored = (commands.CommandNotFound, commands.UserInputError)
error = getattr(error, 'original', error)
if isinstance(error, ignored):
return
elif isinstance(error, commands.MissingPermissions):
await ctx.send("You can't do that! >.>\n" +
str(error))
elif isinstance(error, commands.BotMissingPermissions):
await ctx.send("Oops. Doesn't look like I was given the proper permissions for that!\n" +
str(error))
i dont use the inbuilt handler personally
you can supress it
yeah, but isnt it bad design to have it enabled by default?
not rlly
it only triggers if its got a command loaded
that it then cant reference
or if you type %ajhdskfhdgkjerfjdkgfdlehbfrguifrgkhbfjgrkfn
thats the point, bots should ignore invalid commands, not reply to them
noo it does in console
it doesnt reply in chat
just console
I didn't know that there was promises in python π€
it used to reply in chat iirc
theyre python's version of promises
see i dont understand the whole future/promise thing. i have a LOT of trouble with some of the asyncio things cuz of that
is tuple an array?
ye
python does have arrays which are good for fast data set movement
also i remember when i wrote code to ping a mcpe server. its the only time i will ever use socket i stg
but they can still be edited
@commands.command(pass_context=True)
async def bping(self, ctx: discord.ext.commands.Context, url: str, port: int = 19132):
try:
if len(url.split(":")) == 2:
port = int(url.split(":")[1])
url = url.split(":")[0]
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setblocking(False)
sock.settimeout(10)
sock.sendto(bytearray.fromhex(
"0100000000003c6d0d00ffff00fefefefefdfdfdfd12345678"), (url, port))
data, addr = sock.recvfrom(255)
status = data[35::].decode("ISO-8859-1").split(";")
e = Embed()
e.title = url
e.description = re.sub("[Β§Γ].", "", status[1])
e.add_field(name="Players", value=status[4] + "/" + status[5])
e.add_field(name="Version", value=status[3])
e.add_field(name="Protocol", value="v" + status[2])
e.add_field(name="World Name",value=re.sub("Β§.", "", status[7]))
e.add_field(name="Default Gamemode",value=status[8])
await ctx.send(embed=e)
except socket.timeout as t:
await ctx.send("*Oops ):*\n Looks like the ping I made to " + url + ":" + str(port) + " timed out. "
"Either the server is down, not responding, or I was given a wrong URL or port.")
except socket.gaierror as e:
await ctx.send("I can't figure out how to reach that URL. ): Double check that it's correct.")
return
except Exception as e:
await ctx.send("*Uh-oh D:*\n An error happened"
" while I was pinging the server.")
print(e)
ah so tuples cannot be edited?
this hurt my brain to do
mhmm
i will wanna write a bot that can join an mcpe server and mirror chat
but i cant get past the first handshake
im pretty sure i've seen something like that before as well
@earnest phoenix tell me your secrets
diffrent language thos
dont remember
(node:9724) UnhandledPromiseRejectionWarning: ReferenceError: cmd is not defined
at Client.<anonymous> (C:\Users\spect\OneDrive\Documents\GitHub\Multipurpose-Bot\index.js:64:3)
at Client.emit (events.js:333:22)
at MessageCreateHandler.handle (C:\Users\spect\OneDrive\Documents\GitHub\Multipurpose-Bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\spect\OneDrive\Documents\GitHub\Multipurpose-Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (C:\Users\spect\OneDrive\Documents\GitHub\Multipurpose-Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\spect\OneDrive\Documents\GitHub\Multipurpose-Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\spect\OneDrive\Documents\GitHub\Multipurpose-Bot\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:321:20)
at Receiver.receiverOnMessage (C:\Users\spect\OneDrive\Documents\GitHub\Multipurpose-Bot\node_modules\ws\lib\websocket.js:789:20)
at Receiver.emit (events.js:321:20)
(node:9724) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:9724) [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.
Can someone tell me what's up with that?
i run bedrock and java servers
"cmd is not defined"
you accessed a variable before you declared it @earnest phoenix
i attempted to write a thing to sandbox a mc server program and send i/o to-from but i gave up
Or you din't defined var. cmd
we should have roles for the libraries we use
nah
i did it for java
oh ):
i want to play around with bedrock though
just didn't get around to doing it
school is killing my free time
^^
i mean if you ever wanna collab and try
i don't like working with other people most of the time but i don't mind sharing tips and tricks etc
ohhh
oki
you guys ever just wonder why exactly you started storing some Ids but dont use them
wha
w h y
wh
also pretty sure the global webhook ratelimit is pathetic af
or my Internet just dies when it sends them
xD
FINALLY I HAVE NITRO 
o
yeh okay enough of that
xd
@summer torrent would you please like to give me a link to the docs for parseEmoji() as I canβt find it.
i can't find it on docs
@quartz kindle seems like my db library doesn't support promises
yes
Watttttttttttttttttaaaaaaaaaaaaaaaaaaaaaa
Btw im in like 5 servers what are discord partners but discord bot list isnt a discord partner...
I wanna die
yes
Hey @summer torrent Are u english? Im italian
And btw i would like to do a currency system on my bot, can u help me?
Hey @summer torrent Are u english? Im italian
@solemn quartz i am azerbaijanian
sure
: D
@solemn quartz i am azerbaijanian
@summer torrent Google Translate Im Coming To You
So what's the first thing i need to do
I need to do a folder?
welcome to coding
Imma see a shorter yt video 
how not to learn shit
-bots @modest maple
the docs arnt long for no reason
@earnest phoenix
@solemn quartz use bot commands in #commands or #265156322012561408
How would I get the number of votes my bot has in javascript
dbl.getVotes()
how do i make two bots be online with the same VPS on filefilza?
Tim, I already got two folders per bot, but when i put on into the VMs side it goes in my other bots folder
@quartz kindle
lost is your user/profile folder
it should be /lost/bot1 and /lost/bot2
at least thats what it looks like
get vote
well actually
wait for vote event
on vote event
send message to channel
you can get the user from the userid given to you from the site
oh
@astral yoke use webhooks with dblapi.js
I've never heard of dblapi.js.
just gonna ask, could I send a user a dm, if they react with a certain symbol?
these white names Β―\_(γ)_/Β―
Lol, my main @earnest phoenix got banned from disc... making a new bot
It was not banned from this server
I posted mine on the 6th and they said it takes about 2 weeks so it should be soon @copper cradle
@tame ginkgo I wasn't referring to u lol

you can use either the reaction add event or attach a reaction collector to a message
depends on the language and library you're using
@quartz kindle what I am doing is making it so that on every reaction, depending on the symbol and content (image or not) to send the user a DM with a link
okay ty
Snd
anyone use mongodb?
many people do
How Can I Make A YouTube ViewBot
I am getting this error
Cannot connect to the MongoDB at 127.0.0.1:48382.
Error:
No such cmd: saslStart``` (MongoDB v2.4 because of Rasp pi 4B, tried getting a newer version but no luck) Is there a reason for this error/any way to fix this?
@simple barn luca will dm you
Oh
why are you using such an old version
@broken shale
@hushed berry I tried upgrading it to at least v3.x but the pi runs on 32 bit
and mongo requires 64 bits
Any suggestions on which one is the better ones to pick from?
I tried to boot ubuntu but that was a complete failure
just backup and install an x64 image
or that
Damn raspbian suks
ye
no :(
Ohk
Any reason why usr/bin/env: Not a directory would ever happen? Google didnt help me with anything (including adding it to path and doing permissions)
/usr/bin/env
pretty sure it's one of those virtual directores maybe?
i cant ls /usr/bin/env/ either
that was the ls command in /usr/bin showing that it exists
ik
but if you try to do what i did, which should have listed the files in env
it throws that error
so its either some sort of virtual directory or a mount point of some sort
well, would it be a directory?
judging by what i'm reading rn, no
btw, if you do ls -F it shows if a file is a dir or not @amber fractal
Tensorflow is just trying to access usr/bin/env/python for building
Which is my problem
And it doesnt seem to exist
hm
here's the error exactly, I was trying some stuff but nothing worked /usr/bin/env: 'python': Permission denied
I'm running as root
you shouldnt have to run as root unless you're installing
I am building tensorflow from source
what are you running on?
Ubuntu 18.04
so a laptop or pc
Well it's a dedicated server so a pc I'm guessing
well as long as its not arm
How would I check?
uname -m
but i doubt it is
i only mention arm cuz tensorflow wont build on my pi
I tried 1.15 and 1.15.2 which are the versions I can use
I also added #!/usr/bin/env python to the top of the script didnt do anything
I have an idea
what if you add #!/usr/bin/python instead?
im trying to think of a good way to handle 'skills'
atm was just going to have a big object on the user database entry
with the skills and their various levels
any advice?
maybe i can make it an array
and have the skills be a big json
and shoved in the array
yea ill do that
so its dynamic
nvm
I think I fixed mine by adding a symlink for python3.7 and python
can you chain filters like this in js? https://conquestsim.io/upload/broad-ticket-791.png
iirc yea you should be able to
async def on_raw_reaction_add(payload):
message_id = payload.message_id
if message_id == 680245854350737418:
guild_id = payload.guild_id
guild = discord.utils.find(lambda g : g.id == guild_id, bot.guilds)
role = discord.utils.get(guild.roles, name=payload.emoji.name)
if role is not None:
member = guild = discord.utils.find(lambda m : m.id == payload.user.id, guild.members)
if member is not None:
await member.add_roles(role)
print("done")
else:
print("Member not found.")
else:
print("Role not found.")``` ```File "C:\Users\culan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\utils.py", line 200, in find
if predicate(element):
File "C:\Users\culan\Desktop\py\beach hosting.py", line 39, in <lambda>
member = guild = discord.utils.find(lambda m : m.id == payload.user.id, guild.members)
AttributeError: 'RawReactionActionEvent' object has no attribute 'user'
let url = `https://www.googleapis.com/customsearch/v1?key=${config.searchAPI}&cx=002179459082311215073:avnitmw59ol&q=${search}`;
request(url, function (err, response, body) {
let searchItem = JSON.parse(body);
if(!searchItem) {
const searchEmbed = new Discord.RichEmbed()
.setColor(`#03d3fc`)
.addField(`Error`, `No results!`, false)
.setFooter(`Provided by: ${config.clientName} & https://developers.google.com/custom-search`)
message.channel.send(searchEmbed)
.catch(error => sendLog(error));
sendLog(message.author.username + ` sent: \` ` + message.content + `\` in channel \`` + message.channel.name + `\` of guild \`` + message.guild.name + ` \``);
return;
}
else {
const searchEmbed = new Discord.RichEmbed()
.setColor(`#03d3fc`)
.addField(`Search Time`, `${searchItem.formattedSearchTime}s`, false)
.addField(`Total Results`, `${searchItem.formattedTotalResults}`)
.setFooter(`Provided by: ${config.clientName} & https://developers.google.com/custom-search`)
message.channel.send(searchEmbed)
.catch(error => sendLog(error));
sendLog(message.author.username + ` sent: \` ` + message.content + `\` in channel \`` + message.channel.name + `\` of guild \`` + message.guild.name + ` \``);
return;
}
This is the code and im getting this output. idk why its undefined
{
"kind": "customsearch#search",
"url": {
"type": "application/json",
"template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json"
},
"queries": {
"request": [
{
"title": "Google Custom Search - lectures",
"totalResults": "402000000",
"searchTerms": "lectures",
"count": 10,
"startIndex": 1,
"inputEncoding": "utf8",
"outputEncoding": "utf8",
"safe": "off",
"cx": "002179459082311215073:avnitmw59ol"
}
],
"nextPage": [
{
"title": "Google Custom Search - lectures",
"totalResults": "402000000",
"searchTerms": "lectures",
"count": 10,
"startIndex": 11,
"inputEncoding": "utf8",
"outputEncoding": "utf8",
"safe": "off",
"cx": "002179459082311215073:avnitmw59ol"
}
]
},
"context": {
"title": "Suu"
},
"searchInformation": {
"searchTime": 0.268336,
"formattedSearchTime": "0.27",
"totalResults": "402000000",
"formattedTotalResults": "402,000,000"
},
"item
that is the output of the API
https://discordapp.com/channels/264445053596991498/272764566411149314/680261514334044328 nvm problem's still persisting
trying to figure out where it's coming from
i don't have an index.js
i am using server.js
unless digitalocean is being a bitch and has a hidden file
can you send the whole error
and the index.js its mentioning isnt your main bot file its the node modules file
at the bottom of that error
it should say where it came from
im sure the error is in your main code file
unless you went into the node modules file yourself and changed code
there shouldnt be a need to mess with it..
/root/.pm2/logs/xxx-out.log last 15 lines:
/root/.pm2/logs/xxx-error.log last 15 lines:
2|xxx | at Object.statSync (fs.js:948:3)
2|xxx | at new ShardingManager (/root/node_modules/discord.js/src/sharding/ShardingManager.js:39:22)
2|xxx | at Object.<anonymous> (/root/xxx/sharder.js:2:17)
2|xxx | at Module._compile (internal/modules/cjs/loader.js:1144:30)
2|xxx | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10)
2|xxx | at Module.load (internal/modules/cjs/loader.js:993:32)
2|xxx | at Function.Module._load (internal/modules/cjs/loader.js:892:14)
2|xxx | at Object.<anonymous> (/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js:27:21)
2|xxx | at Module._compile (internal/modules/cjs/loader.js:1144:30)
2|xxx | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10) {
2|xxx | errno: -2,
2|xxx | syscall: 'stat',
2|xxx | code: 'ENOENT',
2|xxx | path: '/root/index.js'
2|xxx | }```
Anyone for this
ENOENT = https://stackoverflow.com/questions/19902828/why-does-enoent-mean-no-such-file-or-directory
@south plover
yep
why not just use this
wait nvm
im dumb
xD
no wait
are you looking for custom statuses
or
online, offline, etc
@south plover ?
you said yep
when i asked
either or
i know its a userinfo command
i asked whether you were looking for their custom status or if they were offline, etc ;p
if you're looking for online, offline, etc use https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.status
@astral yoke language?
Okay lol
@astral yoke define client :)
const client = new Discord.Client();
And for discord
const Discord = require("discord.js");
Gotta love when people ping you and answer the question even though you said nevermind to the last person π€·π»ββοΈπ
low iqism
They're just insisting on helping
And sometimes your solution isn't always the best solution
Yeah isn't there more reliable ways to define client?
you can't provide a solution without diagnosing the problem first
that's like a doctor giving you paracetamol for terminal cancer lol
Now this is true
I mean it might work with magic...
...and some surgeries
Someone could help me use chartjs i don't understand

repost
Yes
also not a meme channel
Who is know to make bot in glitch?
I need some help
just post your question, dont ask to ask
i do
Ok
This play command doesn't work https://hasteb.in/onilenul.js
And there is no error
first
might wanna reset your youtube token
it's visible
second is there any error?
No
check your errors.js
Yes there is a code
How to make my bot online on discordbots page?
What does the status say
And no you don't post stats to DBL to get your bot online
Ok
if the bot is not online in the website, it means its not in this server. check the mod log to see if it was kicked or banned
does the bot have permissions to connect and speak?
Yes
Is there a discord bot that can add emoji's to your server(e.g you do .add [url_to_photo], . being the prefix. That it'll be added as an emoji. Couldn't find much on google
He have all the permissions @grim aspen
Ok
Fetch the emoji data from the URL inside the code and pass it to your create-emoji function
not asking how to, I'm asking if there is a bot for that π
Doubtful, you can search https://top.gg for that
@grim aspen I have prefix !
gimme a sec
Ok
see like this
No thinks so
your code is a mess tho, its difficult to find the exact problem as it has many problems
Thanks! I found a bot that can do it!
oh wait that's a different method
you're using exports
wait does glitch even the export method?
allow*
I don't know
why do you have bot.destroy()?
Where?
OK I will delete it
how to create a webhook listener using dblpy?
why are you requiring Discord, Client, ytdl and Opus if you're not using any of them?
Only webhook_port is required to run the webhook technically, other webhook kwargs have default values
how to create a webhook listener using dblpy?
I don't created all this command, I created only part of it someone help me and created the other part
then ask them
to create a webhook py self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
this can be used, but what does this do, where do it post the data and how to use it?
if you dont know what half of the command does or how it works, its very hard to fix it
They don't know what the problem
The webhook will be running under http://<ip>:<port><webhook_path>
then debug your command, put console.log's in all lines and make sure the values are all correct
and also move the play function out of the error file lol it makes no sense
If you set any integer value to webhook_port dblpy will attempt to create the webhook for you
will it automatically trigger the bot event on_dbl_vote?
If the port is open yes
and the vote is an actual vote instead of a test request
^and the url in the site is correct
you mean url of site given on DBL?
yes
k
thx
I was confused if the line would auto trigger the async bot event on_dbl_vote or not.
DBL webhook post on 5000 port TCP or UDP protocol?
wut

?
you have a misconception and you're trying to sound smart - don't
it just opens a port where it hosts a small webserver so it can accept http requests
??
TCP and UDP are protocols not ports right?
I think so
Well yeah I asked which protocol it is
mistake in my message
its still wrong af

just because its on port 5000 dont mean shit
to clear things up, http/2 and under does use tcp as a transport layer protocol usually
but you're not aware of what you asked doesn't make sense
I simply want to know which protocol to allow here, or do I add for both
custom means I am opening a port access that is not in default list
I do not want to know the difference, I want to know which protocol should i open to inbound rules for the DBL webhook port
well enjoy learning somthing in your life by reading :P
Is it ok if anyone reacts with π· on an image, my bot will upload that image to imgur and dm the user the link
automatically, here? no
Ok
automated actions should be opt in not opt out
oh boy could you abuse the fuck out of that
Someone said it was fine
that someone was wrong
take bot -> send multiple thousands of photos (could very easily be illegal)
user same bot or just self bot -> react with emoji
result -> thousands of links that are not linked to your account in anyway
still ur ip being the thing getting logged :P
Β―\_(γ)_/Β―
use tor, XD
I'll probably make a trigger command to turn that on for a minute so someone could select an image
the solution is not "use tor"
ahahahha so funny LMAO WHO MADE THIS π€£
Tor does literally nothing, also running a bot off Tor would mean a shitty response time
yup
^
Who TF uses heroku?
cheapskates
A lot of ppl actually
who tf uploads any image they get reacted to imgur
XD
Unless you pay for it it's useless
If you want to host something for free, I had a good experience with glitch.com, I get a really good ping, and very rarely get downtime. Also heroku free does not work all the time, you only get 500 hours a month, which is not a full month.
NO
?
literally just avoid free hosting
^
That too
^
I'll be switching to Google cloud compute once ppl actually start using it
no
anything that claims it's a free product is often a con and more times than not you're the product
why the fuck would you use google cloud compute
Mostly the best response time
that is
Heroku has a 16ms ping
quite literally host anywhere in the us and you'll have good latency
iirc discord api servers are in NYC
^
when discord is having a oopse your fucked anyway
?
When discord has a oopse, there is a chance Google cloud is having an oopse and I won't be paying for when discord is down
When discord has a oopse, ur bot is fucked no matter what
and just cuz discord is having issues doesnt mean your server will be
what does oopse mean?
discord is massive
your bot
will not be on the same servers as discord
when the API is having moments your system will almost certainly not even notice anything going on, so that logic is flawed
the problem however is that all your end-users will think your bot is broke
and you get to live through that

im debating selling two of my servers and buying a newer one
one of the main reasons i dont have a public bot anymore is that users are stupid 
oh god yh
literally have to lock support channels during bad outages
you can have a bold message up above that states the discord issues
and they'll still go
bot broke n??J!!1
yano maybe i wont get a ddr4 server
fuck that shit
ill stick with my ddr3 and have a decent amount of ram xD
when i fetch db.push(actions_${user.id}, Action ${num}) it gives it like (1 , 2) is there a way to split 1 , 2 in a new line in html ?
Any reason why (python and discord.py) a bot would relog after a command with no errors in console?
probably a shard disconnect
It has two servers
if you have logging enabled you will see alot of breif connects and disconnects
It just fires the on_ready event
on every command?
Basically
π±
you got a rouge client.logout somwhere or what
No. There is no logout or extra login
does the command take too long to respond?
Well it's an AI so it takes time to process
Is there a way I can make the timeout longer?
Sounds like blocking
var userlove = Math.floor(Math.random() * 100) + 1;
if(userlove )```
how can i check the number given and between such and such number?
if the code is blocking your thread, your client will disconnect due to innactivity
you shouldnt run blocking code in your main thread anyway
you should fire another thread/process for heavy computing
thats why run_in_executor exists
you should or you shouldnt?
shouldnt****
run_in_executor(print('a'*10000))
still blocking
It has 48 gb mem and 24 threads, and I'm relatively new to python can I limit processing to certain threads?
python doesnt rlly work like that
you cant choose which thread it goes in
you can tell it to run the code in a diffrent thread
So if the ai basically uses all the threads and takes too long it'll disconnect because of blocking?
Gives me something to work off of
Thanks
it should use all available threads except the main one where the bot is running
there should be a way to do that in py
your AI wont be using multiple threads by defualt no?
and python handles that by defualt anyway
Tensorflow is multi threaded to my knowledge
if its a library that is designed to use multiple threads, it will probably use all of them by default
Can I check what threads it's running on?
you dont
Dont what
dont know what thread its running on
you can get the thread number but das it
tensor flow uses concurrent futures iirc
that manages threads
you just let it go
it will only use as many as its allowed
Exactly
not stop the main thread being blocking
So how do I fix it
use run_in_executor
Oof
What did you end up putting
Oh run_in_executor wasnt defined. I mistook that it was just something that was just there. So I looked it up and I need to import asyncio and run it on the running event loop?
Yes
@modest maple getting a different error. can only concatenate str (not "coroutine") to str but I am awaiting the result
loop = asyncio.get_running_loop()
block = await lop.run_in_executor(None, self.generator.generate(...))
return block```
The `None` comes from the python docs so Im not sure if it's required
you know if its None it uses the main thread right
hence why the examples show how to use concurrent fututre's threadpoolexecutor and processpoolexecutor
So which should I use
depends on ur task
if its more IO bound then threadpool
if it takes processing power then ProcessPool
Well considering it uses all the cpu I'd say processing pool 
But idk if that's the cause of the error
The concatenate str one
Yeah it didnt
you know you dont call the function right
you give it the fucntion
un-called
and then give it the args to pass
import asyncio
import concurrent.futures
def blocking_io():
# File operations (such as logging) can block the
# event loop: run them in a thread pool.
with open('/dev/urandom', 'rb') as f:
return f.read(100)
def cpu_bound():
# CPU-bound operations will block the event loop:
# in general it is preferable to run them in a
# process pool.
return sum(i * i for i in range(10 ** 7))
async def main():
loop = asyncio.get_running_loop()
## Options:
# 1. Run in the default loop's executor:
result = await loop.run_in_executor(
None, blocking_io)
print('default thread pool', result)
# 2. Run in a custom thread pool:
with concurrent.futures.ThreadPoolExecutor() as pool:
result = await loop.run_in_executor(
pool, blocking_io)
print('custom thread pool', result)
# 3. Run in a custom process pool:
with concurrent.futures.ProcessPoolExecutor() as pool:
result = await loop.run_in_executor(
pool, cpu_bound)
print('custom process pool', result)
asyncio.run(main())```
self.generator.generate(...) != cpu_bound
you just pass it the args
result = await loop.run_in_executor(pool, cpu_bound, arg1, arg2, etc...)
Alright
Now that it's giving a traceback I can give that to you in a sec
Sorry that it's taking so long Im just slow in more ways than one

0|main | File "/usr/local/lib/python3.7/dist-packages/discord/client.py", line 312, in _run_event
0|main | await coro(*args, **kwargs)
0|main | Traceback (most recent call last):
0|main | File "/usr/local/lib/python3.7/dist-packages/discord/client.py", line 312, in _run_event
0|main | await coro(*args, **kwargs)
0|main | File "/root/AIDungeon_bot/bot/main.py", line 166, in on_message
0|main | result = await current_story_managers[message.author.id].act(action)
0|main | TypeError: can only concatenate str (not "coroutine") to str```
Anyone have a solution for pretty embed tables
Using ascii tables but people are complaining even tho I think it's better
whats ur code again @amber fractal
I forgot to await something 
Im just getting a name error now which is easier for me to understand
π€
Well it wasn't just that ```0|main | Traceback (most recent call last):
0|main | File "/usr/lib/python3.7/multiprocessing/queues.py", line 236, in _feed
0|main | obj = _ForkingPickler.dumps(obj)
0|main | File "/usr/lib/python3.7/multiprocessing/reduction.py", line 51, in dumps
0|main | cls(buf, protocol).dump(obj)
0|main | TypeError: can't pickle _thread.RLock objects
0|main | """
0|main | The above exception was the direct cause of the following exception:
0|main | Traceback (most recent call last):
0|main | File "/usr/local/lib/python3.7/dist-packages/discord/client.py", line 312, in _run_event
0|main | await coro(*args, **kwargs)
0|main | File "/root/AIDungeon_bot/bot/main.py", line 166, in on_message
0|main | result = await current_story_managers[message.author.id].act(action)
0|main | TypeError: can't pickle _thread.RLock objects
Or not ones that I'm capable of doing
show code
The only code I wrote is
result = await self.generate_result(action_choice)
self.story.add_to_story(action_choice, result)
return result
async def generate_result(self, action):
loop = asyncio.get_running_loop()
block = None
full_action = self.story_context() + action
with concurrent.futures.ProcessPoolExecutor() as pool:
block = await loop.run_in_executor(pool, self.generator.generate, full_action)
return block``` the generate function is gpt-2 and tensorflow stuff
weird indents
copied wrong
self.generator.generate <-- show this func
def generate(self, prompt, options=None, seed=1):
# print("*****\n\nBEGIN GENERATION\n\n*****")
debug_print = False
prompt = self.prompt_replace(prompt)
# print(f"*******\n\n PROMPT: {prompt} \n\n************")
if debug_print:
print("******DEBUG******")
print("Prompt is: ", repr(prompt))
# print("********\n\n GENERATE RAW\n\n**********")
text = self.generate_raw(prompt)
# print(f"**********\n\n TEXT AFTER RAW: {text}\n\n************")
if debug_print:
print("Generated result is: ", repr(text))
print("******END DEBUG******")
result = text
# print(f"**********\n\n REPLACE\n\n************")
result = self.result_replace(result)
# print(f"**********\n\n TEXT AFTER REPLACE: {result}\n\n************")
if len(result) == 0:
# print(f"**********\n\n NO RESULT\n\n************")
return self.generate(prompt)
return result```
I dont understand most of that. it's gpt-2 and ai stuff that I just use
just a thought
move that return
to just under the wait and with
not that should do anything but maybe
TypeError: can't pickle _thread.RLock objects tends to mean that task hasnt actually finished yet and is threadlocked
I've got to go, I'll try and get that done later when I have more time. Thanks.
I'll probably be back just bad time
hell yeah
i managed to memory read the discord process and get the token out of there
fun
lmao
@earnest phoenix sell that on the dark web π³
^^
@earnest phoenix that's a rude way to tell someone to stop spamming
ok
that kind of language isn't tolerated here
ok
huh
!play moonlight ear rape
store the byte buffer @frozen cedar
Now I did the unmute cmd
And this is it:
case 'Unmuta':
const Unmutato = message.mentions.members.first()
const EliminaRuoloMutato = message.guild.roles.find(r => r.name === "Mutato")
if(!message.member.roles.find(r => r.name === "Super Bot Master")) return message.reply('Non Hai Il Permesso Di Usare Questo Comando!')
if(!Unmutato.roles.find(r => r.name === "Mutato")) return message.reply('Scusa, Ma Quell Player Non Γ¨ Stato Mutato.')
if(!message.guild.roles.find(r => r.name === "Mutato")) return message.reply('Scusa, Ma Non Ho Trovato Il Ruolo, Perfavore Crea Un Ruolo Chiamato "Mutato" E Inserisci le varie opzioni.')
Unmutato.removeRole(EliminaRuoloMutato)
break;
Non Hai Il Permesso Di Usare Questo Comando! = no perms
Scusa, Ma Non Ho Trovato Il Ruolo, Perfavore Crea Un Ruolo Chiamato "Mutato" E Inserisci le varie opzioni. = Role Not Found
Scusa, Ma Quell Player Non Γ¨ Stato Mutato. = that player isn'tmuted
Before I Test It Should I add Something?
you can't rely on role names
?
you have to store the id of the mute role in a database
and then pull it from there
nu
and then get the role
anything that can be changed by a user - you can't rely on it
look at EliminaRuoloMutato const
Im italian ok
btw GiveawayBot does this too and it is much famous
the giveaway bot doesn't rely on role names
Yea
It says if u have a role named "Giveaways" you can do giveaways
yes but that's something entirely different
it's not a mute role
it's not functional
it doesn't do anything, it doesn't have any perms
it's just a flag on the user that giveaway bot checks for
a mute role is not equivalent to a flag role like Giveaways or a DJ role
you can't make a moderation bot without a database - you need to use ids and store them somewhere
otherwise you're writing shitty code and asking for your bot to be broken
const prefix = "cd";
const args = message.content
.slice(prefix.length)
.trim()
.split(/ +/g);
const command = args.shift().toLowerCase();
if(message.author.bot) return;
i have this on all my bots
but if i like do ax
it reacts too
watttaaaaaaaaaaaaaa
ok and
like the prefix = cd
and i do ax it reacts
think about that for a moment
you're comparing the entire message content to your prefix
and incorrectly may i add
!== exists
so whats the final piece of code?
Ey hello
i told you what's the problem
if(message.content.startsWith !== prefix) return;
@earnest phoenix So ur saying me that i should redo all with not "addrole" but with "createrole" and doing an if to see if the role arledy exists
So ur saying me that i should redo all with not "addrole" but with "createrole" and doing an if to see if the role arledy exists
not what i said at all
something like that btw
you need to rewrite your code to depend on ids that are stored in a database if you don't want your bot to break
If your prefix was ! for example you would have to check if it starts with ! but you should also block it if it starts with the prefix and a space just so it does not trigger on anything else
β !SPACE
!
what new feature that my bot should have?
whatever you want it to be
geez... i just need suggestions
Ok this is confusing to me..
welllllll you know what they say
I think im gonna copy paste my mute-unmute cmds in a folder at my desktop and ill do it when ill know
First 500 people will get 2 months of Skillshare free: https://skl.sh/polymatter4
Patreon: https://patreon.com/polymatter
Twitter: https://twitter.com/polymatters
Reddit: https://reddit.com/r/PolyMatter
Discord: https://discord.gg/polymatter
Itβs become popular to encourage ...
-bots @earnest phoenix
This user has no bots
i used to have a 2.5k guild bot lol
-bots @earnest phoenix
i just quit public bot deving
i now do private full stack deving and for good amount of money lol
try doing that in a testing channel
while you're at it check my github thanks luv https://github.com/cryy/
ik
-_- you make discord bots and have no public bots?
correct
Not everyone makes public ones
Lol
I mean there is even an option in the dev portal to make it private so it can't be invited by anyone but the owner π€·π»ββοΈ
anyway, anyone have bot ideas for me?
english only in this channel ^^
possible on discord js to know if a user and on computer or telephone? (my version of discord js: 11.4.2)
no, not on 11.4.2

if they can't - they don't have permission to mention the role
π€
So, give us some code?
guild.fetchMember(guild.owner);
huh
lib: discord.js
just use guild.owner
fetchMember is a promise
returns undefined
anything that is prefixed with fetch returns a promise
@wheat jolt they chaged that because bots were using role mentions for certain features but noone wanted it to be pingable
so when i fetch the actions it returns as 1 , 2
on the website
is there a way to make it like a new line?
1
2
what
fetch actions ??
split(" ").join("\n") π€ @earnest phoenix
I donβt think he needs to split
doesnt split into a new line in EJS though
Just join
what is the type of 1, 2
I need help please
exports.run = async(client, message, args) => {
const db = require("quick.db");
const Discord = require("discord.js");
if (!message.member.hasPermission('ADMINISTRATOR') && message.author.id !== "357167937070563330" && message.author.id !== "613817404253798467") return message.channel.send('Sorry, you don\'t have permission to change server prefix')
if (!args.join(' ')) return message.channel.send(`the current Perfix is {prefix} Please provide a prefix to change server prefix`)
};
db.set(`prefix_${message.guild.id}`, args.join(' '))
.then(i => {
message.channel.send(`Server Prefix has been changed to ${i}`);
}
}
module.exports.help = {
name: "setPrefix"
}
There is a error
show error
recheck your syntax
how do i make for every comma it goes to a new line?
on EJS
There is a error
exports.run = async(client, message, args) => {
const db = require("quick.db");
const Discord = require("discord.js");
if (!message.member.hasPermission('ADMINISTRATOR') && message.author.id !== "357167937070563330" && message.author.id !== "613817404253798467") return message.channel.send('Sorry, you don\'t have permission to change server prefix')
if (!args.join(' ')) return message.channel.send(`the current Perfix is {prefix} Please provide a prefix to change server prefix`)
};
db.set(`prefix_${message.guild.id}`, args.join(' '))
.then(i => {
message.channel.send(`Server Prefix has been changed to ${i}`);
}
}
module.exports.help = {
name: "setPrefix"
}
I just got stuck in the bot and I want to open Ticket, what do I do?
and i told you to recheck your syntax
Ok
@crude oriole I just got stuck in the bot and I want to open Ticket, what do I do?
Hm
I just got stuck in the bot and I want to open Ticket, what do I do?
discord added new mention permissions
I didn't found what the error is @earnest phoenix
@crude oriole
your .then is missing )
@ocean cedar what
@ocean cedar what
const args = message.content
.slice(prefix.length)
.trim()
.split(/ +/g);```
It checks on prefix lenght...
With what do i need to replace it so it checks on the prefix's content?
@earnest phoenix y, i love that new update
discord added new mention permissions
@earnest phoenix http://alex.is-bad.com/5iWes6s.png
args[0] // βcommandβ
exports.run = async(client, message, args) => {
const db = require("quick.db");
const Discord = require("discord.js");
if (!message.member.hasPermission('ADMINISTRATOR') && message.author.id !== "357167937070563330" && message.author.id !== "613817404253798467") return message.channel.send('Sorry, you don\'t have permission to change server prefix')
if (!args.join(' ')) return message.channel.send(`the current Perfix is {prefix} Please provide a prefix to change server prefix`)
};
db.set(`prefix_${message.guild.id}`, args.join(' '))
.set(i => {
message.channel.send(`Server Prefix has been changed to ${i}`);
}
} //here is the error
module.exports.help = {
name: "setprefix"
}
Yeah the new shit with mention everyone, here, all rΓ΄les When the mention is disabled
This is better to make an other permission for mention all rΓ΄les When mention is disabled
const args = message.content
.slice(prefix.length)
.trim()
.split(/ +/g);```
It checks on prefix lenght...
With what do i need to replace it so it checks on the prefix's content?
literally cursed lol
https://hastebin.com/owuhacobaq.js
my softban to be problematic because the user does not accept private messages how can I check if the user accepts mp?
@crude oriole I guess I'll be the guy that breaks it down for you you have a line .set(i => { that you never closed
});
You left the bracket open
const args = message.content
.slice(prefix.length)
.trim()
.split(/ +/g);
const args = message.content
.slice(prefix.length)
.trim()
.split(/ +/g);```
It checks on prefix lenght...
With what do i need to replace it so it checks on the prefix's content?
send returns a promise
@modest maple you still available? I had to do school stuff
@surreal sage we replied to your concern please stop asking
check
@valid holly where do i need to put or change args[0]
my softban to be problematic because the user does not accept private messages how can I check if the user accepts mp?
you can't, the only way to know is to actually dm the user, if it errors out you can't
exports.run = async(client, message, args) => {
const db = require("quick.db");
const Discord = require("discord.js");
if (!message.member.hasPermission('ADMINISTRATOR') && message.author.id !== "357167937070563330" && message.author.id !== "613817404253798467") return message.channel.send('Sorry, you don\'t have permission to change server prefix')
if (!args.join(' ')) return message.channel.send('Please provide a prefix to change server prefix')
.then(msg => msg.delete({
timeout: 10000
}); //the error is here
}
db.set(`prefix_${message.guild.id}`, args.join(' '))
.then(i => {
message.channel.send(`Server Prefix has been changed to ${i}`);
}
}
module.exports.help = {
name: "setPrefix"
}
@crude oriole look how you posted your code originally and then look where I tagged you
You are adding it in the wrong area
π€·π»ββοΈ
Ok
message.channel.send("message here")
});
} //End of code```
You never closed the Bracket for (i
Workkk
exports.run = async(client, message,
args) => {
const db = require("quick.db");
const Discord = require("discord.js");
if (!message.member.hasPermission('ADMINISTRATOR') && message.author.id !== "357167937070563330" && message.author.id !== "613817404253798467") return message.channel.send('Sorry, you don\'t have permission to change server prefix')
if (!args.join(' ')) return message.channel.send('Please provide a prefix to change server prefix')
.then(msg => msg.delete({
timeout: 10000
})
);
db.set(`prefix_${message.guild.id}`, args.join(' '))
.then(i => {
message.channel.send(`Server Prefix has been changed to ${i}`);
});
}
module.exports.help = {
name: "setPrefix"
}
This is work
Btw for your message.delete you can just do message.delete(10000) @crude oriole
Ok
.then(msg => msg.delete(10000)
I didn't even notice that ππ
how to i change the status to how many users its watching
@earnest phoenix setActivity(${client.users.size} users, {type: "WATCHING"})
"client.user.setActivity"
show error
How I do that it will write the currently prefix?
@summer torrent
@hoary elm if on d.js dev u cant do that, and you dont need to close brackets eg: .then(i => {})
add `
where?
How I do that it will write the currently prefix?
@solemn quartz show err
@restive furnace wouldn't know that I don't use 12-dev
Does anyone know how to hook up a website to a discord account like you can manage servers and shit from a dashboard?
@summer torrent shows that now
can u write whole command? to see what im doing wrong
@earnest phoenix your missing a `
where?
Before ${client
@earnest phoenix before $
ok
i did that tho
Someone knows How I do that it will write the currently prefix?
fetch it from db
Does anyone know how to hook up a website to a discord account like you can manage servers and shit from a dashboard?
oauth2









someting do the error