Ejemplo n.º 1
0
from client import client
import discord
import random

client.basic_help(title="59",
                  desc="Returns a picture showing 59 signal reception")

fivenine = [
    "https://cdn.discordapp.com/attachments/377206780700393473/409899331584524308/20180204_213324.jpg",
    "https://cdn.discordapp.com/attachments/364489866119217153/412786093327384577/image.jpg",
    "https://cdn.discordapp.com/attachments/364489866119217153/412784280809242624/image.jpg",
    "https://cdn.discordapp.com/attachments/377206780700393473/414858156741754880/20180218_135538.jpg",
    "https://cdn.discordapp.com/attachments/377206780700393473/416371229428285467/20180222_180823.jpg",
    "https://cdn.discordapp.com/attachments/364489910759063552/440596315315896331/IMG_20180428_183441.jpg",
]


@client.command(trigger="59", aliases=["fivenine"])
async def command(command: str, message: discord.Message):
    e = discord.Embed(title=discord.Embed.Empty,
                      description=discord.Embed.Empty,
                      colour=discord.Embed.Empty)
    e = e.set_image(url=random.choice(fivenine))
    await message.channel.send(embed=e)
    return
Ejemplo n.º 2
0
from client import client

import discord
import modules.noofs

cmd_name = "oofs"

client.basic_help(title=cmd_name, desc="How many oofs have there been?")

detailed_help = {
    "Usage": f"{client.default_prefix}{cmd_name}",
    "Arguments": "None",
    "Description": "How many oofs have there been??",
    # NO Aliases field, this will be added automatically!
}
client.long_help(cmd=cmd_name, mapping=detailed_help)


@client.command(
    trigger=cmd_name,
    aliases=[])  # aliases is a list of strs of other triggers for the command
async def command(message: discord.Message):
    await message.channel.send(modules.noofs.oofs)

    return
Ejemplo n.º 3
0
from client import client
import discord

cmd_name = "unmorse"

client.basic_help(title=cmd_name,
                  desc="reverses a Morse Code message back into text")

detailed_help = {
    "Usage":
    f"{client.default_prefix}{cmd_name}",
    "Description":
    "This command takes a given Morse Code string and reverts it back to text. Spaces denote separate letters and spaces with slashes denote separate words.",
}
client.long_help(cmd=cmd_name, mapping=detailed_help)

morse_lookup = {
    "A": ".-",
    "B": "-...",
    "C": "-.-.",
    "D": "-..",
    "E": ".",
    "F": "..-.",
    "G": "--.",
    "H": "....",
    "I": "..",
    "J": ".---",
    "K": "-.-",
    "L": ".-..",
    "M": "--",
    "N": "-.",
Ejemplo n.º 4
0
from client import client
from modules import __common__
import discord
import asyncio


cmd_name = "debug"

client.basic_help(title=cmd_name, desc="Shows information about a specified object.")

detailed_help = {
	"Usage": f"{client.default_prefix}{cmd_name} <object>",
	"Arguments": "`<object>` - a mention or ID to get information about",
	"Description": "This command shows various debugging information about the user, the server used in, and the channel. The ID of a user, server, or channel can be passed in as well.",
}
client.long_help(cmd=cmd_name, mapping=detailed_help)


@client.command(trigger=cmd_name, aliases=["objinfo", "userinfo"])
async def command(command: str, message: discord.Message):
	try:
		try:
			u = await client.get_user_info(__common__.stripMentionsToID(command[6:]))
		except:
			isUser = False
		else:
			isUser = True

		s = client.get_guild(__common__.stripMentionsToID(command[6:]))
		if s is None:
			isServer = False
Ejemplo n.º 5
0
import os
import socket
import threading
import time

try:
    import psutil
except ModuleNotFoundError:
    has_psutil = False
else:
    has_psutil = True

cmd_name = "stats"

client.basic_help(
    title=cmd_name,
    desc=f"shows various running statistics of {client.bot_name}")

detailed_help = {
    "Usage":
    f"{client.default_prefix}{cmd_name}",
    "Description":
    f"This command shows different available statistics of {client.bot_name}, including servers, uptime, and commands run.",
    "Related":
    f"`{client.default_prefix} info` - shows information about {client.bot_name}",
}
client.long_help(cmd=cmd_name, mapping=detailed_help)


@client.ready
async def readier():
Ejemplo n.º 6
0
from client import client
from modules import __common__

import discord
import sys


cmd_name = "about"

client.basic_help(title=cmd_name, desc=f"Returns information about {client.bot_name}")

detailed_help = {
    "Usage": f"{client.default_prefix}{cmd_name}",
    "Description": "Shows information about the bot.",
}
client.long_help(cmd=cmd_name, mapping=detailed_help)


@client.command(trigger=cmd_name, aliases=['a'])  # aliases is a list of strs of other triggers for the command
async def return_bot_info(command: str, message: discord.Message):
    owner = client.get_user(288438228959363073)
    
    python_version = f"Python {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"
    if sys.version_info[3] == "alpha":
        python_version += f"a{sys.version_info.serial}"
    if sys.version_info[3] == "beta":
        python_version += f"b{sys.version_info.serial}"
    if sys.version_info[3] == "candidate":
        python_version += f"rc{sys.version_info.serial}"
    
    embed = discord.Embed(title=f"{client.bot_name} info", description=discord.Embed.Empty, color=0x404040)
Ejemplo n.º 7
0
from client import client
from modules import __common__

import asyncio
import datetime
import discord

cmd_name = "info"

client.basic_help(
    title=cmd_name,
    desc="Shows information about a given server, channel, or user.")

detailed_help = {
    "Usage":
    f"{client.default_prefix}{cmd_name} <object>",
    "Arguments":
    "`<object>` - a mention or ID to get information about",
    "Description":
    "This command shows various debugging information about the user, the server used in, and the channel. The ID of a user, server, or channel can be passed in as well.",
}
client.long_help(cmd=cmd_name, mapping=detailed_help)


def status_emoji(state: discord.Status) -> str:
    if state is discord.Status.online:
        return "<:status_online:534918510950744064>"
    if state is discord.Status.idle: return "<:status_idle:534918510548090882>"
    if state is discord.Status.dnd: return "<:status_dnd:534918509701103622>"
    if state is discord.Status.offline:
        return "<:status_offline:534918510652948501>"
Ejemplo n.º 8
0
from client import client
import discord
import time

cmd_name = "uptime"

client.basic_help(
    title=cmd_name,
    desc="Returns the current uptime of Awoobot, in seconds, hours, and days.")


@client.command(trigger=cmd_name, aliases=[])
async def uptime_cmd(command: str, message: discord.Message):
    await message.channel.send(
        f"**__Uptime:__**\n{time.perf_counter()-client.first_execution:.2f} seconds, or \n{(time.perf_counter()-client.first_execution)/3600:.3f} hours, or \n{(time.perf_counter()-client.first_execution)/86400:.4f} days"
    )
    return
Ejemplo n.º 9
0
from client import client

import discord


cmd_name = "phoneticize"

client.basic_help(title=cmd_name, desc="Turns into a phoneticize word.")

detailed_help = {
	"Usage": f"{client.default_prefix}{cmd_name}",
	"Arguments": "letter",
	"Description": "Turns into a phoneticize word.",
	# NO Aliases field, this will be added automatically!
}
client.long_help(cmd=cmd_name, mapping=detailed_help)


@client.command(trigger=cmd_name,
				aliases=["ph"])  # aliases is a list of strs of other triggers for the command
async def command(command: str, message: discord.Message):
	phoneticize = command[3:]
	await message.channel.send(phoneticize)

	return
Ejemplo n.º 10
0
import datetime
import discord
import io
import json
import log
import random
import socket
import struct


SERVER_URL = "LittleDigPlanet.beastmc.com:25587"  # Port is default 25565
COMMAND_TRIGGER = "mc"  # "mc" default

# Following classes are forked/edited from Dinnerbone/mcstatus

client.basic_help("mc", "Shows information about the minecraft server")


class Connection:
    def __init__(self):
        self.sent = bytearray()
        self.received = bytearray()

    def read(self, length):
        result = self.received[:length]
        self.received = self.received[length:]
        return result

    def write(self, data):
        if isinstance(data, Connection):
            data = bytearray(data.flush())
Ejemplo n.º 11
0
from client import client
import discord

cmd_name = "ping"

client.basic_help(title=cmd_name, desc="shows the bot's latency to the Discord API endpoint")

detailed_help = {
	"Usage": f"{client.default_prefix}{cmd_name}",
	"Arguments": "None",
	"Description": "Returns the bot's latency to the Discord endpoint (implicitly telling you your connection is working).",
}
client.long_help(cmd=cmd_name, mapping=detailed_help)


@client.command(trigger=cmd_name)
async def ping(command: str, message: discord.Message):
	await message.channel.send(f"Latency from bot to Discord endpoint (ms): `{client.latency*1000:.2f}`")
	return
Ejemplo n.º 12
0
from client import client

import asyncio
import discord
import subprocess

client.basic_help(title="unit", desc="Converts units with the `units` Unix command.")
help_dict = {
	"Usage": f"`{client.default_prefix}unit <src units> [dst units]`",
	"Arguments": "`src units` - Source units to convert from. Supports any units the Unix `units` command supports (a *lot*!).\n`dst units` - (optional) Destination units to convert to.",
	"Description": "This units transforms one unit into another unit. The command uses the underlying `units` Unix command, and supports over 3000 different units.\nIf destination units are not provided, the source units will be converted into standard units for length/width/height.",
	"Example": f"`{client.default_prefix}units 1000km mi`\n`{client.default_prefix}units 0.0000026c`",
}
client.long_help(cmd="unit", mapping=help_dict)


@client.command(trigger="unit", aliases=["units", "c", "convert", "u"])
async def convert_units(command: str, message: discord.Message):
	parts = command.split(" ")

	if len(parts) == 1:
		# no args
		await message.channel.send(f"Need more arguments to run command. See command help for help.")
		return
	if len(parts) == 2:
		proc = subprocess.Popen(["units", "-t", parts[1]], stdout=subprocess.PIPE)
	if len(parts) == 3:
		proc = subprocess.Popen(["units", "-t", parts[1], parts[2]], stdout=subprocess.PIPE)
	if len(parts) == 4:
		proc = subprocess.Popen(["units", "-t", f"'{parts[1]} {parts[2]}'", parts[3]], stdout=subprocess.PIPE)
	if len(parts) == 5:
Ejemplo n.º 13
0
from client import client

import discord


@client.command(trigger="ping", aliases=["p"])
async def help_command(command: str, message: discord.Message):
    await message.channel.send(
        f"Latency to the connected Discord API endpoint: `{client.latency*1000:.0f} ms`"
    )
    return


client.basic_help("ping",
                  "Returns the bot's latency to its connected API endpoint.")

help_long_help = {
    "Usage:":
    f"`{client.default_prefix}ping`",
    "Description":
    "This command returns the bot's latency to the Discord API endpoint it is connected to."
}
client.long_help("ping", help_long_help)
Ejemplo n.º 14
0
            await message.channel.send(embed=embed)

        elif type(sub_help) == dict:
            embed = discord.Embed(
                title=f"Help for command `{command.lower()[5:]}`",
                description=sub_help.get("_description", discord.Embed.Empty),
                colour=0x06b206)
            for title, text in sub_help.items():
                embed = embed.add_field(name=title, value=text, inline=False)
            if client.cmd_aliases.get(command.lower()[5:], []):
                embed = embed.add_field(name="Aliases",
                                        value="\n".join(
                                            client.cmd_aliases.get(
                                                command.lower()[5:], [])))
            embed = embed.set_footer(text=datetime.datetime.utcnow().__str__())
            await message.channel.send(embed=embed)


client.basic_help("help [command]",
                  "Get help with the bot or a certain command")

help_long_help = {
    "Usage:":
    f"`{client.default_prefix}help [command]`",
    "Arguments":
    "`command` - (Optional) Bot command to fetch detailed help with.",
    "Description":
    "This command fetches help information for a command or for all commands."
}
client.long_help("help", help_long_help)
Ejemplo n.º 15
0
from client import client
from datetime import datetime

import asyncio
import discord
import subprocess
import time

client.basic_help(title="time",
                  desc="Shows the current time, accounting for delays.")
client.long_help(
    cmd="time",
    mapping={
        "Usage":
        f"`{client.default_prefix}time",
        "Description":
        "This command shows the current UTC time as per the system clock, synchronized to a GPS receiver.\n"
        "Typical accuracy of the clock is <500ns.\nDelays due to message sending in Discord are accounted "
        "for with two test messages before recording and fudging the current time, and sending it back to you.\n"
        "For further information on the clock synchronization on this machine, run the "
        f"`{client.default_prefix}ntp` command.",
    })

last_run = 0


@client.command(trigger="time")
async def show_simple_time(command: str, message: discord.Message):
    global last_run

    if (time.time() - last_run) < 15.0:  # if cooldown,
Ejemplo n.º 16
0
from client import client

import discord

cmd_name = "x"

client.basic_help(title=cmd_name, desc="Pulls up a xkcd.")

detailed_help = {
    "Usage": f"{client.default_prefix}{cmd_name}",
    "Arguments": "None",
    "Description": "Pulls up a xkcd, all you need is a number!",
    # NO Aliases field, this will be added automatically!
}
client.long_help(cmd=cmd_name, mapping=detailed_help)


@client.command(
    trigger=cmd_name,
    aliases=[])  # aliases is a list of strs of other triggers for the command
async def command(command: str, message: discord.Message):
    num = command[2:]
    await message.channel.send('http://xkcd.com/' + num)

    return
Ejemplo n.º 17
0
import discord
import os
import socket
import time


try:
    import psutil
except ModuleNotFoundError:
    has_psutil = False
    psutil = None
else:
    has_psutil = True
    psutil_update_thread = None

client.basic_help(title="stats", desc=f"Shows running statistics of {client.bot_name}")

detailed_help = {
    "Usage": f"{client.default_prefix}stats",
    "Description": f"This command shows different available statistics of {client.bot_name}, including servers, uptime, and commands run.",
    "Related": f"`{client.default_prefix}info` - shows information about {client.bot_name}",
}
client.long_help(cmd="stats", mapping=detailed_help)


@client.command(trigger="stats", aliases=["statistics", "s", "status"])
async def statistics(command: str, message: discord.Message):
    if "--uptime" in command:
        up = time.perf_counter() - client.first_execution
        await message.channel.send(f"Uptime:\n`{up:.3f}` seconds\n`{up/86400:.4f}` days")
        return
Ejemplo n.º 18
0
from client import client
import datetime
import discord
import key

client.basic_help(
    title="kzop",
    desc="returns the time until Caleb/KZ0P's return from his two year leave")


@client.message
async def info_response(message: discord.Message):
    if any([x in message.content for x in key.kzop_mentions]):
        try:
            await message.channel.send(
                f"Hey there {message.author.mention}! You mentioned or pinged cSmith/KZ0P in your message, but he is on a two year long break. To send a message to him, please talk to @ntoskrnl#4435 instead."
            )
        except:  # we literally don't care
            pass


@client.command(trigger="kzop", aliases=["kz0p"])
async def timer(command: str, message: discord.Message):
    await message.channel.send(
        str(datetime.datetime(2020, 5, 25) - datetime.datetime.utcnow()))
    return
Ejemplo n.º 19
0
from modules import __common__
from datetime import datetime
from client import client
import discord
import time
import key
import log
import os


client.basic_help(title="exit", desc="Cleans up and shuts down the bot.")

detailed_help = {
	"Usage": f"{client.default_prefix}exit [pid]",
	"Arguments": "`pid` - (Optional) Process ID identifying which bot to exit out of",
	"Description": "This command completely exits out of the bot, and performs any registered cleanup procedures. A user ID check is performed against a builtin list of users allowed to run this command.",
	# NO Aliases field, this will be added automatically!
}
client.long_help(cmd="exit", mapping=detailed_help)


@client.command(trigger="exit")
async def command(command: str, message: discord.Message):
	if not __common__.check_permission(message.author):
		await message.add_reaction("❌")
		if message.author.id == key.shutdown_easter_egg_user:
			await message.channel.send("*hehehe*\n\nCan't fool me! >:3")
		return
	else:
		parts = command.split(" ")
		try:
Ejemplo n.º 20
0
from client import client

import asyncio
import discord
import subprocess

client.basic_help(title="unit", desc="Converts between various units.")
help_dict = {
    "Usage": f"`{client.default_prefix}unit <src units> [dst units]`",
    "Arguments": "`src units` - Source units to convert from. Supports any units the Unix `units` command supports (a "
                 "*lot!*).\n`dst units` - (optional) Destination units to convert to.",
    "Description": "This units transforms one unit into another unit. The command uses the underlying `units` Unix "
                   "command, and supports over 3000 different units.\nIf destination units are not provided, the "
                   "source units will be converted into standard SI units.",
    "One argument usage": "`units 0.04128mi`\n`units 12d`\nWhen passing only one argument, the bot will convert the "
                          "given measurement into standard SI units.",
    "Two argument usage": "`units 41.28mi km`\n`units 12um 0.02mm`\nWhen passing two arguments, the format is `units "
                          "<src> <dst>`. This will convert the given measurement into the destination unit, if "
                          "possible. If two numerical measurements are provided, this performs a ratio comparison "
                          "instead (see below). Note that providing one measurement but with a space is interpreted as "
                          "attempting to convert a dimensionless number into a measurement, and will throw a "
                          "conformability error.",
    "Three argument usage": "`units 1.3 lightseconds m`\nWhen passing three arguments, the first two are interpreted "
                            "as the source measurement, which will be converted into the destination measurement given "
                            "by the third argument.",
    "Four argument usage": "`units 0.128 us 0.000000319 sec`\nWhen passing four arguments, the first two and the last "
                           "two are interpreted to be the source and destination measurements. With numerical values "
                           "provided for both, this will perform a ratio comparison (see below).",
    "Using temperature": "If it is desired to use temperatures, the temperature functions must be used: `tempC(1700)`, "
                         "`tempK(273.15)`, `tempF`, or `tempR`.",
    "SI conversion": "If a single unit is passed without a destination unit or measurement to convert or compare to, "
Ejemplo n.º 21
0
from client import client
import discord

cmd_name = "morse"

client.basic_help(title=cmd_name, desc="converts a given string to morse code")

detailed_help = {
    "Usage":
    f"{client.default_prefix}{cmd_name} <string>",
    "Arguments":
    "`<string>` - the string to convert to morse code",
    "Description":
    "This command converts a given string into morse code. Works with letters, numbers, and some "
    "punctuation.",
    # NO Aliases field, this will be added automatically!
}
client.long_help(cmd=cmd_name, mapping=detailed_help)

morse_lookup = {
    "A": "  .-",
    "B": "  -...",
    "C": "  -.-.",
    "D": "  -..",
    "E": "  .",
    "F": "  ..-.",
    "G": "  --.",
    "H": "  ....",
    "I": "  ..",
    "J": "  .---",
    "K": "  -.-",
Ejemplo n.º 22
0
from client import client
from datetime import datetime
import discord
import requests

cmd_name = "call"

client.basic_help(title=cmd_name,
                  desc="Looks up a callsign from the callook.info database.")

detailed_help = {
    "Usage":
    f"{client.default_prefix}{cmd_name} <callsign>",
    "Arguments":
    "`<callsign>` - the callsign to look up",
    "Description":
    "This command is a reimplementation of HamTheMan's `htm call` command. It retrieves information about a specified callsign and returns some info about it. This command exists in here because Ben doesn't know how to keep a bot online.",
    # NO Aliases field, this will be added automatically!
}
client.long_help(cmd=cmd_name, mapping=detailed_help)


@client.command(
    trigger=cmd_name,
    aliases=[])  # aliases is a list of strs of other triggers for the command
async def command(command: str, message: discord.Message):
    try:
        requested_call = command.split(" ", 1)[1]
    except TypeError:
        await message.channel.send(
            "Parameter `callsign` not given. See command help for help.")
Ejemplo n.º 23
0
import log
from client import client
from key import wa_key

import aiohttp
import discord
import time
import wolframalpha

http_client = aiohttp.ClientSession()
last_run_time = 0
blacklist_users = []

client.basic_help(
    title=f"{client.default_prefix}wa",
    desc="Performs a Wolfram|Alpha query and returns the results")
client.long_help(
    cmd="wa",
    mapping={
        "Usage":
        f"{client.default_prefix}wa",
        "Arguments":
        "Query to be evaluated",
        "Description":
        "The Wolfram|Alpha engine is a web-based computation engine that can perform a wide array of "
        "mathematical, scientific, or engineering computations, statistical and information lookup, "
        "conversion and calculation using units, and much, *much* more.",
        "Note about results":
        "Because Wolfram|Alpha can return results about (seemingly) anything under the sun, "
        "it is difficult to automatically return intended, desired answers. For that reason, "
        "if you encounter a query that does not show the answer or shows it improperly, "
Ejemplo n.º 24
0
from client import client
import requests
import discord
import time

cmd_name = "cond"

client.basic_help(title=cmd_name, desc="Shows current band conditions.")

detailed_help = {
    "Usage": f"{client.default_prefix}{cmd_name}",
    "Arguments": "None",
    "Description": "This is what the command does!",
}
client.long_help(cmd=cmd_name, mapping=detailed_help)

last_cond_update = 0
cond_cache_time = 7200


@client.command(trigger=cmd_name)
async def command(command: str, message: discord.Message):
    global cond_cache_time, last_cond_update
    if command == "update":
        last_cond_update = 1
    if (time.time() - last_cond_update) >= cond_cache_time:
        req = requests.get("http://www.hamqsl.com/solar101vhf.php")
        with open("image.gif", "wb+") as tempfile:
            for block in req.iter_content(16384):
                tempfile.write(block)
            last_cond_update = time.time()
Ejemplo n.º 25
0
from client import client
from datetime import datetime
from modules import __common__
from typing import Tuple

import asyncio
import discord
import markovify


cmd_name = "markov"

client.basic_help(title=cmd_name, desc="creates a message from a markov chain based on previous messages in a channel")

detailed_help = {
    "Usage": f"{client.default_prefix}{cmd_name} [mention] [--charlimit x] [--size y] [--attempts z]",
    "Arguments": "`mention` - (optional) mention or ID of a channel or user to generate markov chain from (not provided = current channel)\n"
                 "`--charlimit` - (optional) specifies a custom maximum amount of permitted characters (default 1500 - lower values may require more --attempts)\n"
                 "`--size` - (optional) specifies the size of the markov chain. For text 2 or 3 is most common, for very large sources 4 may work. (default 3)\n"
                 "`--attempts` - (optional) specifies how many times the markov chain should attempt to generate valid output before giving up (default 50 - higher values have a better chance of succeeding for small sources)\n",
    "Description": "This command reads input from a given source and feeds messages into a markov chain, which is then used to generate a random sentence that is similar to that of the input. Acceptable sources include the current channel (nothing given for `mention` argument), a specific user (that user's mention or preferably ID given for `mention` argument), or a specific channel (that channel's mention or ID given for `mention` argument).",
}
client.long_help(cmd=cmd_name, mapping=detailed_help)

forbidden_channels = [
    473570993072504832,
    826099521032290334,
    826868270740013116,
    829321559217930240,
    830263185088708660
]
Ejemplo n.º 26
0
from client import client

import discord

cmd_name = "command"

client.basic_help(title=cmd_name,
                  desc="This is what my command does, in a sentence.")

detailed_help = {
    "Usage": f"{client.default_prefix}{cmd_name}",
    "Arguments": "None",
    "Description": "This is what the command does!",
    # NO Aliases field, this will be added automatically!
}
client.long_help(cmd=cmd_name, mapping=detailed_help)


@client.command(
    trigger=cmd_name,
    aliases=[])  # aliases is a list of strs of other triggers for the command
async def command(command: str, message: discord.Message):
    # Awesome stuff happens here!
    return
Ejemplo n.º 27
0
from client import client
import discord


client.basic_help(title="cqdx", desc="SAY Q DX SAY Q DX SAY Q DXXXXX  SAY Q DX SAY Q DX SAY Q DXxXxXxXxX  CQDXCQDXCQDXCQDX")

@client.command(trigger="cqdx")
async def command(command: str, message: discord.Message):
	# Awesome stuff happens here!
	await message.channel.send("https://www.youtube.com/watch?v=5_bHuCwKmkI")
	return
Ejemplo n.º 28
0
from key import shutdown_users, shutdown_easter_egg_user
from datetime import datetime
from client import client
import discord
import time
import log
import os

cmd_name = "exit"

client.basic_help(title=cmd_name, desc="Cleans up and shuts down the bot.")

detailed_help = {
    "Usage":
    f"{client.default_prefix}{cmd_name}",
    "Arguments":
    "None",
    "Description":
    "This command completely exits out of the bot, and performs any registered cleanup procedures. A user ID check is performed against a builtin list of users allowed to run this command.",
    # NO Aliases field, this will be added automatically!
}
client.long_help(cmd=cmd_name, mapping=detailed_help)


@client.command(
    trigger=cmd_name,
    aliases=[])  # aliases is a list of strs of other triggers for the command
async def command(command: str, message: discord.Message):
    if message.author.id not in shutdown_users:
        try:
            await message.add_reaction("❌")
Ejemplo n.º 29
0
"""Module to assist livepatching in new or updated modules."""

from client import client
from modules import __common__

import discord
import importlib
import modules

client.basic_help("livepatch",
                  "A module to load, reload, or unload modules on-the-fly")

detailed_help = {
    "Usage":
    f"`{client.default_prefix}livepatch <subcommands> []`",
    "Description":
    "This module is a kit of commands that can load and unload "
    "modules on the fly while a bot is running, and show information about "
    "currently loaded commands. Beware that this command can disable itself."
}

client.long_help("livepatch", detailed_help)

permissible_users = [  # list of IDs permitted to use the command
    288438228959363073
]

# Correct for framework version 0.6
# As of 0.7 these remove the leading underscore
client_lists = [
    # a list of all handlers the bot has
Ejemplo n.º 30
0
from exceptions import BaseFrameworkError
from typing import Union, Dict, List

import asyncio
import discord
import json
import key
import log
import os
import random
import socket
import time
import urllib
import youtube_dl

client.basic_help(title="music",
                  desc="Handles music functionality within the bot.")
detailed_help = {
    "Usage":
    f"{client.default_prefix}music <subcommand> [args]",
    "Arguments":
    "`subcommand` - subcommand to run\n`args` - (optional) arguments specific to the subcommand being run",
    "Description":
    "This command manages music related functionality within the bot. Music is available to several servers at once.",
    "Subcommands":
    f"`{client.default_prefix}music join` - Joins a voice channel\n"
    f"`{client.default_prefix}music add <url>` - Adds the specified song to the queue\n"
    f"`{client.default_prefix}music play` - Plays music in the queue\n"
    f"`{client.default_prefix}music pause` - Toggles pause\n"
    f"`{client.default_prefix}music playing` - Shows what is currently playing\n"
    f"`{client.default_prefix}music skip` - Skips the currently playing song\n"
    f"`{client.default_prefix}music queue` - Shows the current music queue\n"