Coder Social home page Coder Social logo

chr1s70ph / etit-master Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 2.0 2.32 MB

🤖 A Discord-Bot, written in Typescript to aid a personal Discord server

Home Page: https://cbluem.de

License: MIT License

TypeScript 99.94% Shell 0.06%
bot discord discord-bot discord-js typescript

etit-master's Introduction

etit-master's People

Contributors

chr1s70ph avatar dependabot[bot] avatar leokraft avatar titra29 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

titra29 f0ld

etit-master's Issues

Fix slashCommands

client.ws.on('INTERACTION_CREATE', async (interaction: Interaction) => {
if (!interaction.isCommand()) return

- client.ws.on('INTERACTION_CREATE', async (interaction: Interaction) => { 
+ client.on('interactionCreate', async (interaction: Interaction) => {

Change to event, otherwise interaction.isCommand() won't work.

Add equivalent to `say`, but for admins and moderators

Similar functionality as say

import { MessageEmbed, Message } from 'discord.js'
import { DiscordClient } from '../../types/customTypes'
exports.name = 'say'
exports.description = 'Der Bot sagt, was man ihm sagt, dass er sagen soll, weil er dir nach sagt.'
exports.usage = 'say <messageContent>'
exports.run = (client: DiscordClient, message: Message) => {
/**
* Check if user has the correct rights to execute the command.
*/
if (!Object.values(client.config.ids.acceptedAdmins).includes(message.author.id)) {
return client.reply(message, { content: 'You do not have the permissions to perform that command.' })
}
/**
* Embed to send back.
*/
const embed = createEmbed(message, client)
/**
* Send reply based on message type.
*/
return message.type === 'REPLY'
? client.reply(message, { embeds: [embed] })
: client.send(message, { embeds: [embed] })
}
/**
*
* @param {Message} message command Message
* @param {DiscordClient} client Bot-Client
* @returns {MessageEmbed} embed with given message.content
*/
function createEmbed(message: Message<boolean>, client: DiscordClient): MessageEmbed {
const messageContent = message.content.substring(message.content.indexOf(' ') + client.config.prefix.length)
const embed = new MessageEmbed()
.setDescription(messageContent === `${client.config.prefix}say` ? '᲼' : messageContent)
.setColor('RANDOM')
const messageAttachment = message.attachments.size > 0 ? message.attachments.first().url : null
embed.setImage(messageAttachment)

But with less power, and also show who sent the message.

As requested by @david-liebscher in #74 (comment)

Exams command

Slash command to get a personalized list of upcoming exams

JS/TS-Docs

Document each function using JS/TS-Docs

New Picture

Something more in line with the new Servericon:

logo_withText_fixed_centered

itzFlubby's Vorschlag

Uhrzeit bei /klausur fixen + Einträge in chronologischer Reihenfolge + tages-counter

Fix zoomlinks

Describe the bug
Zoomlinks may still contain id parameter, which prevents links from working as intended

To Reproduce
Steps to reproduce the behavior:

  1. Run icalReader.ts

Expected behavior
Zoomlink opens meeting

David Liebscher's Vorschlag

!index create (erstellt ein Leeres Inhaltsverzeichnis und pinnt es an) und !index add [NachrichtenID] für ein Inhaltsverzeichnis so wie Leo es in <#883095979748904980> gemacht hat

Use newly added interaction.locale

Locale value has been added yesterday to interactions. No need to use roles anymore as previously done in

public getLanguage(message?: DiscordMessage, interaction?: Interaction): string {
/**
* Object of {@link DiscordUser}
*/
const user = message ? message.author : (interaction.user as DiscordUser)
/**
* List of all defined languages in './locales/'.
*/
const files = readdirSync('./locales/')
/**
* Loop through all languages.
*/
for (const file of files) {
/**
* Remove '.json' filetype from file name
*/
const language = file.split('.')[0]
/**
* Return language if match is found.
*/
if (message) {
if (message.member?.roles?.cache.some(role => role.name === language)) {
return (user.language = language)
}
} else if (interaction) {
const userRoles = interaction.member.roles as GuildMemberRoleManager
if (userRoles.cache.some(role => role.name === language)) {
return (user.language = language)
}
}
}
.

Add permissions to slashcomamnds

Slash commands have their own permissions. Allowing some commands to only certain users/roles might become crucial. Implementing an elegant way of defining permission will be needed in the future.

Debug/Warn events

Investigate those 2 events
Found on the official discord.js discord server
• Discord.js: attach the following two listeners to your Client instance (outside of any other listener scopes)

client.on('debug', console.log)
      .on('warn', console.log)

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.