You’re never gonna believe me… It’s a cool new revolutionary thing called a Datastore
It’s significantly better than using google spreadsheets as a database, but the code needs a massive cleanup.
A few things:
- Don’t store a discord bot and a web server in
index.js
, make them separate modules. -
if(request.method !== "GET") return response.sendStatus(400);
is this necessary? You’re using app.get, that already ensures It’s going to be a get request. - You need to add
client.on('error', console.error)
or else your discord bot will crash whenever it runs into an error (it will). - Your bot will benefit greatly from a command handler.
- The Lua portion needs a lot of work.
Just my two cents.
I know right, funny thing is that, oh idk, there’s no api to update it. If there is, would you link it to me?
Thanks for your feedback! This reply is just meant to answer the things that you listed above
1: I’m used to writing a Discord bot’s source code in 1 file
2: I always thought that app.get() meant that it’s getting a reply from the “sub url” in the first argument, though I’ll remove it after when I’m done typing this post
3: I’ve barely used client.on(‘error’) because all the errors I’m gotten while writing bots were solved by using try/catch
4: It’s easier for me to code in one big file then separate it within different files. I’m also used to it
5: In what way?
@Meta_data
There’s no need, On the player’s ban it is as easy just to run
local function ban(plr)
plr("You have been banned.")
banList:FireServer(plr)
end
to fire if the user is indeed banned and tried to rejoin, such as pulling from the datastore if set up properly with logging the players UserID incase any name changes happen. I can show you how this type of system works and how I personally log my bans if you’d want to see it functioning.
I’d like to see your way on how you do it with the way that you explained in the previous posts
Surely, Feel free to reply back to me over discord.
What goes in the subURLForGettingBans bit? I don’t understand what you mean. Do you mean a Discord webhook?
I’ll give you an example
Say you own roblox.com and then in that value you put login
Now you can do Roblox where roblox.com/ would be your domain and login would be like a sub url for that domain
Update 9/25/2020
- Added self-ping function in Glitch, intervals at 4 minutes
I suggest you to remove it. Glitch bans any type of self-pinging code off the bots and even bans dev accounts who bypass it
Where does it say that in their TOS? I know they block people external pinging due to floods of requests, though this to?
I got no idea where in the TOS it is but I do know that any type of them are banned.
I think you’re being confused with external pinging, that for a fact I know is banable
Please read section E and J of Glitch’s Terms of Service, all pinging services are banned.
The thing mentioned 3rd party pinging services, like UpTimeRobot, but it doesn’t list anything for self-pinging. I would’ve used repl for this, but I personally have had issues with the database on that platform
I just wanna know one thing… what’s with everyone using Discord.JS as their primary library here on the DevForum?
Clearly, Discord.PY is better in so many ways, just look at how easy it is to make a command in DPY:
from discord.ext import commands
bot = commands.Bot(command_prefix='$', case_insensitive=True)
@bot.command()
async def test(ctx):
pass
# or:
@commands.command()
async def test(ctx):
pass
bot.add_command(test)
Don’t make me mention cogs and everything else, it’s just so much easier with DPY, so uh, the only reason I’d ever use DJS is mainly because of Glitch.
If you are one of those who’s using JS to program their discord bots, please use Deno instead of Node. Here’s why: Node.js vs Deno: What You Need to Know — SitePoint
Reread those sections, they state that pinging services are not allowed.
@MarkiPr0 Oh, I don’t know, maybe because a lot of people think that Python is B A D. I personally don’t like Python because I like to stick to Java-like programming languages because that’s the first one I learned
@COUNTYL1MITS Where does it say anything about self pinging? You’re using the tools that Glitch provided to self-ping your bot, yes, I guess you can count Glitch as a “pinging service”, but I don’t think they’ll ban themselves from people to ping
Section E and J both prohibit pinging services. Have you tried to do it yourself?