コード例 #1
0
ファイル: Discord.py プロジェクト: ace3df/AcePictureBot
async def help(ctx, command : str = None):
    users_discord_command.append(ctx.message.author.id)
    message = False
    if command:
        command = bot.uses_command(ctx.message.content)
        if command:
            message = "```" + bot.commands[command].description.replace("{OPTION}", command.title()) + "```"
    if not message:
        message = discord_settings.get('help_message', False)
        public_cmds = [cmd for cmd in bot.commands.keys() \
                       if not bot.commands[cmd].patreon_only \
                       and not cmd in bot.commands[cmd].patreon_aliases \
                       and not bot.commands[cmd].patreon_vip_only \
                       and not cmd in bot.commands[cmd].patreon_vip_aliases]
        patreon_cmds = [cmd for cmd in bot.commands.keys() \
                       if bot.commands[cmd].patreon_only \
                       or cmd in bot.commands[cmd].patreon_aliases \
                       or bot.commands[cmd].patreon_vip_only \
                       or cmd in bot.commands[cmd].patreon_vip_aliases]
        message += "\n**Full list of commands: **{}".format(', '.join(public_cmds))
        message += "\n**Full list of Patreon only commands: **{}".format(', '.join(patreon_cmds))
        message += "\n**For a description or help for a command use \"!apb help <command>\"**"
        if not message:
            return
    await discord_bot.say(message)
コード例 #2
0
ファイル: Discord.py プロジェクト: kratos2005/AcePictureBot
async def help(ctx, command: str = None):
    users_discord_command.append(ctx.message.author.id)
    message = False
    if command:
        command = bot.uses_command(ctx.message.content)
        if command:
            message = "```" + bot.commands[command].description.replace(
                "{OPTION}", command.title()) + "```"
    if not message:
        message = discord_settings.get('help_message', False)
        public_cmds = [cmd for cmd in bot.commands.keys() \
                       if not bot.commands[cmd].patreon_only \
                       and not cmd in bot.commands[cmd].patreon_aliases \
                       and not bot.commands[cmd].patreon_vip_only \
                       and not cmd in bot.commands[cmd].patreon_vip_aliases]
        patreon_cmds = [cmd for cmd in bot.commands.keys() \
                       if bot.commands[cmd].patreon_only \
                       or cmd in bot.commands[cmd].patreon_aliases \
                       or bot.commands[cmd].patreon_vip_only \
                       or cmd in bot.commands[cmd].patreon_vip_aliases]
        message += "\n**Full list of commands: **{}".format(
            ', '.join(public_cmds))
        message += "\n**Full list of Patreon only commands: **{}".format(
            ', '.join(patreon_cmds))
        message += "\n**For a description or help for a command use \"!apb help <command>\"**"
        if not message:
            return
    await discord_bot.say(message)
コード例 #3
0
ファイル: Discord.py プロジェクト: Planky02/AcePictureBot
async def on_server_join(server):
    welcome_message = discord_settings.get('welcome_message', False)
    if not welcome_message:
        return
    channel = None
    for chan in server.channels:
        if chan.is_default:
            if chan.is_private:
                return
            channel = chan
            break
    if channel is None:
        return
    await discord_bot.send_message(channel, welcome_message.format(server.owner.mention))
コード例 #4
0
ファイル: Discord.py プロジェクト: ace3df/AcePictureBot
async def on_server_join(server):
    welcome_message = discord_settings.get('welcome_message', False)
    if not welcome_message:
        return
    channel = None
    for chan in server.channels:
        if chan.is_default:
            if chan.is_private:
                return
            channel = chan
            break
    if channel is None:
        return
    await discord_bot.send_message(channel, welcome_message.format(server.owner.mention))
コード例 #5
0
ファイル: Discord.py プロジェクト: kratos2005/AcePictureBot
from config import settings, discord_settings
from functions import (BotProcess, Source, UserContext, datadog_online_check,
                       create_token, slugify, yaml_to_list, download_file,
                       get_global_level_cache, calculate_level,
                       return_command_usage, return_command_usage_date,
                       write_command_usage)

from discord.ext import commands
from bs4 import BeautifulSoup
from tabulate import tabulate
from PIL import Image
import discord
import asyncio
import aiohttp

prefix = discord_settings.get('command_prefix', ["!apb "])
# 0, 2 # 1, 2
discord_bot = commands.Bot(command_prefix=prefix,
                           pm_help=None,
                           shard_id=int(sys.argv[1].strip()),
                           shard_count=int(sys.argv[2].strip()))
if not discord.opus.is_loaded():
    discord.opus.load_opus('libopus-0.x86')
discord_bot.remove_command("help")
attrs = {
    'name': 'discord',
    'character_limit': 1000,
    'support_embedded': True,
    'download_media': False,
    'allow_new_mywaifu': False
}
コード例 #6
0
ファイル: meta.py プロジェクト: kratos2005/AcePictureBot
 async def patreon(self):
     message = discord_settings.get('patreon_msg', False)
     if not message:
         return
     await self.bot.say(message)
コード例 #7
0
ファイル: Discord.py プロジェクト: ace3df/AcePictureBot
from config import settings, discord_settings
from functions import (BotProcess, Source, UserContext,
                       datadog_online_check, create_token,
                       slugify, yaml_to_list, download_file, get_global_level_cache,
                       calculate_level, return_command_usage, return_command_usage_date,
                       write_command_usage)

from discord.ext import commands
from bs4 import BeautifulSoup
from tabulate import tabulate
from PIL import Image
import discord
import asyncio
import aiohttp

prefix = discord_settings.get('command_prefix', ["!apb "])
# 0, 2 # 1, 2
discord_bot = commands.Bot(command_prefix=prefix, pm_help=None, shard_id=int(sys.argv[1].strip()), shard_count=int(sys.argv[2].strip()))
if not discord.opus.is_loaded():
    discord.opus.load_opus('libopus-0.x86')
discord_bot.remove_command("help")
attrs = {'name': 'discord', 'character_limit': 1000, 'support_embedded': True, 'download_media': False, 'allow_new_mywaifu': False}
bot = BotProcess(Source(**attrs))
settings_edits = [["active", "The bot is now online for this server!", "The bot is now offline for this server!"],
                  ["media", "The bot will now post media (images) when it can!", "The bot will now not post any media!"],
                  ["mention", "Users must now @Mention the bot to use commands!", "Users don't need to @Mention to use commands!"],
                  ["music game", "This server can now use the music game!", "This server can not start the music game!"],
                  ["blacklist", "", ""], ["whitelist", "", ""], ["mods", "", ""]]
users_discord_command = []  # bit of a cheap way to get this to work
initial_extensions = [
    'cogs.meta',