GithubHelp home page GithubHelp logo

louisdelatech's Introduction

LouisDeLaTech is a discord bot manager for Lyon e-Sport

PyPI PyPI versions Python test Code Style

Requirements

  • Python with Poetry

Setup

Discord

Create a discord bot and get the token

Google

You must create user custom attribute

"custom": {
 "pseudo": "",
 "discordId": "",
 "teeShirt": "",
 "birthdate": ""
}

Hello asso

Documentation

Custom fields

{
    "name": "Pseudonyme",
    "type": "TextInput",
},
{
    "name": "Date de naissance",
    "type": "Date",
},
{
    "name": "Adresse postale",
    "type": "TextInput",
},
{
    "name": "Numéro de téléphone",
    "type": "TextInput",
},
{
    "name": "Nom d'utilisateur Discord",
    "type": "TextInput",
},
{
    "name": "Taille du tee-shirt",
    "type": "ChoiceList",
},
{
    "name": "Je m'engage à signer l'engagement de confidentialité : https://example.fr",
    "type": "YesNo",
}

Install

pip install les_louisdelatech

Configure

Generate a secret_key to encrypt database secrets

>>> from cryptography.fernet import Fernet
>>> Fernet.generate_key()

Fill config.toml with config.example

Run

python3 -m les_louisdelatech.main -c config.toml -g google.json

Dev

Install Poetry

poetry install
poetry shell

Run ruff

poetry run ruff format --check . 
poetry run ruff check .

Licence

The code is under CeCILL license.

You can find all details here: https://cecill.info/licences/Licence_CeCILL_V2.1-en.html

Credits

Copyright © Lyon e-Sport, 2021

Contributor(s):

louisdelatech's People

Contributors

m0nsterrr avatar dependabot[bot] avatar egguy avatar emma0z avatar drumslayers avatar

Watchers

James Cloos avatar Etienne avatar Kostas Georgiou avatar  avatar

Forkers

egguy

louisdelatech's Issues

Add new group member "Conseil d'Administration"

Please add "Conseil d'administration" as a new option into group for "CA" members only.
Discord group : Membres du CA

Also, please considerate some users are into "Conseil d'Administration" but also into a team.
eq : Vincent SERELLE (Equipe Technique, Membres du CA, Responsable Technique)

Command to reset password

A new temporary password will be generated and sended to user in PM

  • If user has this discord account linked properly with google he can ask for a password reset
  • Admin can reset password

Discord API timeout when issuing provision as slash command

Version: 0.3.1

Following to Discord API documentation, Interaction tokens are valid for 15 minutes and can be used to send followup messages but you must send an initial response within 3 seconds of receiving the event. If the 3 second deadline is exceeded, the token will be invalidated.

Discord API is issuing a "404 not Found: Unknown interaction", because the provision function is lasting longer than 3 seconds.

This can be fixed with Discord.py by using interaction.response.defer() function to issue the initial response (making the "thinking" GUI element appearing), then send the final message response with Interaction.followup.send()

bot logs:

2023-05-18 21:00:26,930 DEBUG:URL being requested: GET https://admin.googleapis.com/admin/directory/v1/users?query=custom.discordId%[redacted]&customer=my_customer&projection=full&viewType=admin_view&alt=json
2023-05-18 21:00:26,931 DEBUG:Making request: POST https://oauth2.googleapis.com/token
{'kind': 'admin#directory#user', 'id': '[redacted] [...]
2023-05-18 21:00:27,779 DEBUG:URL being requested: POST https://admin.googleapis.com/admin/directory/v1/users?alt=json
2023-05-18 21:00:27,780 DEBUG:Making request: POST https://oauth2.googleapis.com/token
2023-05-18 21:00:28,663 DEBUG:URL being requested: POST https://admin.googleapis.com/admin/directory/v1/groups/technique%40lyon-esport.fr/members?alt=json
2023-05-18 21:00:35,009 DEBUG:URL being requested: PUT https://gmail.googleapis.com/gmail/v1/users/drum.test2%40lyon-esport.fr/settings/sendAs/drum.test2%40lyon-esport.fr?alt=json
2023-05-18 21:00:35,010 DEBUG:Making request: POST https://oauth2.googleapis.com/token
2023-05-18 21:00:35 ERROR    discord.client Ignoring exception in on_command_error
Traceback (most recent call last):
  File "/home/drumslayer/.cache/pypoetry/virtualenvs/les-louisdelatech-Dg2cTfTc-py3.11/lib/python3.11/site-packages/discord/client.py", line 441, in _run_event
    await coro(*args, **kwargs)
  File "/home/drumslayer/git/lyon-esport/louisdelatech/les_louisdelatech/bot.py", line 90, in on_command_error
    await ctx.send(f"Error while executing command => {error.__cause__}")
  File "/home/drumslayer/.cache/pypoetry/virtualenvs/les-louisdelatech-Dg2cTfTc-py3.11/lib/python3.11/site-packages/discord/ext/commands/context.py", line 884, in send
    await self.interaction.response.send_message(**kwargs)
  File "/home/drumslayer/.cache/pypoetry/virtualenvs/les-louisdelatech-Dg2cTfTc-py3.11/lib/python3.11/site-packages/discord/interactions.py", line 778, in send_message
    await adapter.create_interaction_response(
  File "/home/drumslayer/.cache/pypoetry/virtualenvs/les-louisdelatech-Dg2cTfTc-py3.11/lib/python3.11/site-packages/discord/webhook/async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
2023-05-18 21:00:35,313 ERROR:Ignoring exception in on_command_error
Traceback (most recent call last):
  File "/home/drumslayer/.cache/pypoetry/virtualenvs/les-louisdelatech-Dg2cTfTc-py3.11/lib/python3.11/site-packages/discord/client.py", line 441, in _run_event
    await coro(*args, **kwargs)
  File "/home/drumslayer/git/lyon-esport/louisdelatech/les_louisdelatech/bot.py", line 90, in on_command_error
    await ctx.send(f"Error while executing command => {error.__cause__}")
  File "/home/drumslayer/.cache/pypoetry/virtualenvs/les-louisdelatech-Dg2cTfTc-py3.11/lib/python3.11/site-packages/discord/ext/commands/context.py", line 884, in send
    await self.interaction.response.send_message(**kwargs)
  File "/home/drumslayer/.cache/pypoetry/virtualenvs/les-louisdelatech-Dg2cTfTc-py3.11/lib/python3.11/site-packages/discord/interactions.py", line 778, in send_message
    await adapter.create_interaction_response(
  File "/home/drumslayer/.cache/pypoetry/virtualenvs/les-louisdelatech-Dg2cTfTc-py3.11/lib/python3.11/site-packages/discord/webhook/async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction

Handle vocs

  • Each team has a channel "Reunion" that will be renamed as "Créer un salon vocal"
  • In config file you must add wich channel name is managed by this feature (default = "Créer un salon vocal")
  • When someone join the channel, a new channel is created with this discord name and the user is moved in
  • If an user channel is empty delete it

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.