Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added a general command extension with about and echo command #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
32 changes: 32 additions & 0 deletions extensions/general.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import discord
import subprocess
from discord.ext import commands
import random

# Basic commands a bot should have:

class General(commands.Cog):
def __init__(self, bot):
self.bot = bot

# Version command, takes the Revision from last commit and shows it as the revision #
@commands.command(description='Get the current bot version', aliases=['ver', 'version', 'info'])
async def about(self, ctx):
try:
ver = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('ascii').strip()
await ctx.send("DarK`BoT by Codi-Hacks rev: " + ver)
except Exception:
await ctx.send("DarK`BoT by Codi-Hacks")

#Say command, it echoes whatever you tell it
@commands.command()
async def say(self, ctx):
message = ctx.message.clean_content
final = message.split(' ', 1)[1]
try:
await ctx.send(final)
except:
await ctx.send("Please Give Some Message!")

def setup(bot):
bot.add_cog(General(bot))