Giter Site home page Giter Site logo

carberra / carberretta Goto Github PK

View Code? Open in Web Editor NEW
17.0 5.0 14.0 372 KB

A Discord bot designed for the Carberra Discord server.

Home Page: https://discord.carberra.xyz

License: BSD 3-Clause "New" or "Revised" License

Dockerfile 0.35% Python 99.65%
discord bot python carberra hikari

carberretta's Introduction

Carberretta

This branch is for the v2 release of Carberretta.

You will need Python 3.10 or higher to run Carberretta.

Running the bot

Installing dependencies

# To run the bot:
pip install -r requirements.txt
python -m carberretta

Use CTRL+C to shut the bot down.

Contributing

Currently, only ports of cogs from v1 are being accepted.

Setting up

pip install -r requirements-dev.txt

The environment file you need is provided as .env.example. Rename this file to .env, then paste your token into the correct field.

Checks

  • Run nox to run various checks to make sure everything is okay. If all pipelines pass, push the changes up. If not, you'll need to make changes until they all pass.
  • If you're unsure how to make a test pass, push the changes, and ask another contributor for help.
  • If the safety check fails, raise a separate issue.

Porting v1 cogs

When porting a cog OPEN A DRAFT PR ONCE YOU'VE MADE YOUR FIRST COMMIT. This lets me and others know that cog is already being ported. If you're unsure which cogs have been ported (or are already being ported), check the pull requests with the type/port label. Make sure to check both open AND closed PRs.

The list of cogs that are NOT to be ported:

  • hub
  • links
  • poll
  • role
  • role2
  • support

This is because the planned reimplementation of the cog is too different from the original, or because the cog is being removed entirely.

If you want to port the misc cog, it should be renamed text. The meta cog is part complete -- feel free to finish it, or have a look at the file for pointers (specifically the /ping, /about and /stats commands).

Using the database

If you need to create a new table for the database, follow the naming convention set out in the data/static/build.sql file.

The database utility is now very different. Examples below:

# Inserting data (from plugin)
await plugin.bot.d.db.execute("INSERT INTO ... VALUES ...", ...)

# Selecting data (from plugin)
row = await plugin.bot.d.db.try_fetch_record("SELECT user_id, points FROM experience WHERE user_id = ?", ...)
print(row.user_id)
print(row.points)

Datetime objects are automatically converted both ways, so fetching a field with a time in it will return a datetime object, and passing a datetime object to execute will insert a string timestamp.

import datetime as dt

expires = await plugin.bot.d.db.try_fetch_field("SELECT expires FROM warnings WHERE user_id = ?")
isinstance(expires, dt.datetime) == True

Note that any method prefixed with try_ could return None.

carberretta's People

Contributors

aoi-yuito avatar coler6 avatar ikbenolie5 avatar johanohly avatar jonxslays avatar mrdogebro avatar mshaugh avatar nereg avatar parafoxia avatar tandemdude avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

carberretta's Issues

A support case history

Store all the messages used to open recent support cases (maybe the most recent 10 or 20) and link the reopen command to use that list instead of manually searching for messages.

  • Could then include a recap on case reopen
  • When reopening a specific member's case, it could reopen the case in the original channel if possible
  • Perhaps could be used to drag channels out of unavailable to continue the case if need be

This would also fix certain issues:

  • Open cases made while rebooting would always have all the required info (pertaining to level of persistence)
  • Reopening while specifying a member would also work better

Implement a lock on support channels

Perhaps have a +lock command which closes the current support case (like +close), but on top of that:

  • Automatically moves the channel to unavailable, regardless of any other factors
  • Locks the previous client out of the support channels for a certain time (maybe an hour or something)

Feel free to leave ๐Ÿ‘ and ๐Ÿ‘Ž reactions to indicate whether this is a good idea or not.

Add some automatic guideline enforcement

This will mainly centre on pings (the bits that #48 doesn't already cover). This will be fed into the new warning system when done, but that will probably be created as a separate issue

The open command is causing confusion

Some people have though it's the way to open a support case, when it actually reopens a previous one.

  • Remove the open command invokation and just call it reopen.

A system to auto-assign helper roles based on topic

This would be in two stages:

  1. A real-time system that looks at patterns and works out appropriate roles based on where the helper was active.
  2. A command, in which a member is granted Helper (and Staff), and the cases they previously helped in are analysed, and roles are provided based on that.

Modmail

Modmail

Features

  • Member DMs the bot, and messages are relayed to #moderator-chat
  • Some validation required

Support channels can "die"

Cause believed to be a lack of handling for unavailable channels on boot, causing them to not be properly initialised.

Logging

Logging

Features

  • Member nickname changes
    • Old nickname
    • New nickname
  • Member role additions and removals
    • Role that was added/removed
    • Perhaps the total number of roles
  • User avatar changes
    • Old avatar (as thumbnail)
    • New avatar (as image)
  • Message edits
    • Author
    • Old content
    • New content
    • Include attachments, media, etc.
  • Message deletions
    • Author
    • Content
    • Deleted by (via audit log)
    • Include attachments, media, etc.

Support timestamp timezone

Timestamps posted as a result of the redirect command do not display the
timezone.

Solution:
Append Z to the timestamp ร  la ISO 8601.

Session Support

Session Support

Features

  • All channels start in available pool
  • Channels move to in use when in use
    • Triggered by a message in an available channel
  • Channels marked as available after command, or after period of inactivity
    • Considerations:
      • Should inactivity only kick if all channels are in use?
  • Create new channels as demand requires
    • Considerations:
      • Scale to guild members?
      • Scale to helpers?
      • Maximum limit of support channels
      • Create new channels if all in use, within limit?

Commands

  • done: moves channel back into the available pool
    • Only usable in "in use" channels
  • call: calls for help
    • Only usable in "in use" channels
  • lock: locks a channel down to select members/roles
    • Remains locked until explicitly unlocked or channel times out
    • Only usable in "in use" channels
  • unlock: unlocks a channel
    • Only usable in "locked" channels
  • save: saves previously sent messages
  • recall: recalls a saved message

Limit certain commands to certain channels

Certain commands should only work in specific channels.

  • Default as bot usage channels only.
  • Support commands only in support channels.
  • Mod commands everywhere, though Solaris covers most of that.
  • Owner commands in restricted channels?

Spam Filter

Spam Filter

Features

  • Prevent mention spam
  • See tutorials for reference implementation

Giveaway System

Giveaway System

Features

  • One reaction, which members use to enter
  • At the end, valid member is chosen at random
  • Automatically announce the winner
  • Role-based weighting as an option

Restructure and Formalisation

This will include proper information regarding the bot, including a set of instructions for contributing to Carberretta.

Remove the message from Cache after Poll has finished

When you make a Poll, the message ID gets stored in a Cache, that's so the reaction manager/counter works etc. When the poll ends tho, the message doesn't get removed, it doesn't break anything but the reaction manager still manages polls that are finished. Plus the cache gets bigger over time then. So really just remove the message from the Cache when the poll finished.

A tag system

  • Create tags using tag create
  • Edit tags using tag edit
  • View a tag's raw content using tag raw
  • The ability to import tags from R. Danny
  • The ability to set tag aliases
  • The ability to set multiple owners for a tag?
  • The ability for server administrators to delete tags?

Add support for files in the binify command

A number of people send txt files of code and errors, so having the binify command read the file and convert it to a bin would be super useful.

  • Would just take a message ID and load an attachment from that.

Prevent timed out cases from being moved to unavailable

Timed out cases currently don't get treated differently to closed cases, which has proved rather an issue.

  • Indicate to the close routines whether a case timed out or was closed
  • Move to available if timed out
  • Otherwise use same check to determine destination
  • Perhaps implement some other logic to make sure the channel numbers remain consistent

Support case analytics

On top of fixing other problems, the planned solution allowed for basic support case analytics to be tracked, such as who opened the case, when it was closed, and who was involved.

Meta Bridge

Meta Bridge

Features

  • Messages verified by staff to be bridged
  • Bridge discord #feedback
  • Bridge discord #video-requests

Poll System

Poll System

Features

  • Polls should be stored in case of bot shutdown
  • End time should be shown
  • Automatic result announcement
  • Duplicate votes should be removed, unless explicitly allowed

Profanity Filter

Profanity Filter

Features

  • Filter profanity
  • Ability to adjust strictness
  • See tutorials for possible implementation

Add timed closes for cases

Add the ability for a helper or mod to be able to add a close timer to a support case. This is similar to the timeout feature but it would allow the case to actually close instead of timing out. If the user responded after setting the close timer it would stop the timer and not close the case, else it would be closed after the set amount of time.

The ability to do this would allow a helper to not have to close a case immediately while still being able to go help another case without having to remember to come back and close this case in x mins. This is not a necessity but would be a nice feature to have when helping people out in support cases.

Example

  • I give a user a solution that should work but want to give them time to ask more questions if they need or it doesn't seem to work. The timed close would allow the helper to say close the case in 10 mins if the person who opened the case does not respond. This allows the helper to know that the case will be fully closed because in 10 mins (or however long the helper sets) they would have responded if they had any issues but they did not, meaning the case can be closed as it is deemed solved.

Features

  • Add ability for helper to close case in x mins
  • Allow client to respond to stop timer
  • Make notification in chat that timer has been stopped and case re-opened (or something like that)
  • Ping helper who time closed case if client responds (possibly โ€” maybe in same message as above)

Implement call command

This command would implement a ratelimit on pinging helper roles on a member by member basis by forcing clients to use Carberretta's interface to do it.

Opt System

Opt System

Features

  • Opt in or out of certain roles
  • Start with Videos and Announcements

Commands

  • TBD

A binify command

  • Scan messages for code blocks and convert them to MystBin links (like the redirect command).
  • Take attachments and attempt to do the same (check if it's a text format).

Colour Reactions

Colour Reactions

Features

  • Similar to how it has been done in the tutorials, by perhaps utilising the database
  • More colours
  • Reaction removed as soon as colour is applied to keep it clean and quick

Implement RTFM to replace R.Danny

R.Danny is not verified, which means it will be limited to a single shard, which can cause the bot to stop working in the tutorials guild.

A replacement will be required, along with the other functionality of the bot such as Tags and Starboard

A system to bind a member bot to its owner

  • Probably +bind or +bindbot.
  • Carberretta would update the bot nickname based on nickname changes of it's owner (and hopefully a username change in the bot)
  • Carberretta would kick a bot if its owner left
  • Would provide a simpler interface to determine bot owner info. Maybe +memberbotinfo or something (probably shorter than that)

Experience System

Experience System

Features

  • Exponential levelling sytem
  • Commands to opt out of level up messages

Starboard

Starboard

Features

  • One star sends the message to the starboard
  • Messages on the board have up/down vote reactions
  • Messages with a poor ratio will be removed

Update help command

Now Carberretta has the Solaris menuing system, it can take on the Solaris help system too.

Reintroduce support voice channels

This would be done more dynamically than before:

  • A participant in an occupied channel would use a command to create a new support voice channel.
  • This channel would be deleted once the case was closed.

User-Lookouts

Add a command to add a person to a user-lookouts database. This database would most likely include their username (of course) and the reason as to why they should be looked out for. Each time a person joins the server, the bot will look to see if they are on the lookouts list and a notification message will be sent to one of the moderator channels. Also add a command to check the entire server's members against the database to see if someone who is already joined is on the list. Of course add support to remove users from the list, however, I do not think this list should be open to the public like the warns system. A person should not be able to see if they are on the lookout list and nothing special will happen to a person who joins if they are on the list.

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.