Coder Social home page Coder Social logo

onebot's Introduction

OneBot

An all-in-one bot for the social platform Discord

Setup

Token

To run this bot, you will need to provide it with a token to use. This can be done by creating a file called TOKEN in the root directory of the project, and putting the token in here. The bot will then read the token from that file.

Configuration

There are various commands you can use to configure the bot from your discord client. These are:

  • /purpose category
  • /purpose channel
  • /purpose role

Using these commands will assign a purpose to the specified discord object and store it in the database. The bot can use this to determine what an object is for and what it can do with it.

Database

The database file will be automatically created when you run the bot for the first time at data/db/db.sqlite3

FFMPEG

FFMPEG is needed for the music functionality of the bot.

onebot's People

Contributors

corban-lee avatar jamesparkin675 avatar falkokotva avatar

Watchers

Kostas Georgiou avatar  avatar

Forkers

falkokotva

onebot's Issues

Add Developer Commands

Maybe through it's own cog.
Commands should aim to increase productivity during development and make tasks (such as updating the live bot) easier.

Commands should include:
- [ ] an update command to automate git fetch, pull, etc.
- [ ] a restart command to reload the bot and apply new changes (should start a new process and only kill the old one if the new task doesn't fail)

PronounDB integration

Integrate pronoundb if possible, otherwise make a local database table to contain pronouns.
Commands should include:

  • A way to save your pronouns
  • A way to update your pronouns
  • A way to see your pronouns
  • A way to remove your pronouns
  • A way to see the pronouns of others

Seeing the pronouns of others should have to be cumbersome, the command should be short and there should be a context menu version of this command so that members can get the pronouns of another member in just 2 clicks.

Add tour command

Create a command to help members find certain channels around the server.

The command should list channel names followed by their descriptions.

Socials Integration

Idea: allow users to add their socials from other platforms (example: @username - instagram, @username - twitter) and allow other users to see them through /socials @member in a discord server

specs:
create a command group called "socials"

add commands "get", "set" and "remove"

"get" command:
returns all specified user's socials or just the specified social
params: discord.User, social (enum for the social site such as "instagram", "twitter", etc.)[OPTIONAL]

"set" command:
set a user's socials
params: social (enum for the social site), username (str username or id for social account)

"remove" command:
remove a user's socials
params: social (enum for the social site)

Also add a context menu command "Get Socials" which will act as an alias for "/socials get @user"

Scoreboard Description is Incorrect

"Get a scoreboard of the top 5 members by rank" is an outdated description of the command.

Update the description to "Get a scoreboard of members ordered by rank"

Togglable Level Up Message

Create a level up message sent as a reply to the message that levels up a user.

Create a database table called user_settings with columns member_id, do_lvlup_msg and refer to that when deciding to send the levelup message or not.

Create a command for users to toggle the new setting.

Create Help Commands

Command should list all command groups and their descriptions.

Add another command /help <app_command group name> (e.g., /help birthdays) to list all of the commands in that group.

Commands that are unusable to the user due to their roles should be hidden from the output.

Add automated warn for rule breakers

Requires:

  • Issue#4 to be completed first
  • Detecting rule violations
  • Assigning a 'warn' role to the user
  • Kicking the user if they break a rule with the 'warn' role

Config Overhaul

The configuration files for the bot are clunky and awkward to work with.
We are going to move all of the configuration into the database.

Rank Scoreboard

Implement a clean looking scoreboard for the rank system.

It should only show members in the guild that the command is used in.

I'd might do to have an embed, however an image like the level card would be better looking.

Allow the user to choose between the top 2-20 members when using the command.

blacklist command

Should have a database table holding member_id and reasons for blacklist

add acommand to blacklist members
command takes a member mention or member id as an argument
command adds these details to the database
command also bans the user if they are already in the server
command will auto ban if the blacklisted member joins

add a command to list blacklisted members

add a command to clear members from the blacklist

Automated Database Backups

I just accidentally deleted everyone's ranks an reset them to level one, oops.
Implement automated database backups.

Add Contribute Command

Create a discord embed object

Set the title to "Contributing to OneBot"

Set the description to "If you want to help the further development of the bot, please get in touch or visit the github repository"

add the repository url to the embed and in the embed description on a new line

Implement message content filter

Block certain messages with hateful words.

Full plans:
Create a database table for banned words that include an ID, the banned content, and the punishment (probably a mute) duration.
Using a banned word should also issue a warning to the user that said it.

Birthday Cog

Write a cog to check every 24 hours if it is someone's birthday. Use a database to hold the info and add a slash command to allow members to add their birthday to the list.

Add reaction to birthday celebration

Make the bot react with an appropriate emoji to the birthday celebration embed message. Do this so users can say happy birthday without sending a message by reacting with the same emoji.

If a custom emoji is use, make sure to have a default emoji as a fallback in case the custom one gets deleted.

Also add a footer to the birthday embed that says something like "React with :emoji: to wish happy birthday!"

Reduce Database Commits

Remove the commits after each operation, the database should only commit on autosave or on bot close event.

The connection is shared so nothing should get out os sync.

Consistent Naming Conventions

Example of the issue:

Discord users are called members everywhere in the api, however in the bot database they are 'user_id' instead of 'member_id'.

Go through the project, find and fix these inconsistencies.

Channel Fetcher Util

Add a new asynchronous function to src/utils.py with the name get_textchannel

It should take an integer id as the only argument
The return type will be either discord.TextChannel or None

The function should try to get the channel from the cache, if that fails then it should make an API request to get the channel.
Then return the retrieved object (which will be either TextChannel or None)

Once this is done, replace all of the older cache and api calls for channels with this new func.

Side note:
It would be fantastic to create a command like this for ALL discord objects if possible, so give that a go while you're at it.

Improve XP Advancement System

The exp gained should be connected to the length of the message being sent. Do this and add a cool down so people can't spam really long messages.

Make code compatible with Test Bot

A test bot has been setup in another server to test changes in the code before rolling out to the main server. We need to make the code compatible with the other bot Token and other server.

Currently the bot fails when fed the test bot token, so this issue is to be investigate and sorted out ASAP.

Permission Validation on Startup

Check with each guild that the necessary permissions are granted to perform what the bot must do.

  • Investigate the bot's required permissions
  • Implement validation

Convert Music Cog to slash commands

So that users can use /command name instead of the bot prefix !command name

App commands make everything easier for the developer and end-user so we should convert the commands over.

Move database setup to main.py

The database setup process being controlled by a different file is bad design and is begging for problems. Move the database setup code into the main.py file or call the setup function from the main.py file.

Add timestamp to tickets embed and db table

When reopening a ticket it's impossible to tell how old it is.

Knowing when a ticket was opened could be really helpful to determine if an issue still needs to be sorted or not.

Add a column to the tickets database table "timestamp" to store a unix timestamp as an integer

Set the ticket embed timestamp to match the timestamp of the ticket

welcome cog: on_member_remove exception (AttributeError: 'Object' object has no attribute 'icon')

Traceback (most recent call last):
File "C:\Users\c.jones\Documents\EMA\Projects\Derby-College-Bot\venv\lib\site-packages\discord\client.py", line 409, in _run_event
await coro(*args, **kwargs)
File "C:\Users\c.jones\Documents\EMA\Projects\Derby-College-Bot\src\cogs\welcome.py", line 40, in on_member_remove
embed = await self.get_remove_embed(member)
File "C:\Users\c.jones\Documents\EMA\Projects\Derby-College-Bot\src\cogs\welcome.py", line 141, in get_remove_embed
icon_url = self.bot.main_guild.icon.url
AttributeError: 'Object' object has no attribute 'icon'

Role Purpose Help Commands

Role purposes are incredibly confusing.
Let's fix that.

  • Write documentation in the form of help commands for setting up channel/role purposes
  • Send an embed on joining a guild informing them of purposes and help commands for them

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.