Skip to content
/ Lamb Public

A simple and lightweight all-purpose Discord bot created with discord.py

Notifications You must be signed in to change notification settings

griimnak/Lamb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lamb PEP8

Light ass Management Bot

A simple and lightweight all-purpose Discord bot created with discord.py

Total dependencies: 4

youtube_dl, discord, pynacl, requests

Current Features

✔ Locale system
✔ Config system
✔ Music streaming (like Rythm Bot)
✔ League Of Legends tracker
✔ Clean and extendable bot structure

Alt Text Alt Text

Prerequisites

Windows

Install the latest stable build of Python 3 from python.org.

Make sure python is recognized. Help article: here

Download lamb as a zip and extract it to your Desktop.

Linux

Verify you are using Python 3.6+

python -V

Clone this git repository

git clone thisrepo

Installation

From within the directory you extracted, launch a command prompt (or terminal) and run the following command.

python -m pip install -r requirements.txt

Launching

Firstly, generate an application and retrieve your bot token. Help article: here

Second, check out settings/config.json and paste your token into the token="" field.

You're now ready to launch lamb.

python start.py

Alternatively if you're on Windows, you can launch lamb by double-clicking winstart.bat

To learn how to add your Discord bot to servers, click here

Coding Commands

Lamb is structured to be a perfect starting point for developing your own custom commands.

Visit the discord.py api documentation here.

The main gist is this,

from discord.ext import commands

class MyCustomCog(commands.Cog):
    """Every Cog starts like this."""
    def __init__(self, bot):
        self.bot = bot

Cogs (command groups) are placed in cogs/, this location can be changed in settings/config.json

Using the template above, you would start a custom command like so: (within class block)

    @commands.command()
    async def ping(self, ctx):
        """These docstrings are used as descriptions when using !help"""
        await ctx.send("Pong!")

Final product:

from discord.ext import commands

class MyCustomCog(commands.Cog):
    """Every Cog starts like this."""
    def __init__(self, bot):
        self.bot = bot

    @commands.command()
    async def ping(self, ctx):
        """These docstrings are used as descriptions when using !help"""
        await ctx.send("Pong!")

Public Functions

Below are public accessible functions for use throughout the Bot

Accessing the Bot's memory and state data

from lamb import memory 

print(memory) # memory of lamb instance
>>>> {'active': True, 'py_version': (3, 6), 'lamb_version': '0.0', 'token': '', 'command_prefix': '#', 'temp_dir': './lamb/temp/', 'cogs_dir': './cogs/', 'strings_locale': 'en_US', 'strings': {'greeting': 'Welcome to the server.', 'banned': '{user} has been banned from the server.'}}


# you can also set memory variables like so
memory["custom_var"] = "my custom value"
memory["command_prefix"] = "$" # updating a value

Serving

import lamb as DiscordBot

DiscordBot.load_settings()
DiscordBot.serve_now()

Reloading the json settings file

from lamb import load_settings

load_settings()

About

A simple and lightweight all-purpose Discord bot created with discord.py

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published