Git Product home page Git Product logo

modix's Introduction

MODiX - .NET C# Discord Bot

GitHub Actions Workflow Status Discord GitHub License

MODiX is a .NET C# Discord Bot that focuses on versatility, moderation and fun tools, primarily for users of the the largest C# Discord guild. MODiX's featureset is driven primarily by the C# guilds' needs, but feature requests, suggestions and other contributions are welcome and the bot is fully self hostable, and multi-tenant capable.

MODiX's primary features:

  • C# REPL, to execute C# directly in Discord
  • Persistent user notes, warnings, muting and banning
  • Message quoting embeds
  • Custom inline message tags, acting as macros to send templated messages that frequently get mentioned

If you want to report issues, discuss development or simply meet those who maintain MODiX, jump in on the dedicated MODiX-development channel on Discord.

How to contribute

Development environment

You will need the .NET 8 SDK installed. MODiX is developed in VS Code, Visual Studio and Rider to maximise developer satisfaction.

We recommend you set up a containerised environment. MODiX is powered by a PostgreSQL database, and the easiest way to get started is by using Docker (or equivalent). Steps below apply if you use Docker.

The following assumes you have:

Steps

  1. Open a shell in the root of the MODiX repository
  2. Execute docker-compose -f dev.docker-compose.yml up -d
  3. Open a shell in src/MODiX
  4. Execute dotnet user-secrets set DiscordClientId {CLIENT_ID} replacing {CLIENT_ID} with your Discord application client ID
  5. Execute dotnet user-secrets set DiscordClientSecret {CLIENT_SECRET} replacing {CLIENT_SECRET} with your Discord application client secret
  6. Execute dotnet user-secrets set DiscordToken {TOKEN} replacing {TOKEN} with your Discord bot token
  7. Start your IDE and debug or dotnet run

Suggestions, bugs and discussions

All notable work will be documented as GitHub issues. Ensure you do not work on any new features unless it is documented as a GitHub issue, so as to avoid disappointment if any of the core maintainers disagree.

Notable dependencies

The work we do would not be possible without these notable dependencies. Note that this list is not exhaustive.

  • Discord.NET - The framework we rely on to communicate with Discord itself
  • Entity Framework Core - The ORM of choice for all queries
  • efcore.pg - PostreSQL provider for Entity Framework Core
  • LINQKit - Extensions over Entity Framework Core for ergonomic querying
  • Humanizer - Readable date/time formats for humans, because we're not machines

Hosting

At this time we do not offer a managed hosted service for MODiX. You can host MODiX along with all of its dependencies using the docker-stack.yml file as a template.

modix's People

Contributors

333fred avatar blackcentipede avatar calledude avatar chasedredmon avatar cisien avatar cytraen avatar dependabot[bot] avatar finitereality avatar foxtrek64 avatar gnbrkm41 avatar hamsterland avatar jakenveina avatar jasonhughes94 avatar jay-madden avatar jmazouri avatar joshuaedwardcrowe avatar jrusbatch avatar n-ultima avatar nullentity avatar patrickklaeren avatar rubynova avatar sabihoshi avatar scott-caldwell avatar sergio0694 avatar spixy avatar sylveon avatar thaumanovic avatar trustieee avatar velvettoroyashi avatar wrexbe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

modix's Issues

Infraction Expiration

Need to implement auto-expiration for infractions. I.E. infractions that have expired (based on Duration but have not been marked as Rescinded should be rescinded automatically, with the bot itself as the "Rescinded By" user.

Automated action log

Things like decaying infractions, invite puring, spam detection, etc should log to a channel. Today that is #mod-log

Rollout Data Seeding

As we're not keeping a history of migrations and everyone is recreating initial migrations, some people may rely on data to be inserted/modified as part of their migration; these would be deleted when merged and someone else rescaffolds the initial migration. This issue serves as a homebase for all "manually" added migration members.

Comments on this issue with a common layout may be a good way of conveying this. Format I suggest, short and simple:

Issue ref and small summary

Code that needs to be inserted

Promotions feature rework

Need to rework/refactor the promotions feature to match the Repository/Service structure used by all the rest of the DB-related code.

Most notably, DBPromotionRepository needs to NOT create UserEntity record directly, as it can cause concurrency issues. UserRepository should be the only one messing with the Users table.

Proposal: Raid Detection

This proposal is to implement some kind of raid detection in MODiX, which can automatically issue an @Staff notification in #mod-log if it detects a potential raid.

The criteria for defining the start of a raid, and end of a raid, are obviously the most interesting part about this proposal. My initial thoughts are...

  1. If a certain number of users have joined the server, within a certain timeframe. Say, 10 people in 30 seconds, for example.
  2. Potentially, a lower threshold, for users that were created briefly before joining.
  3. Once a notification has been issued, there would need to be a cooldown to prevent repeats during the raid. Say, "once an hour has passed with no new users joining".

[Bug?] Promotion Campaigns allow multiple responses from same user.

It is possible to enter numerous votes/comments from the same user account to an individual Promotion Campaign via the Web Interface.

Suggestion:
Store user id against comments/votes and allow only one instance per user (amend existing on re-submission, as opposed to just dropping it).

Discord Infraction Embeds

Listing out the users' infractions in an embed instead of using an ASCII table. It will help with categorizing infractions by type.

Document usage

A through usage document needs to be available for new users to understand how to manage moderation with this bot.

Update readme.md

It should describe how to setup and run locally, as well as a better high-level description of features

Implement new features in frontend

  • Infraction browsing / review
  • Moderation log browsing
  • Managing user claims
  • Managing designated roles
  • Managing designated channels
  • Integrate new authz/authn systems

Comment with more as they are added.

Move message from one channel to another

Add ability to move a message from one channel to another.

Something like:
!move 12345 #foo because i wanted to

Would move a message with the ID of 12345, to the channel #foo, with a reason field stating "because i wanted to"

Implement base for infractions

This should act as a baseline to add different kinds of moderational actions upon.

An infraction could be the baseclass for tempmutes, warnings, bans etc. It should contain stuff that can be searched through for an user, meaning there should be an unique identifier, it should be associated to a user(the bad guy) and a moderator(the good guy). A reason should be required.

The interface for searching throw them should be idiomatic and easy. Maybe we can do that using memorable shortcuts? This needs to be iterated upon

Facilitating mentor offers and acceptances

It has been a long standing issue that we are not entirely sure if people are actually accepting the offers posted in the mentoring channel. Adding functionality to facilitate mentor/mentoree offers and acceptances through Modix would give more insight into this.

An implementation may work as follows:

Users can post offers through the web interface. The mentoring channel is locked to all posters except the bot, so the bot will be responsible for posting the offer made in that channel. An emoji reaction is added to the post, where adding an additional reaction to it will count as an acceptance of the offer, and the offer posting is then edited to mark it as accepted. The original poster of the offer can then accept the acceptance, or decline it to reopen it.

Unit Testing

Vote now for your preferred unit testing frameworks!

I'm partial to setups including NUnit + NSubstitute + Shouldly.

Spam prevention

MODiX currently has no spam prevention. As discovered in #83, although we purge invite links, there's nothing stopping a user from posting multiple invites and letting MODiX itself spam the channel with replies to the user (as well as the #debug-log).

We need some sort of cooldown or functionality like Rowboat. Rowboat checks the amount of links sent by the user in X timespan, and automutes. Would be good to port that feature,

User Avatar is missing file extension

When I log in, the source of the image being used for my avatar is https://cdn.discordapp.com/avatars/96642168176807936/acf8818538bfce80a29793085e46de9c.

BeanUI

@Inzanit has promised a WinForms UI - this issue is to capture this feature.
proof

Tags

I wanted to explore the possibility of porting RoboDanny's tag command.

Is there any particular functionality that we need from tags that we don't currently have?

Does the tag ownership model work fine as it is? Tags seem to be owned by individuals, so they're only editable by their creators or staff (?), but we collectively use them in moderation and assisting. Would it make sense to have a pool of server tags and do away with ownership completely?

An option might be to enable the creation of multiple tag pools that are collectively controlled by a particular role. For example, tags popular in the beginner-questions channel, like yellowbook and devessentials might belong to the help pool, which can be added to and edited by Associates and higher. There might also be a tag pool called modtools with read access restricted to Operators and higher, and so on.

Proposal: Proxy Invite Links

I've heared we use an "aka" url service, which sounds like it may do some of this already, but I'm gonna post this anyway.

This proposal would be to have invites to the server handled EXCLUSIVELY through MODiX.

What MODiX could do is support an HTTP endpoint like "mod.gg/[servername]/join" which simply returns a 302 with an actual invite link. This would have the following benefits:

  1. MODiX could either generate a new invite link, per request, or reuse an invite link for only a short period of time, before expiring it.
  2. MODiX could enforce rate-limiting on people joining the server. Say, only once every 5 seconds.
  3. MODiX could easily implement a "!raidmode" command that prevents people from joining the server, until the raid has ended.

Downsides include:

  1. No one would be able to join the server during MODiX downtime.

Consistency Cleanup

At some point after release, we should refactor some stuff for consistent naming and organization. Such as the following:

  1. Interfaces either always being in separate files, or always in the same file as the implementation (for single-implementations).
  2. Use of the Async suffix (or not) for methods returning Task/Task<T>.
  3. Use of [Required], [DatabaseGenerated], etc. where not explicitly needed, in favor of being self-documenting of intention (or not).

Feel free to add more.

Acknowledge when an infraction has been deleted

Currently issuing !infraction delete <id> will delete the reaction without any feedback to the issuer of the command. We should provide some sort of visual feedback, perhaps in the form of a reaction, to indicate that the command was successful.

Roslyn analysers

With a bunch of people working on MODiX, we're starting to see some divergence in code conventions. It might be a good idea to chuck some Rosyln analyzers in and make warnings get treated as errors. This will allow us to decide on and enforce one standard code style that we all use for this project.

Proposal: Rules/Buffer Channel

I know this has been brought up before, but it came up again today in the aftermath of RaidVite. And datadata, at least, expressed that he previously thought the suggestion was to require people to formally apply to join the server, and get approval.

The actual suggestion is just to limit new users in the guild to only seeing the #rules channel, until they are granted a "User" role by MODiX, which is triggered by one of the following:

  1. After 60 seconds (or whatever) have passed
  2. When the user enters an "!accept" command, or similar, to confirm their acceptance of the rules.

This would have the following benefts:

  1. Allow MODiX to have a "!raidmode" command that simply stops it from handing out the "User" role until Staff decides the raid has cooled off.
  2. Actually maybe force some users to read the rules, before posting.
  3. Help prevent bots coming in and scraping data. Apparently, the Discord API "Get Users within a Guild" query might not limit based on what channels the caller can see?

I myself support this idea quite a lot. Kameko originally brought it up today, and everyone in channel seemed to like it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.