Code Monkey home page Code Monkey logo

rubot2's Introduction

Rubot2

Build GitHub top language GitHub repo size Commands

A general Purpose Discord Bot.

Development Setup

  • Clone the Repository
  • Either use the docker compose file to start a mongodb instance or install mongodb locally
    • To use the docker compose file run docker-compose -f docker-compose.development.yml up -d
  • Setup a .env File
    • TOKEN is the Discord Bot Token. To see how to create a Discord Bot see Setup.md
    • OWNER_ID is the Discord ID of the Bot Owner. To get your Discord ID enable Developer Mode in the Discord Settings and right click on your name in the User List.
    • CLIENT_ID is the Discord ID of the Bot. To get the ID go to the Discord Developer Portal and select your application. The ID is displayed under the name of the application. Alternatively enable Developer Mode in the Discord Settings and right click on the Bot in the User List to copy the ID.
    • MONGODB_USER is the Username for the Mongodb Database. If you use the docker compose development file you can freely choose the value. If you use a local instance of mongodb you have to create a new user and give it access to the database you want to use.
    • MONGODB_PASSWORD is the Password for the Mongodb Database. If you use the docker compose development file you can freely choose the value. If you use a local instance of mongodb you have to create a new user and give it access to the database you want to use.
    • MONGODB_DBNAME is the Name of the Mongodb Database. If you use the docker compose development file you can freely choose the value. If you use a local instance of mongodb you have to create a new user and give it access to the database you want to use.
    • MONGODB_CONNECTION_URL is the Connection String for the Mongodb Database. The connection string should look like this: mongodb://<user>:<password>@<host>:<port>/<database>?authSource=admin make sure to replace the values with the ones you chose above, host and port should be localhost or 127.0.0.1 and 27017 respectively.
  • Install the Dependencies with npm install
  • Run npm start to compile and run the Bot in development mode

Setup for manual Testing

See Setup.md.

Setup pre-commit hook

install the python package pre-commit (e.g. with pip install pre-commit or pipx install pre-commit) and run pre-commit install in the repository root directory. This will ensure the code is formatted correctly before every commit. You can also manually run it with pre-commit run -a. If you for some reason want to skip the pre-commit hook you can use git commit --no-verify (which you should never do).

Deployment

  • Run npm build once to compile to the dist directory on the target device
  • Start the index.js in the dist directory

rubot2's People

Contributors

alphakevin01 avatar dependabot[bot] avatar niklhut avatar rdeisenroth avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

nilspur niklhut

rubot2's Issues

Print information about next student

Ich finde wir brauchen ein wichtiges Feature für Sprechi: Wenn wir per /tutor queue next einen neuen Raum öffnen, zu dem ein Studi Zugang hat, sollte Sprechi in seiner Nachricht an den Tutor auch sagen, wie dieser Studi heißt. Gestern hab ich einen neuen Studi per Befehl abarbeiten wollen, wobei dieser nicht ankam. Ich hätte ja eine Nachricht schreiben können, falls ich zuerst /tutor queue list verwendet hätte, aber nachdem ich schon den Raum geöffnet habe, konnte ich nicht mehr rausfinden, welcher Studi fehlt

User-friendly server setup

The current setup reqires reading the documentation and is not very intuitive. We should provide a welcome Promt that guides you through the most important settings.

Queues for different languages/topics/...

Add option for multiple queues. For example, multiple queues can be used for different languages. Tutors can decide from which queue they accept a student when using tutor queue next.

Improve queue join messages

This is where the interpolation options for the queue join messages are currently defined:

Rubot2/src/models/queues.ts

Lines 204 to 241 in b06fd7b

public interpolateQueueString(this: DocumentType<Queue>, string: string, entry_resolvable?: string | QueueEntry | undefined): string | null {
try {
const replacements: StringReplacements = {
"limit": this.limit,
"name": this.name,
"description": this.description,
"eta": "null",
"timeout": (this.disconnect_timeout ?? 0) / 1000,
"total": this.entries.length,
};
if (entry_resolvable) {
let entry: QueueEntry | null;
if (typeof entry_resolvable === "string") {
entry = this.getEntry(entry_resolvable);
} else {
entry = entry_resolvable;
}
if (entry && this.contains(entry.discord_id)) {
const entryReplacements: StringReplacements = {
"member_id": entry.discord_id,
"user": `<@${entry.discord_id}>`,
"pos": this.getPosition(entry.discord_id) + 1,
"time_spent": (moment.duration(Date.now() - (+entry.joinedAt)) as unknown as { format: (arg0: string) => string; })
.format("d[d ]h[h ]m[m ]s.S[s]"),
};
for (const [key, value] of Object.entries(entryReplacements)) {
replacements[key] = value;
}
}
}
// Interpolate String
return utils.general.interpolateString(string, replacements);
} catch (error) {
console.log(error);
return null;
}
}

As you can see, we are missing interpolation options for active_coaches, closing_time and possibly more. Also it is currently not possible to set the message with just commands. You have to manually edit the db.

Furthermore, we should use QueueModel.interpolateQueueString() here
https://github.com/Rdeisenroth/Rubot2/blob/b06fd7b825cc63053bd5556ee48f7117c7737489/src/events/VoiceStateUpdateEvent.ts#L98-L108C23

Actually the entire file could use some refactoring...

add "do not ping Orga" feature

We should add a feature that reminds students not to ping the FOP-Orga directly. This would also needs a Role-Bypass for Tutors and Staff.

Notifications for Tutors

Send a notification (e.g., in the form of a private message from Sprechi) when a student joins a queue.

Add config option to create auto updating message with current queue members

Should be possible to create with something like /config queue create_public_list. The message should auto update as soon as someone joins or leaves the queue as well as when a person is taken care of by a tutor.

This means the created message should always be up to date with the current queue status. Similar to a /admin queue list message, which does not auto update.

Additionally it should only be able to create one such message per guild.

Session quit message should not be ephemeral

Session quit message should not be ephemeral so you can see how many students you tutored even after closing discord.
This is helpful if you want to fill out the Moodle form about the number of students you tutored but you forgot to do so directly after the Sprechstunde

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.