matrix <=> discord moderation with the power of matrix-appservice-discord

Overview

graim

matrix <=> discord moderation with the power of matrix-appservice-discord

Social

graim's website is viewable at gra.im. You can join the graim Matrix space as well as the Discord server. *the main matrix room is @ #graim-general:matrix.org

Configure/Install

Check out the configuration guide.

TODOs

  • Bug fixing
  • Better guides

Features

  • Kick
  • Ban + unban
  • Mute
  • Strike system
  • Automatically log moderation history
  • Discord moderators may use whosent to discover what matrix user is behind a Discord message
  • Userinfo command
  • moderation syncs across rooms
  • Database management commands (add/remove user, add/remove moderator)

How

graim is built with the intention of being Matrix-first. There are a few reasons for this:

  • Discord API sucks
  • Discord webhooks have incredibly little data attributed to them
  • I <3 Matrix

Every Discord user, via matrix-appservice-discord, is given its own user (i.e. @_discord_<discord_id>:matrix.org. So, graim listens for commands only from Matrix users - because Discord users are Matrix users by proxy. Simply tie a server to a group of rooms, then tie each Matrix user to a Discord account packaged in one "graim user" :D

Credits

The bot itself - luphoria

Built with major help from turt2live/matrix-bot-sdk-bot-template by Travis Ralston

Uses the dependencies:

Special thanks:

Comments
  • [FEATURE] Support third-party Discord servers

    [FEATURE] Support third-party Discord servers

    Third party Discord servers such as https://gitlab.com/litecord/litecord and https://github.com/fosscord/fosscord exist. It would be great to be able to use this bot with those third party servers.

    opened by erkinalp 3
  • [CRASH] `DiscordAPIError: Missing Permissions`

    [CRASH] `DiscordAPIError: Missing Permissions`

    To Reproduce Steps to reproduce the behavior:

    1. Fire up the bot
    2. Then on Disocrd/Matrix type ;mute @ UserExample (must be an admin)
    3. See error

    Logs

    /home/tuckerj/Documents/graim/node_modules/discord.js/src/rest/RequestHandler.js:350
    throw new DiscordAPIError(data, res.status, request);
    ^
    
    DiscordAPIError: Missing Permissions
    at RequestHandler.execute (/home/tuckerj/Documents/graim/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (/home/tuckerj/Documents/graim/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
    at async GuildMemberRoleManager.add (/home/tuckerj/Documents/graim/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:124:7) {
    method: 'put',
    path: '/guilds/968319055717085184/members/818995901791207454/roles/969439573912453120',
    code: 50013,
    httpStatus: 403,
    requestData: { json: undefined, files: [] }
    }
    

    Desktop (please complete the following information):

    • Node.js v18.0

    Additional context Add any other context about the problem here.

    opened by MotorTruck1221 3
  • [FEATURE] auto-delete styled URLs

    [FEATURE] auto-delete styled URLs

    Describe the bug You can use markdown to make links look different than they are. This could be a security issue. Ex: [https://www.google.com](this could link to a phishing page)

    To Reproduce Steps to reproduce the behavior:

    1. Go to any room that is bridged.
    2. Do the markdown magic(e.g., https://github.com/)

    Expected behavior Graim should delete message or there should be a config option to auto-delete these messages.

    opened by Rockpods 2
  • Updated Documentation website.

    Updated Documentation website.

    I also added a docker file in the website for ease of use. It can be used with Github pages however, since it is completely static. The Documentation Website Should be more user friendly. The website is built an generated using Hugo. The whole thing is untouched but the "docs" folder. A live version of this website can be seen at: https://graimdocs.motortruck1221.tech

    opened by MotorTruck1221 1
  • Whois command

    Whois command

    Hi.

    This is a command for identifying a matrix user's MXID from their display name. Since the Discord webhook bridge only displays the display name, this could be useful to prevent impersonation.

    Also included in this commit was a little optimization in lookupUser. Not sure if there is any reason to having the order execute like that, but if there is this probably broke something. Seems fine from my manual tests though.

    opened by alexfag 1
  • [FEATURE] Lint setup

    [FEATURE] Lint setup

    Basically, just a feature within the bot which will check all of the configurations for the Discord server, Matrix rooms, and bot, to ensure that everything is correctly set up. This would allow people to much more quickly figure out exactly what they need to do.

    Reqs

    • Error if not capable of role mgmt, kick, ban, mute on Discord
    • Warn if no moderator in graimdb.json
    • Warn if power level is not high enough to kick/ban/mod powerlevels in n room
    • Warn if autojoin is on in config
    • Warn for rooms not bridged directly to channel via graimdb
    • Warn if no channel mgmt permissions on Discord
    • Info if no logging room set

    Some things are probably missing from this list, but that's the general idea. None of these will cause fatal errors in graim itself, but they WILL cause graim to not work.

    opened by luphoria 1
  • [FEATURE] Logging channel/room for actions

    [FEATURE] Logging channel/room for actions

    Most extensive moderation bots will have a room in which it logs all moderation actions (i.e.: kicks, mutes, strikes, bans). This makes it much, much easier to keep track of moderation that a team is doing, as well as keeps a significantly more reliable and accessible log than Discord's audit log. The reason I didn't think to implement this already, is because Matrix already logs all moderation events right in chat - but this absolutely is a must-have feature for large moderation teams

    high priority feature 
    opened by luphoria 1
  • [FEATURE] Lock, unlock

    [FEATURE] Lock, unlock

    Would change room/channel settings, preventing users from speaking.

    Primarily, this would be a challenge due to its existence on both Discord and Matrix side. I don't want to have to implement another part of the database where entries must be manually considered, so I am thinking about it.

    My best idea so far - verbosity in syntax. User is expected to write ;lock <discord channel>, to lock whatever room the message was sent in on Matrix, and the room specified.

    The main issue is that this is not good on the M=>D side of things, because they are unable to specify a specific channel.

    This is a logic thing, for the most part, and I will update the issue as progress moves forward

    opened by luphoria 1
  • [BUG] `deleteuser` doesn't work

    [BUG] `deleteuser` doesn't work

    Describe the bug The deleteuser command does not actually remove the user from the database

    To Reproduce Steps to reproduce the behavior:

    1. Run deleteuser <graim_name>
    2. See the success message
    3. Run userinfo <graim_name>
    4. See the user is not deleted

    Expected behavior No user in db

    Logs N/A

    Desktop (please complete the following information):

    • Node.js version 18

    Additional context N/A

    opened by luphoria 1
  • [BUG] Unban unsuccessful on Discord end

    [BUG] Unban unsuccessful on Discord end

    Describe the bug When you run unban on a banned user bridged from Discord to Matrix, the unban doesn't go through on the Discord end.

    To Reproduce Steps to reproduce the behavior:

    1. Run ;unban on user that already is banned
    2. Note that the user is not unbanned on Discord

    Expected behavior User is unbanned from both Matrix and Discord

    Logs N/A

    Desktop (please complete the following information):

    • Node.js version - 18

    Additional context It makes sense that it didn't work, because I have done minimal testing on the ban and unban commands (Discord banned my testing accounts from the platform for suspicious activity).

    opened by luphoria 1
  • [CRASH] mute.ts: `val is not a non-empty string or a valid number. val=undefined`

    [CRASH] mute.ts: `val is not a non-empty string or a valid number. val=undefined`

    To Reproduce Steps to reproduce the behavior:

    1. run graim @ latest
    2. ;mute
    3. crash

    Logs

    /home/hi/graim/node_modules/ms/index.js:33                                                                                throw new Error(                                                                                                              ^                                                                                                                                                                                                                                       Error: val is not a non-empty string or a valid number. val=undefined                                                       at module.exports (/home/hi/graim/node_modules/ms/index.js:33:9)                                                        at /home/hi/graim/lib/commands/mute.js:52:26                                                                            at Generator.next (<anonymous>)                                                                                         at /home/hi/graim/lib/commands/mute.js:8:71                                                                             at new Promise (<anonymous>)                                                                                            at __awaiter (/home/hi/graim/lib/commands/mute.js:4:12)                                                                 at runMuteCommand (/home/hi/graim/lib/commands/mute.js:22:12)                                                           at CommandHandler.<anonymous> (/home/hi/graim/lib/commands/handler.js:103:51)                                           at Generator.next (<anonymous>)                                                                                         at /home/hi/graim/lib/commands/handler.js:8:71 
    

    Desktop (please complete the following information):

    • Node.js version

    Additional context the issue is that I had assumed ms was okay with undefined i.e. bad data, and simply returned 0 (as it does for other strings). however, if there is NO argument, undefined is passed, which crashes ms.

    opened by luphoria 1
  • [FEATURE] Content filter

    [FEATURE] Content filter

    This feature would simply catch any messages that include content which is specified by the moderators (regex, i'm thinking). That way, you could auto moderate things like slurs, spam, or whatever else you'd like

    opened by luphoria 0
  • [FEATURE] More receptive responses on non-fatal failures

    [FEATURE] More receptive responses on non-fatal failures

    graim currently essentially ALWAYS tells you that the operation was completed successfully. While this is fine 90% of the time (usually, any non-fatal errors are not really errors but simply non-issues), I think it would be a lot more useful for the bot to at least warn you in the situation that something has gone wrong partially.

    For example - when a user is banned, graim will attempt to ban them from discord and matrix. As long as the command isn't improperly formatted, graim ALWAYS responds with a success - even if there was not actually a success in the action. For example, if graim's power level isn't high enough in every room, then it will not be able to ban the user - however, there is no way for the end user to know the interaction failed, without logging on Matrix themselves and seeing the ban event in the log.

    Mostly I am using this issue to track a long-term implementation of more reception from graim, because this is a big design issue that I am currently completely ignoring. First, I need to figure exactly how I want output to show (should I log in every room/channel individually that it failed in? Should I print out another message after the ban success showing any warns?)

    Any outsider input is greatly appreciated!

    I am going to be tracking this development in the commit names, so it should be easy to follow progress on this specific development.

    opened by luphoria 0
  • [FEATURE] Purge by user/graim user

    [FEATURE] Purge by user/graim user

    I think a good feature to implement to graim would be purging by user/graim user. this is a pretty common feature of moderation bots and is super super useful in the event of, say, a raider. with one command you can then delete ALL of one user's messages

    opened by luphoria 1
Releases(v1.2.2)
  • v1.2.2(Aug 10, 2022)

    v1.2.2 patches release 1.2.1 with a few new additions and patches.

    Additions

    • lint command. Simply run ;lint in any room/channel, and graim will report back any misconfigurations in your setup! (#17)
    • graim will automatically join every room in a space you invite it to!

    Fixes

    • typos exterminated
    • deleteuser works as expected again
    • no longer crashes if supplied nonexistent channel
    • fixed parsing of Discord IDs, now that new IDs are 19 characters instead of 18 characters (#19)
    Source code(tar.gz)
    Source code(zip)
  • v1.2.1(Jun 8, 2022)

    Additions

    • Logging room/channel (the bot can now log moderators' actions more visibly than in feed/audit log)!
      • To use the logging room, create a Discord channel and matrix room for the logging. Then, after making sure it is bridged and graim is invited, run the command setloggingroom. From then on, all moderator actions will be automatically logged! :slightly_smiling_face:
    • You no longer need to be a matrix user to run adduser

    Updates

    • whosent heavily improved
      • Thanks to a pull request from InfoWars, it now additionally searches by display name!
      • The sanitization is now much cleaner and should make almost any query no longer fail
    • You can now configure the log level in the console from default.yml
    • Much prettier and accurate text responses (i.e. using MentionPill for users mentioned)
    • You can now run lookupUser with a Discord snowflake ID

    Fixes

    Too many to list! Here are some highlights:

    • Fixed 2 crashes (kick.ts, ban.ts)
    • Fixed lookupUser when Discord ID includes a @mention
    • Fixed certain text parsing and other typos
    Source code(tar.gz)
    Source code(zip)
  • v1.1.3(May 13, 2022)

    This version of graim includes one semi-major fix:

    • Fix unlock bridge (https://github.com/luphoria/graim/commit/cfcd45f89449b1e341f8e9459147859e1373031a)
    Source code(tar.gz)
    Source code(zip)
  • v1.1.2(May 11, 2022)

  • v1.1.1(May 11, 2022)

    v1.1.1 patches release 1.1.0 with a few minor fixes:

    • Fix crashes in lock and unlock
    • Automagically sync db if it does not include core components
    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(May 11, 2022)

    Graim v1.1.0 is here, hooray!

    New

    • clearstrikes (#4)
    • lock and unlock (#8)
    • bridgeroom and unbridgeroom (for lock and unlock, will also make other commands easier to implement in the future)

    Fixed

    TODO

    • Purge user messages (#3)
    • More receptiveness on non-fatal failed commands (#6)
    • Harden lock and unlock from potential crashes
    • More bug fixes!

    Enjoy :)

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(May 6, 2022)

    This is the first "full" release of graim. It implements:

    • whosent
    • strike and clearstrikes
    • adduser and deleteuser

    It fixes:

    • A lot of bugs
    • A few security issues

    TODO:

    • harden deleteuser for better work (#7)
    • Purge user messages (#3)
    • Lock/unlock rooms (#8)
    • More bug fixes!

    Enjoy :)

    Source code(tar.gz)
    Source code(zip)
  • v0.0.1(Apr 27, 2022)

Owner
"See you on the next cosmic corner." - Loaf of Bread Man
null
Use Matrix as a backend for local-first applications with the Matrix-CRDT Yjs provider.

Matrix CRDT Matrix-CRDT enables you to use Matrix as a backend for distributed, real-time collaborative web applications that sync automatically. The

Yousef 604 Jan 7, 2023
A matrix bot to monitor and respond to investment scam spamming across the matrix platform, for example in rooms with a permanently offline admin.

Spam Police A matrix bot to monitor and respond to investment scam spamming across the matrix platform, for example in rooms with a permanently offlin

jjj333_p 7 Dec 26, 2022
🌹 Your one stop place for moderation and more.

Azalea Azalea is a advanced moderation bot used. This repo includes, the discord bot: Moderation, server stats, welcome & leave, reaction roles, auto

Saige 2 Sep 13, 2022
... a contemporary perspective on how to integrate B2C Commerce and the Salesforce Customer 360 Platform to power frictionless customer experiences in the B2C domain.

Salesforce B2C Commerce / Customer 360 Platform Integration Introduction Salesforce B2C Commerce / CRM Sync is an enablement solution designed by Sale

Salesforce CommerceCloud 45 Dec 9, 2022
The aim is to provide a hassle-free way to use the data to build applications to show close-to-realtime power-outage info in Mauritius

Mauritius Dataset for Electricity Dataset View Dataset The aim is to provide a hassle-free way to use the data to build applications. Example applicat

Sandeep Ramgolam 5 Dec 15, 2022
Hands-on lab for Power Platform Tools for Visual Studio Code

Power Platform Tools for Visual Studio Code Lab This repository contains the lab instructions and content on how to experience the Power Platform Tool

Microsoft 8 Dec 1, 2022
Google-Drive-Directory-Index | Combining the power of Cloudflare Workers and Google Drive API will allow you to index your Google Drive files on the browser.

?? Google-Drive-Directory-Index Combining the power of Cloudflare Workers and Google Drive will allow you to index your Google Drive files on the brow

Aicirou 127 Jan 2, 2023
A various color Matrix filters and Presets for pixi.js

Pixi Color Effects A various color Matrix filters for pixi.js with TON of presets! DEMO Install # npm npm install pixi-color-effects # yarn yarn add

null 109 Nov 24, 2022
The full power of the Go Compiler directly in your browser, including a virtual file system implementation. Deployable as a static website.

Static Go Playground Features Full Go Compiler running on the browser. Supports using custom build tags. Incremental builds (build cache). Supports mu

null 25 Jun 16, 2022
Neo: Hierarchical Confusion Matrix Visualization

Neo: Hierarchical Confusion Matrix The confusion matrix, a ubiquitous visualization for helping people evaluate machine learning models, is a tabular

Apple 252 Dec 15, 2022
A set of common UI Components using the power of CSS and without Javascript

A set of common UI Components using the power of CSS and without Javascript

Felipe Fialho 650 Dec 31, 2022
WIP: Power-pack for Turbo Streams

TurboPower turbo_power is a power-pack for Turbo Streams. It provides Turbo Streams with a bunch of new actions and additionally adds the morph action

Marco Roth 123 Jan 4, 2023
Dynamic components with the power of next-gen bundle tools

Moon island architecture example Dynamic components with the power of next-gen bundle tools What is this? This example shows you how the moon-island a

idler 8 Oct 21, 2022
This tool allows you to draw up plans for facilities from Foxhole's new Inferno update. It takes power and resource needs into account to help you efficiently design your facilities.

Foxhole Facility Planner This tool allows you to draw up plans for facilities from Foxhole's new Inferno update. It takes power and resource needs int

Brandon Ray 23 Dec 23, 2022
This widget allows to conduct polls in Matrix rooms.

Matrix Poll This widget allows to conduct polls in Matrix rooms. But unlike MSC3381, it is designed for more complex scenarios, like polls with multip

Nordeck IT + Consulting GmbH 14 Dec 19, 2022
A POC of a Discord.js bot that sends 3D rendering instructions to a Go server through gRPC which responds with the image bytes which are then sent back on Discord.

A POC of a Discord.js bot that sends 3D rendering instructions to a Go server through gRPC which responds with the image bytes which are then sent back on Discord.

Henrique Corrêa 5 Jan 8, 2022
A package that allows your bot of discord.js v13 & v14 to create the new awesome Discord Modals and interact with them

A package that allows your bot of discord.js v13 & v14 to create the new awesome Discord Modals and interact with them

MateoDeveloper 85 Dec 23, 2022
An NODE Module For Getting Data From Discord API Called Discord Info

An NODE Module For Getting Data From Discord API Called Discord Info

hadi 7 Jun 7, 2022
The new modern discord token grabber & stealer, with discord password & token even when it changes (old. PirateStealer)

?? Discord Server - ?? Premium - ?? Builder - ?? Features Authors Stanley Bytixo Autist69420 PirateStealer (by Brooklyn inc) The new modern discord to

Stanley 143 Jan 6, 2023