ModerationService - Simplyifying Moderation

People write code to their preference, not everyone would write like how you would. You make some good points, but if you think in the performance aspect, this somewhat makes almost to no difference. You also suggested some stuff that does have some performance cost, such as assert, with ~10-20% slower speeds, and indexed table rather than array tables with ~2-8% speed difference.

I do agree with the indexed table though, it should be more easier for the developers to understand it.

3 Likes

Unfortunate as I was just about to release my own take on something like this. Regardless, please don’t use colons for cosmetic purposes, it can create issues and this just isn’t a use case for a colon.

When you assign a function using a colon roblox assumes it is a method and will provide a self variable, if you call it normally (using a period) because it has nothing to do with objects or OOP as a whole, the first parameter will automatically be assigned to a non-existent self and will just, not work.

local module = {}

function module:doSomething(string)
    print(string)
end

module:doSomething("Hello, World!")
-- Hello, World!

module.doSomething("Hello, World!")
-- nil

TL;DR
Don’t create methods unless you are going to use self.

You can read more on methods here

Edit: Alternatively you could just use self as outlined in @Gooncreeper’s post but I’d recommend just using normal functions as this has nothing to do with OOP

1 Like

Thank you everyone for your feedback! I will definitely be using some of your suggestions for the new update.

This seems interesting and useful. I might definitely use this one day.

As for my feedback, I think everything that I’ve noticed as already been said. Although instead of

if not x then ... end

you could do

assert(x, ...)
1 Like

assert has sightly worse proformance

but it straight up ends the code unless your doing something weird it shouldnt matter

1 Like

It’s just my preference, he doesn’t have to if he doesn’t wanna.

1 Like

Hello everyone thank you for your feedback. I will be definitely utilizing them In the next update! Although some of you say that assert gives bad performance, I am not sure if its true, Please answer this poll so I know if i should use it.

Should I use assert
  • Yes
  • No

0 voters

Btw, what features would you like seeing?

Honestly I dont see the point. You can already easily do this with more control and customizability.

The module might be useless, but hey, It exists and can be used for quick access to functions such as Ban, Warning and such and next update will also come with Time Bans! The code is open source so you can customize this as much as you want.

I mean, it has a good concept but it’s limiting and only has certain use case of banning etc. Some nice features would be the ability to see all users who are banned, temp banning, and another nice feature would be the ability to like use your own custom datastore in order to store the bans.

1 Like

Ill take that in consideration temp/time bans are coming next update, I also add a banlist! I’ll see what I can do about custom DB

1 Like

It’s quite funny to see the spike in moderation modules since WatchDog was released. Nobody has original ideas these days.

Also why include kick if it already exists. It’s just a single line wrapper.

Whats watchdog? Hm? (Pm cause i dont wanna take it off topic)

The kick allows cross server kicking aswell.

1 Like

I did some benchmarking and assert is 3x slower then an if statement, however the difference was so small I highly doubt it will even make a noticeable difference.

1 Like

What moderation actions do you wanna see? Please exclude time-ban as that’s already done for the next update.

Should I return tuples or tables?

Table vs Tupes
  • Table
  • Tuple

0 voters

For example, CheckBan currently returns a table
return {...}
should I make it like return a tuple?
return true, false, ...

Update Released

Version: 1.1


Added Features
  • TimeBan
Changed
  • Way of Kicking | Credits to @Gooncreeper for the idea
  • CheckBan now returns a tuple instead of a table
Removed
  • Nothing

Credits to
@Gooncreeper - Way of kicking Idea & Tuples instead of tables
@LightningLion58 - Time ban function

Github has been yet to be updated, although model was updated.

How should ModerationService Improve?


I would love to hear how you guys think ModerationService should improve, for example:

I think ... should be added because it will be good for ...

2 Likes