Giter Site home page Giter Site logo

robbb's Introduction

Say hi to Robbb!

A Discord bot for the Unixporn community

Now written in a good language!

Dependencies

  • Rust
  • sqlx-cli (if you need to change the database schema)

Set up environment variables

The bot reads the data it needs from environment variables. To see which values have to be set, check out the provided .env.example file. you can use export $(cat .env) to export the variables from a .env file in your current environment.

Extra information

Most environment variables are retrieved by right clicking, and copying the ID of the relevant channel, category, role. You need to have developer mode turned on for that to be possible.

  • TOKEN: The discord bot token, retrieved from: https://discord.com/developers/applications
  • GUILD: The ID of the guild, where the host resides
  • ROLE_*: IDs of relevant roles, easily copied from Server Settings -> Roles.
  • ROLE_COLOR: Unlike other ROLE variables, this is a comma (,) separated list, ex.: ROLES_COLOR=825158129711972372,635627141123538966
  • CHANNEL_*: Channel IDs, based on which the bot performs moderation or responses
  • ATTACHMENT_CACHE_*: Location (directory) and size of local message attachments cache (in case they get deleted)

Additionally, you can use this script to generate the role & channel variables from a template server

Database

The bot uses a SQLite database, which does not have to be started externally. The included sqlite-db file is not the actual database used in production, but just an empty database used for development. To change and work with the database, use sqlx-cli to add migrations and generate a new, updated database file.

robbb's People

Contributors

amepebbles avatar auscyberman avatar davidv171 avatar dependabot[bot] avatar druskus20 avatar dylanaraps avatar eepykate avatar elkowar avatar its-darsh avatar javacafe01 avatar jimmysit0 avatar legendofmiracles avatar ltperiwinkle avatar mlvzk avatar moni-dz avatar mtvare6 avatar phisch avatar renovate[bot] avatar safinsingh avatar tanish2002 avatar undefineddarkness avatar willeccles 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

robbb's Issues

Rewrite progress

Commands

  • ban
  • delban
  • desc
  • fetch
    • normalize and validate fields where necessary
  • git
  • info
  • latency
  • modping
  • move
    • only repeat pings
  • mute
    • mutes should be logged in modlog
    • response should probably be an embed
  • note
  • notes
    • mutes should show the duration
  • pfp
  • repo
  • restart
  • say
  • setfetch
  • warn
    • show warn count in warn log embed
  • blocklist
  • top
  • poll
  • purge
  • role
  • help
    • support !help info etc
  • unban

Event-handlers

  • join events
  • leave events
  • message edits
  • message deletion

Other functionality

  • poll single-vote enforcement
  • include context links everywhere it makes sense
  • keep-at-bottom CONTRIBUTING.md message in server-feedback
  • Media message logging

Other TODO

  • Consistent embed format with timestamp etc

  • improve sql

    • handle "upsert"s in profile via SQL
    • de-shittify SQL query for notes
  • make embed formatting use things like bold etc

  • use embed for !setfetch explanation

  • show description at the top of fetch

  • fix setfetch

  • !git and !dotfiles should enforce URL format

  • !git and !dotfiles should print your own git and dotfiles when ran without arguments

  • fix memory unit in fetch to use KB rather than KiB

  • !help should only show non-mod commands for non-mods

  • if no mods are online/active, modping should ping the mods role

  • modping should only ping online mods

  • detect who deleted a message and add that to the bot-messages entry

  • Numbers should not always be treated as userids - users could be named 502, for example.

  • error message for unknown user sucks

  • silent purge? (should this be always, or as an option?)

  • #feedback posts have the thumbs in the wrong order

  • bulk-deletions need to be logged in #bot-messages

  • Helper-specific permissions

  • spam-detection

  • role-mentions should be handled by !role

  • success embed should be green

  • disambiguation and polls should be able to use the full 20 reactions that are possible

  • replace "banned" in ban-logs with "yote" because funny

  • replace "yeeted" with "yote"

  • ban should obviously not delban

  • update fetch image on showcase post

  • fix formatting of Memory in !top

  • insufficient permissions error message is shit (requires helper_or_mod)

  • notes does now ago

  • blocklist is missing usage

  • Memorys in top (use s/ys$/ies/)

  • fetch <person> image don't work :(

  • showcase submissions should be allowed to contain anything that embeds, no?

  • !roles command as an alias to !role

  • send :poggersphisch:, :police: and :starecry: emotes for the respective success, and error messages

  • notes are fucked (migration script issue)

  • ghostping thing should use :reee: and not work in showcase (do we want ghostping detection? currently just disabled it, idk)

  • top when doing like !top Distro [aA]rch without the backticks needs a good error message

  • !move should not ping the moving user

  • blocklist violations don't add notes currently

  • spam-protection for all accounts, not just young ones (let's not, for now)

  • setfetch etc don't check blocklist before running (does this really need fix? :starecry:)

  • fetch migration - spaces etc in field names need to be adjusted, currently still fucked. i.e. DisplayProtocol vs "Display Protocol"

  • tag with spaces in name cannot be looked at :(

  • Failed unmute does not set mute as inactive, meaning that it'll continuously try to unmute them again and again

  • usage of blocklist should mention the backticks

  • error while handling reaction_addd event

  • !desc, !git and !dotfiles should gib error when not set -> migration issue: empty strings in profiles table should be NULL

  • !poll multi literally just ded (no reactions)

  • be a bit less correct in the message.txt message

  • maybe use the bucket shit to avoid excessive rate limiting? idk prolly don't matter

  • command specific help should list subcommands properly

  • !poll single vote enforcement broken?????

  • !poll without args should print usage (currently just deletes the msg)

  • help for mods is hitting the field limit - use pagination? two mesages?

Potential raid issue from discord's end

Hi, there was a raid in another dev server that happened due to a bot error, ending up making it look like this:
image

Friend sent me this explanation:
"This was an issue on Discords end not validating payloads properly in combination with bots that allow echoing any user input, both of which are not an issue in our server luckily.
more information in public announcement here:
image

Let me know if I need to answer more specific questions and I will, but this might be worth checking and making sure tru- i mean rob isn't affected by this.

Also, if possible, might be worth having at least one of the dev servers subscribe to the dev announcement channel from discord since they will post updates regarding bugs and issues. That's a side point though.

Highlights

Enable a highlight feature where you get a dm with context of conversation where your keyword was in the conversation, example for mander by highlight bot in different server:
2021-03-20-130713_827x247_scrot

These are options that the bot has:
2021-03-20-130758_466x527_scrot

You set a list of highlights like so:
2021-03-20-131105_334x372_scrot

Also deletes your list and message after a few seconds so people don't abuse your highligts to annoy you.

Highlights remain even if messages are deleted, so if you are mentioned and the conversation is deleted, the whole conversation is still preserved.

Nothing necessary, just thought it would be a neat feature to add

Edit: realized that highlights don't activate while you are in chat, so for example, if someone is talking about mander and i sent a message in the same chat x seconds earlier, then i won't get a dm about it because I was there. Might be something to consider if you guys want to implement this

Mentions don't show in polls

Channels and user mentions don't show in poll, as the description is put in the title. I believe descriptions were added into a field when we had trup.

image

Add custom distro logos

Now most of the distro logos on the robbb bot are bad, some even have desktop screenshots , not logos. For example red hat.

[FEATURE] Ice autoban filter

Honestly ice is so predictable now that we could just humor him and code an autoban into the bot to kick him out.

Things to check for ice:

  • Pings pome, aurelian, mander and sometimes, wooosh
  • Account creation date less than 3 days old
  • Set list of swear words known to be used by him in conjunction in pings

[Bug] Issues with the message "preview"

  • very spammy

    • large embed
    • reply
    • no character/line limits
  • no way for regular members to get rid of it

    • stays if either messages (and even both) are deleted - can be bad if someone links a message you don't really want public (and/or forgot to delete)
    • no way to opt out (like you can with normal embeds by putting <> around the link)
    • someone suggested reactions to delete but that'd just make it even larger

Fetch preview is removed due to a non-image post in #showcase

Problem:

The image shown in a fetch is removed if a user sends an attachment in the showcase channel that is not an image or a gif. I believe this was a problem with Trup as well.

Expected Behavior:

If I post a video in the showcase channel, my fetch image should not be removed.

Command proposal: !watch

By elkowar: unixporn/trup#91

!watch <user> [time]
would create a hidden channel where all actions of the given user are logged. This would make it easier for the mod-team to keep an eye on people, reducing moderation effort.
Watching would stop either after the time ran out, or after a mod runs !watch stop in the given channel.
The channel should stay existant until the mod runs !watch close.

Possible, major issue

Thanks to discord being rather weird, hidden channel names are still visible to the API as well as the audit-log. This would mean that anyone using a customized client could see the hidden channels, which would in many cases cause people to behave very differently and is also likely to cause regular discussions and complaints by community members.

Possible solutions

  • Channel names that don't show the name of the watched user. This would only partially fix the issue, as people would likely be able to guess that they are watched out of context.
  • Show the watch-logs externally, on a different server. This would work, but would be very unergonomic for the moderators, as well as be a hassle in general.

[FEATURE] Send all Hightlights in a Message

Is your feature request related to a problem? Please describe.

ATM sometimes I think a conversation might not be relevant, because only the first highlight gets sent.

Proposed feature

I would like to get a "Thing and Thing2 has been mentioned` message.

Additional context

Thank you very much Elk, much epic Rust rewrite, even if Go is clearly superior.

Outside of #bot, Autoremove bot error messages after a few seconds

by elkowar: unixporn/trup#57

when you mistype a command, in many cases the bot prints the usage string. This response should get automatically removed after some time (~10 seconds).
This could also be done for "Success" style responses.
For this, there should probably be a new function SendAutoremove (or something like that) created in command.go, which resembles Reply, just that it automatically removes the message after a given amount of time.

Case insensitive editors

0. nvim (93, 30.00%)
1. vim (53, 17.10%)
2. nano (26, 8.39%)
3. neovim (19, 6.13%)
4. micro (8, 2.58%)
5. emacs (7, 2.26%)
6. Vim (7, 2.26%)
7. kakoune (5, 1.61%)
8. NeoVim (5, 1.61%)
9. Emacs (5, 1.61%)

vim and Vim should be considered the same, as well as neovim/NeoVim.

Make trup detect and read message.txts and write them out

by elkowar: unixporn/trup#168

Trup could autodetect message.txt files and as long as they're below a reasonable threshold (5000 characters? idk) write them out, split up into several messages.
Alternatively, this could be a command (!long or something, ran in the message that also sends the message.txt).


6gk:

very bad idea. sounds extremely spammy and abuse-prone.
a better solution could be to reupload to another service with a web interface (0x0.st, hastebin, pastebin, etc) & give a short preview, but even then it could be abused, at least it's not spammy though.


elkowar:

i mean, uploading to a separate service sounds like a good compromise, yea,...
if you set a line-limit (specifically lines + a char limit still), it couldn't be alllll that spammy
although I was informed that there are also betterdiscord plugins that show message.txt's, so maybe that's,..... a good enough workaround for me at least

Block some commands outside of #bot OR Make trup react #bot in case command is not used in #bot

block some commands outside of #bot

by 6gk: unixporn/trup#131

Of course this should ignore moderators & the moderator category.

Commands like

  • role
  • info
  • desc
  • setfetch
  • help

Don't really have a place outside of #bot.


Make trup react #bot in case command is not used in #bot

by Pan00Pernicek: unixporn/trup#148

Screenshot_20210129_113430
just like this, it can be good idea to tell people to go to #bot instead with this reaction

Editor's note: discord uses :hash: for #, and the rest are regional indicators. Can be used to reduce spam.

The bot-messages channel is hard to search

by 6gk: unixporn/trup#147

(bug with discord)

Example:

  1. Search in:bot-messages <user-id> message deletion
  2. Search in:bot-messages message deletion showcase
  3. Search in:bot-messages <user-id>
  4. Search in:bot-messages <user-id> <content-of-message>

Expected behavior:

  1. should show deletions by user-id.
  2. should show deletions in showcase.
  3. shows deleted & edited messages by user-id.
  4. shows deleted & edited messages by user-id including content-of-message

Actual behavior:

  1. doesn't work
  2. doesn't work
  3. works
  4. doesn't work

[01:00] mlvzk | it stops tokenizing after it hits a number
[01:00] mlvzk | for some reason
 [...]
[01:02] gk    | Tokenizing? :blobthinkingglare:
[01:02] mlvzk | basically splitting words
[01:03] mlvzk | search engines have indexes in a format like ["basic", "split", "word"]
[01:04] gk    | So basically snowflakes are broken in search?
[01:05] mlvzk | test 1231231231231 test101
[01:05] mlvzk | test Channel 458219829678047232 test101
 [...]
[01:08] mlvzk | P 1:
              | test1 test2 test3
              |
              |
              | P 2
              | test4 test5 test6
[01:09] mlvzk | discord finds this when i search "test3 test4" but doesn't when i search "test4 test3"
[01:09] gk    | What about test3 test2
 [...]
[01:26] mlvzk | Tokens: Edit, ghjcftvy, Channel 712091775086362676, Author 458219829678047232
[01:28] mlvzk | works:   ghjcftvy channel 458219829678047232
              | doesn't: ghjcftvy 458219829678047232
[01:28] mlvzk | yea im not implementing this for now
[01:28] mlvzk | it's buggy

[FEATURE] Automatically sort emotes based on usage, to avoid popular ones getting axed when boost level falls

Is your feature request related to a problem? Please describe.

The problem being that some emotes, even though they are newer are infinitely more popular. So when boost level drops, a really popular emote could be axed.

Proposed feature

Given how we already have our top guys working on #16 , this new feature could be implemented to re-arrange the emotes, which is an absolute pain to do manually.

Additional context

Well, some admins/mods might want to vouch for a few emotes they personally want. It's up to them to decide if they want to give possibilities of "immutability" to certain emotes. Those emotes would not be sorted based on their popularity.

[FEATURE] Store !fetch images on disk

Is your feature request related to a problem? Please describe.

Sometimes Discord breaks attachment URLs and bot can't show it in !fetch anymore.

Proposed feature

Store !fetch images on disk.

[FEATURE] project system

Add a system to the bot where a project owner can “announce” updates to their project and it will dm or ping all of the members who have subscribed to that project.

[FEATURE] Make tags case-insensitive

Proposed feature

Make tags case-insensitive.
!settag A something and !settag a something would set the same tag.
!tag a and !tag A would reply with the same tag.

Allow seeing who else uses a certain distro, wm, etc.

This has been bugging me that robbb does not have this feature (not to be rude, though. What I mean by "Allow seeing who uses [insert distro/wm/etc.]" is you run (as an example !top DE/WM berry, it shows the amount of people using it, the percentage using it, and the people using it.

Mute should track if the muter was a mod or a helper

Helpers are allowed to mute. Currently, it's not clearly visible if the person is a moderator or a helper, which may be relevant when looking at a users cases afterwards. Thus, this should be tracked explicitly.

Track emote usage

This will make it easier to decide what emotes to yeet when the time comes.

Reactions should be a separate counter (but still have a way to show combined usage), and the counter should go up by 1 for each message, so 9 people reacting to a single message with it will be the same as 1 person reacting to the message.

[FEATURE] Highlights context

Is your feature request related to a problem? Please describe.

Currently Robbb's highlights don't provide context for the conversation which makes highlights harder to sort through. Example, if someone mention mander in passing, or while I am in the conversation, I don't really care for the highlight, but if someone is mentioning it in an interesting context, i care more.

Proposed feature

Context added to highlights, something like this:

image

This way I can see if this is important to me or not without having to actually jump to the highlight. This is even more useful when a word is highlighted rather than a name. For example, if I mention eww as in, eww that is disgusting and it triggers for people, they won't be as interested as if i were to actually talk about eww.

Additional context

Just an extra hug 🤗 you are all lovely.

Editing & Undoing for warns and notes

by elkowar: unixporn/trup#58

The warn and note commands should have a !note undo / !warn undo command to remove the latest warn / note.

lidl:

Instead of !note undo I think it would be better to do !note undo <note_id>. For this we would need !note to show notes together with their IDs, but the IDs are pretty long so we should just show the last 3 or 4 characters and use that in !note undo <note_id>

add synonyms to !top [Distro OR Editor OR ...]

by mlvzk: unixporn/trup#150

Like:

nvim => neovim
arch => Arch Linux

So that results in !top Editor don't have duplicate entries (1. nvim, 4. neovim should be joined into one)
image

Concept query:

WITH x AS (
    SELECT
        info ->> 'Editor' AS value,
        REPLACE(LOWER(info ->> 'Editor'), 'neovim', 'nvim') AS normalized
    FROM
        sysinfo
    WHERE
        info ->> 'Editor' != ''
),
y AS (
    SELECT DISTINCT ON (normalized)
        value,
        count(*) OVER (PARTITION BY normalized)
    FROM x ORDER BY normalized,
    count DESC
)
SELECT
    *
FROM
    y
ORDER BY
    count DESC
LIMIT 5
 value  | count
--------+-------
 Neovim |    96
 vim    |    55
 nano   |    24
 Emacs  |    10
 micro  |     8
(5 rows)

Add a license

This project should get a license, discuss what you think it should be.

I personally like MIT, but some people on discord seem to be against something that permissive.

Memory is shown in fetch if it's 0

With fetches that where taken over from the migration, Memory: 0 is the value that users get when they didn't provide memory. This should still not be shown in the fetch.

This should be another branch on the main repo, not another repo.

It breaks the history, removes past contributors, removes active issues (which we'll have to make again), and just completely splits the repo.

i shouldnt even have to explain why it should be the same repo, but for some reason i have to.

also since apparently this wasn't obvious enough (like literally why should i have to mention it wtf??) we'll keep the stats (age, stars, forks, etc)

Unmute people that join VC when no mod is in VC

by buffet: unixporn/trup#124

Sucks when muted people leave and then are stuck that way.


gk:

there's got to be a timeout instead (or as well)

most of the time people are muted for a reason, if the mod leaves (or even got a request to mute when they're not in it) the culprit can just disconnect and come back and be unmuted instantly

[Feature] Anonymize warns/mutes

[please apply 'maybe' & 'moderation' labels]

Please describe the issue.

Mods occasionally get singled-out for an action by a particular type of member, even if the other mods would have done the same thing, or even if there was a poll.

Proposed feature

The bot could delete the mod's !warn/!mute message and repost the reason/duration/etc.

  • if the mod pings, the user may still get a notification. (user error anyway)
  • it may still happen, albeit less often. As the mod (who might be) in chat can get blamed - even if it was another mod.
  • this may make "power abusers" less obvious, but I'd say that the other mods should be the ones handling this, and this shouldn't affect the mod-log channel.

Example:

mod [deleted by bot]: !warn 199492634438270977 bad person, basically Wu Zetian.
bot [not an embed so the ping works]: <@199492634438270977> has been warned for the 47th time: bad person, basically Wu Zetian.

(wording could of course be way better, but I'm not a linguist)


A possible alternative may be for the bot to DM warns/mutes, rather than saying publicly. I think this is a bad option, but at least worth saying.

  • This may sometimes cause less drama (onlookers not reading the full context and getting outraged because it sounds more minor than it is, bad reason, etc), but it's also less of a "hey other people, don't do this"
  • It's also rather frequent for people to disable DMs.

[BUG] !settag overwrites the old tag if using the same tag name

Expected behaviour

Robbb should not automatically overwrite, and should either reply saying the tag exists or give more options (What should we do?)

Current behaviour

Overwrites like a chad

If this is still a problem I will assign this to myself to work on

Wallpaper command

Wallpapers would be submitted like this:

!wallpaper <url>
tag1, tag2, ....

You could get a list of wallpapers filtered by tags like this:
!wallpaper tag1, tag2, ...

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.