Coder Social home page Coder Social logo

calinou / datcord_bot Goto Github PK

View Code? Open in Web Editor NEW
15.0 7.0 13.0 247.45 MB

Weirdly specific Discord bot with role assigning and lots of memery (used on the Godot Discord server)

Home Page: https://godotengine.org/community

License: MIT License

Python 100.00%
discord discord-bot

datcord_bot's Introduction

Godot Engine Discord server bot

This repository contains the source code for the Godot Engine Discord bot.

Commands

Command Description
!assign [role] Assigns yourself to one of the available roles.
!meme [author] Returns a meme (only usable in the #bot_cmd channel).
!roles Lists available roles.
!ross Returns a Bob Ross quote.
!unassign [role] Unassigns yourself from a role.
!unassign [role] Unassigns yourself from a role.

There are also some commands which print a URL or fixed message for convenience's sake:

Command What it prints
!api The URL to the Godot class reference.
!class [class] The URL to the specified class in the Godot class reference.
!csharp The URL to GodotSharp, a C# community resource.
!game An image telling you to work on your game.
!gdquest The URL to GDquest's YouTube channel.
!kcc The URL to KidsCanCode's YouTube channel.
!mirror The URL to Calinou's download mirror.
!nightly The URL to Calinou's nightly builds.
!patterns The URL to the Game Programming Patterns book.
!pronounce A sentence about how "Godot" should be pronounced.
!step The URL to the official step-by-step tutorial.
!tut The URL to the list of tutorials in the documentation.
!code Brief instructions for embedding code snippets in Discord.

Installation

Prerequisites

  • Python 3.6 (Python 3.7 or later aren't supported yet).
  • Poetry for installing dependencies.

Running

  • Clone this repository or download a ZIP archive.
  • Run poetry install while in the repository's directory to install dependencies.
  • Set the DISCORD_BOT_TOKEN environment variable to the bot's Discord token.
  • Run the script with python3 main.py.

License

Copyright © 2016-2020 Godot Engine contributors

  • Unless otherwise specified, files in this repository are licensed under the MIT license; see LICENSE.md for more information.
  • icon.svg is based on godotengine/godot/icon.svg and is licensed under CC BY 3.0 Unported; see LOGO_LICENSE.md for more information.
  • Files in the gdmeme/ directory are not licensed under the MIT license.

datcord_bot's People

Contributors

akien-mga avatar calinou avatar cptchuckles avatar duroxxigar avatar feidry avatar karroffel avatar niclaseriksen avatar shalokshalom avatar winston-yallow avatar xananax avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

datcord_bot's Issues

Make the bot count the days to Godot 4

We already have people counting every day in the #waiting4godot channel. Why not make the bot do it as well? Suggestion for image to be used: Godette running on a treadmill with icon.png dangling a carrot on a stick in front of her.

Add new commands

!build: https://bintray.com/calinou/godot/editor/_latestVersion#files

!code:


    \`\`\`swift
    func discord_highlight():
       if(using.backticks):
          "get colors"
    \`\`\`

    ```swift
    func discord_highlight():
       if(using.backticks):
          "get colors"
    ```

    \`or use inline highlighting\`
    `or use inline highlighting`

Looping over roles

I adapted a lot of your method for the rewrite branch in order to go through and add roles for preferred pronouns on my server. I retained looping through the server roles so that I can add the role without hardcoding a bunch of ids.

`@bot.command()
async def callme (ctx, newRole):
user = ctx.message.author
roles = ctx.guild.roles
rolesListAdd = []

for userRole in user.roles:
    rolesListAdd.append(userRole.name.lower())

if newRole in rolesListAdd:
    await ctx.send('You already have this role.')
        
if newRole not in rolesListAdd:
    for role in roles:
        if role.name.lower() == newRole.lower():
            roleToAdd = role
    await user.add_roles(roleToAdd)
    await ctx.send('Role has been added')`

Update discordpy to a supported version

datcord_bot has been stuck on an old discordpy version for years. It would be nice to upgrade it to the latest version, so that the bot can run with Python 3.7 and later.

Various Improvements

While updating to the current discord.py version I noticed some things that could be improved. I will write them in this issue for reference and discussion.

  1. Use discord.py commands. This would turn every command into it's own co-routine. Command aliases are supported. Advantages:
    • The code would become much more readable.
    • All the .startswith("!command") checks would be eliminated.
    • Command args are passed into the co-routine as regular python args.
  2. Role assignment: Instead of looping over all roles just check if the role is available and not in Member.roles. This could be combined with Idea 1. Using bot commands supports casting arguments to valid discord model instances like Role.
  3. Move the data to a dedicated (config) file. Advantages:
    • Clear seperation between content and code
    • Easier file format for content. This may decrease the barrier for people that want to add content without changing code.

Let me know if any of these ideas are wanted. I would be happy to work on these.

Revert my commits

please

the server has gone into something else i don't want to be a part of anymore

Don't upload images every time

It would be cool to save bandwidth by uploading to imgur or some other service and just sending a link.

Would also make the repository muuuuch smaller

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.