Python discord.ext.commands.command() Examples

The following are 30 code examples of discord.ext.commands.command(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module discord.ext.commands , or try the search function .
Example #1
Source File: general.py    From spirit with MIT License 7 votes vote down vote up
def on_guild_join(self, guild):
        """Send welcome message to the server owner"""
        message = ("Greetings! My name is **{}**, and my sole responsibility is to help you and "
                   "your group kick ass in Destiny 2! You're receiving this message because you "
                   "or one of your trusted associates has added me to **{}**.\n\n"
                   "**Command Prefix**\n\n"
                   "My default prefix is **!**, but you can also just mention me with **@{}**. "
                   "If another bot is already using the **!** prefix, you can choose a different prefix "
                   "for your server with **!settings setprefix <new_prefix>** (don't include the brackets).\n\n"
                   "For a list of all available commands, use the **!help** command. If you want more "
                   "information on a command, use **!help <command_name>**.\n\n"
                   "If you have any feedback, you can use my **!feedback** command to send "
                   "a message to my developer! If you want to request a feature, report a bug, "
                   "stay up to date with new features, or just want some extra help, check out the official "
                   "{} Support server! (https://discord.gg/GXCFpkr)"
                   ).format(self.bot.user.name, guild.name, self.bot.user.name,
                            self.bot.user.name, self.bot.user.name)
        await guild.owner.send(message) 
Example #2
Source File: admin.py    From xenon with GNU General Public License v3.0 6 votes vote down vote up
def sudo(self, ctx, *, command):
        """
        Execute a command and bypass cooldown


        __Arguments__

        **command**: The command
        """
        message = ctx.message
        message.content = command

        new_ctx = await self.bot.get_context(message, cls=context.Context)
        new_ctx.command.reset_cooldown(new_ctx)
        if isinstance(new_ctx.command, cmd.Group):
            for command in new_ctx.command.all_commands.values():
                command.reset_cooldown(new_ctx)

        await self.bot.invoke(new_ctx) 
Example #3
Source File: adventure.py    From Dumb-Cogs with MIT License 6 votes vote down vote up
def load(self, ctx, save=None):
        """loads current team's save. defaults to most recent"""
        server = ctx.message.server
        author = ctx.message.author
        channel = ctx.message.channel

        try:
            team = self.splayers[server.id][channel.id][author.id]
        except:
            team = None

        await self.embark.callback(self, ctx, team, save)
        

    # @adventure.command(pass_context=True)
    # async def save(self, ctx, file):
    #     pass

    # if no team and no save, if user doesn't have a save, new game. otherwise new game must specify team and save 
Example #4
Source File: economytrickle.py    From Dumb-Cogs with MIT License 6 votes vote down vote up
def tricklebot(self, ctx):
        """Enables/disables trickling economy to the bot"""
        sid = ctx.message.server.id
        econ = self.bot.get_cog('Economy')
        settings = self.settings[sid]
        if econ.bank.account_exists(ctx.message.server.me):
            settings["TRICKLE_BOT"] = not settings["TRICKLE_BOT"]
            if self.settings[sid]["TRICKLE_BOT"]:
                await self.bot.say("I will now get currency trickled to me.")
            else:
                await self.bot.say("I will stop getting currency "
                                   "trickled to me.")
            dataIO.save_json("data/economytrickle/settings.json", self.settings)
        else:
            await self.bot.say("I do not have an account registered with the "
                               "`Economy cog`. If you want currency to trickle"
                               " to me too, please use the `registerbot` "
                               "command to open an account for me, then try "
                               "again.") 
Example #5
Source File: leveler.py    From Maybe-Useful-Cogs with MIT License 6 votes vote down vote up
def lvlmsglock(self, ctx):
        '''Locks levelup messages to one channel. Disable command via locked channel.'''
        channel = ctx.message.channel
        server = ctx.message.server

        if "lvl_msg_lock" not in self.settings.keys():
            self.settings["lvl_msg_lock"] = {}

        if server.id in self.settings["lvl_msg_lock"]:
            if channel.id == self.settings["lvl_msg_lock"][server.id]:
                del self.settings["lvl_msg_lock"][server.id]
                await self.bot.say("**Level-up message lock disabled.**".format(channel.name))
            else:
                self.settings["lvl_msg_lock"][server.id] = channel.id
                await self.bot.say("**Level-up message lock changed to `#{}`.**".format(channel.name))
        else:
            self.settings["lvl_msg_lock"][server.id] = channel.id
            await self.bot.say("**Level-up messages locked to `#{}`**".format(channel.name))

        fileIO('data/leveler/settings.json', "save", self.settings) 
Example #6
Source File: help_channels.py    From bot with MIT License 6 votes vote down vote up
def close_command(self, ctx: commands.Context) -> None:
        """
        Make the current in-use help channel dormant.

        Make the channel dormant if the user passes the `dormant_check`,
        delete the message that invoked this,
        and reset the send permissions cooldown for the user who started the session.
        """
        log.trace("close command invoked; checking if the channel is in-use.")
        if ctx.channel.category == self.in_use_category:
            if await self.dormant_check(ctx):

                # Remove the claimant and the cooldown role
                await self.help_channel_claimants.delete(ctx.channel.id)
                await self.remove_cooldown_role(ctx.author)

                # Ignore missing task when cooldown has passed but the channel still isn't dormant.
                self.cancel_task(ctx.author.id, ignore_missing=True)

                await self.move_to_dormant(ctx.channel, "command")
                self.cancel_task(ctx.channel.id)
        else:
            log.debug(f"{ctx.author} invoked command 'dormant' outside an in-use help channel") 
Example #7
Source File: dotabase.py    From MangoByte with MIT License 6 votes vote down vote up
def herotable(self, ctx, *, table_args : HeroStatsTableArgs):
		"""Displays a sorted table of heroes and their stats
		
		Displays a table with computed hero stats showing which heroes have the highest values for the specified stat. To see the list of possible stats, try the `{cmdpfx}leveledstats` command

		**Examples:**
		`{cmdpfx}herotable dps`
		`{cmdpfx}herotable health lvl 30`
		`{cmdpfx}herotable attack speed level 21 descending`
		"""
		if table_args.stat is None:
			raise UserError(f"Please select a stat to sort by. For a list of stats, see `{self.cmdpfx()}leveledstats`")
		if table_args.hero_level < 1 or table_args.hero_level > 30:
			raise UserError("Please select a hero level between 1 and 30")
		if table_args.hero_count < 2 or table_args.hero_count > 40:
			raise UserError("Please select a hero count between 2 and 40")

		embed = discord.Embed()

		image = discord.File(await drawdota.draw_herostatstable(table_args, self.hero_stat_categories, self.leveled_hero_stats), "herotable.png")
		embed.set_image(url=f"attachment://{image.filename}")
		embed.set_footer(text="The stats shown above do not account for talents, passives, or items")

		await ctx.send(embed=embed, file=image) 
Example #8
Source File: information.py    From bot with MIT License 6 votes vote down vote up
def user_info(self, ctx: Context, user: Member = None) -> None:
        """Returns info about a user."""
        if user is None:
            user = ctx.author

        # Do a role check if this is being executed on someone other than the caller
        elif user != ctx.author and not with_role_check(ctx, *constants.MODERATION_ROLES):
            await ctx.send("You may not use this command on users other than yourself.")
            return

        # Non-staff may only do this in #bot-commands
        if not with_role_check(ctx, *constants.STAFF_ROLES):
            if not ctx.channel.id == constants.Channels.bot_commands:
                raise InWhitelistCheckFailure(constants.Channels.bot_commands)

        embed = await self.create_user_embed(ctx, user)

        await ctx.send(embed=embed) 
Example #9
Source File: dotabase.py    From MangoByte with MIT License 6 votes vote down vote up
def hello(self, ctx):
		"""Says hello

		WHAT MORE DO YOU NEED TO KNOW!?!?!? IS 'Says hello' REALLY NOT CLEAR ENOUGH FOR YOU!?!!11?!!?11!!?!??"""
		dota_hellos = [
			"slark_attack_11",
			"kunk_thanks_02",
			"meepo_scepter_06",
			"puck_ability_orb_03",
			"tink_spawn_07",
			"treant_ally_08",
			"wraith_lasthit_02",
			"timb_deny_08",
			"tech_pain_39",
			"meepo_attack_08",
			"slark_lasthit_02"
		]
		dota_response = random.choice(dota_hellos)
		response = session.query(Response).filter(Response.name == dota_response).first()
		print("hello: " + response.name)
		await self.play_response(response, ctx)

	# Plays the correct command for the given keyphrase and hero, if a valid one is given 
Example #10
Source File: time.py    From Penny-Dreadful-Tools with GNU General Public License v3.0 6 votes vote down vote up
def time(ctx: MtgContext, *, args: str) -> None:
    """Current time in location."""
    if len(args) == 0:
        await ctx.send('{author}: No location provided. Please type !time followed by the location you want the time for.'.format(author=ctx.author.mention))
        return
    try:
        twentyfour = configuration.get_bool(f'{guild_or_channel_id(ctx.channel)}.use_24h') or configuration.get_bool(f'{ctx.channel.id}.use_24h')
        ts = fetcher.time(args, twentyfour)
        times_s = ''
        for t, zones in ts.items():
            cities = sorted(set(re.sub('.*/(.*)', '\\1', zone).replace('_', ' ') for zone in zones))
            times_s += '{cities}: {t}\n'.format(cities=', '.join(cities), t=t)
        await ctx.send(times_s)
    except NotConfiguredException:
        await ctx.send('The time command has not been configured.')
    except TooFewItemsException:
        logging.exception('Exception trying to get the time for %s.', args)
        await ctx.send('{author}: Location not found.'.format(author=ctx.author.mention)) 
Example #11
Source File: owner.py    From MangoByte with MIT License 6 votes vote down vote up
def loggingdb(self, ctx, table, identifier):
		"""Gets a list of the most recent errors from loggingdb"""
		if table in [ "error", "errors", "bugs", "bug" ]:
			table = loggingdb_spec.Error
			filterer = lambda q: q.filter_by(message_id=identifier)
		elif table in [ "message", "messages", "msg", "messages" ]:
			table = loggingdb_spec.Message
			filterer = lambda q: q.filter_by(id=identifier)
		elif table in [ "command", "commands", "cmd", "cmds" ]:
			table = loggingdb_spec.Command
			filterer = lambda q: q.filter_by(message_id=identifier)
		else:
			raise UserError("Dont know what table you're talking about")
		found = False
		for obj in filterer(loggingdb.session.query(table)):
			found = True
			await ctx.send(embed=obj.to_embed(self))
			if table == loggingdb_spec.Error:
				chunks = obj.error_text_chunks()
				for chunk in chunks:
					await ctx.send(chunk)
		if not found:
			raise UserError("Couldn't find anything for that") 
Example #12
Source File: pokemon.py    From MangoByte with MIT License 6 votes vote down vote up
def pokecry(self, ctx, *, pokemon):
		"""Plays the pokemon's sound effect

		Audio files for these pokemon cries were gotten from [Veekun](https://veekun.com/dex/downloads). Veekun does not have the cries for Generation VII yet, so I won't be able to play those.

		Most pokemon have a new cry and an old cry. To get the old cry instead of the new one, add 'old' to the end of your command (see example below.)

		**Example:**
		`{cmdpfx}pokecry pikachu`
		`{cmdpfx}pokecry bulbasaur old`"""
		words = pokemon.split(" ")
		old = "old" in words
		if old:
			words.remove("old") 
		pokemon = " ".join(words)

		data, species_data = await self.get_pokemon_data(pokemon)

		if data["id"] > 721:
			raise UserError("Sorry, I don't have the cries for pokemon in Generation VII yet")

		success = await self.play_pokecry(ctx, data["id"], pokemon, old=old)

		if not success:
			raise UserError(f"Couldn't find the cry for {data['localized_name']}") 
Example #13
Source File: stats.py    From avrae with GNU General Public License v3.0 6 votes vote down vote up
def command_activity(self, ctx):
        await self.increase_stat(ctx, "commands_used_life")
        # log command lifetime stat
        await self.bot.mdb.analytics_command_activity.update_one(
            {"name": ctx.command.qualified_name},
            {
                "$inc": {"num_invocations": 1},  # yay, atomic operations
                "$currentDate": {"last_invoked_time": True}
            },
            upsert=True
        )
        # log event
        guild_id = 0 if ctx.guild is None else ctx.guild.id
        await self.bot.mdb.analytics_command_events.insert_one(
            {
                "timestamp": datetime.datetime.utcnow(),
                "command_name": ctx.command.qualified_name,
                "user_id": ctx.author.id,
                "guild_id": guild_id
            }
        ) 
Example #14
Source File: customization.py    From avrae with GNU General Public License v3.0 6 votes vote down vote up
def prefix(self, ctx, prefix: str = None):
        """Sets the bot's prefix for this server.

        You must have Manage Server permissions or a role called "Bot Admin" to use this command.

        Forgot the prefix? Reset it with "@Avrae#6944 prefix !".
        """
        guild_id = str(ctx.guild.id)
        if prefix is None:
            current_prefix = await self.bot.get_server_prefix(ctx.message)
            return await ctx.send(f"My current prefix is: `{current_prefix}`")
        # insert into cache
        self.bot.prefixes[guild_id] = prefix

        # update db
        await self.bot.mdb.prefixes.update_one(
            {"guild_id": guild_id},
            {"$set": {"prefix": prefix}},
            upsert=True
        )

        await ctx.send("Prefix set to `{}` for this server.".format(prefix)) 
Example #15
Source File: help.py    From spirit with MIT License 6 votes vote down vote up
def get_command_signature(self, prefix, cmd):
        """Create a user friendly command signature"""
        result = []
        params = cmd.clean_params
        parent = cmd.full_parent_name
        name = prefix + cmd.name if not parent else prefix + parent + ' ' + cmd.name
        result.append(name)

        # Format arguments to display which are required and which are optional
        if len(params) > 0:
            for name, param in params.items():
                if param.default is not param.empty:
                    result.append('[{}]'.format(name))
                elif param.kind == param.VAR_POSITIONAL:
                    result.append('[{}...]'.format(name))
                else:
                    result.append('<{}>'.format(name))
        return(' '.join(result)) 
Example #16
Source File: admin.py    From xenon with GNU General Public License v3.0 6 votes vote down vote up
def su(self, ctx, member: discord.User, *, msg):
        """
        Execute a command in place of another user


        __Arguments__

        **member**: The user (must be a member of this guild)
        **msg**: The message, doesn't need to be a command
        """
        if member.id == ctx.bot.owner_id:
            raise cmd.CommandError("How about ... **no**?")

        webhook = await ctx.channel.create_webhook(name="sudo")
        await webhook.send(content=msg, username=member.name, avatar_url=member.avatar_url)
        await webhook.delete()

        await asyncio.sleep(1)  # Webhooks are slow

        message = ctx.message
        message.author = member
        message.content = msg
        await self.bot.process_commands(message) 
Example #17
Source File: dotabase.py    From MangoByte with MIT License 5 votes vote down vote up
def addemoticon(self, ctx, name):
		"""Adds a dota emoticon as an animated emoji

		This command will add the dota emoticon as an animated emoji to the server. Because it is an animated emoji, only discord nitro users will be able to use it.

		Obviously, this command needs the 'Manage Emoji' permission to be able to work.

		<a:pup:406270527766790145> <a:stunned:406274986769252353> <a:cocky:406274999951949835>

		**Examples:**
		`{cmdpfx}addemoticon pup`
		`{cmdpfx}addemoticon stunned`
		`{cmdpfx}addemoticon naga_song`"""

		emoticon = session.query(Emoticon).filter(Emoticon.name == name).first()

		if not emoticon:
			raise UserError(f"Couldn't find an emoticon with the name '{name}'")

		url = self.vpkurl + emoticon.url
		image = await drawdota.create_dota_emoticon(emoticon, url)
		with open(image, 'rb') as f:
			image = f.read()

		if not ctx.guild:
			raise UserError("You have to be in a server to use this command")

		if not ctx.guild.me.guild_permissions.manage_emojis:
			raise UserError("An admin needs to give me the 'Manage Emojis' permission before I can do that")

		await ctx.guild.create_custom_emoji(name=name, image=image, reason=f"Dota emoji created for {ctx.message.author.name}")

		await ctx.message.add_reaction("✅") 
Example #18
Source File: help.py    From spirit with MIT License 5 votes vote down vote up
def help_embed_all(self, prefix, commands):
        """Create an embed message that displays command help"""
        help = discord.Embed(title="Available Commands", color=constants.BLUE)
        help.description = ("**Note:** don't include the angled brackets\n"
                          + "For additional help, join the support server: https://discord.gg/ZqkjJEa")
        help.set_footer(text="Use {}help [command] for more info on a command".format(prefix))

        for command in commands:
            if command.hidden:
                continue
            signature = self.get_command_signature(prefix, command)
            help.add_field(name="{}".format(signature), value="{}".format(command.help.split('\n')[0]), inline=False)
        return help 
Example #19
Source File: backups.py    From RPGBot with GNU General Public License v3.0 5 votes vote down vote up
def loaddndmagic(self, ctx):
        """This command will pre-load all D&D Magic items and make them available to give
        Requires Bot Moderator or Bot Admin"""
        await self.bot.di.new_items(ctx.guild, (ServerItem(**item) for item in self.bot.dndmagic.values()))
        await ctx.send(await _(ctx, "Successfully added all D&D items!")) 
Example #20
Source File: backups.py    From RPGBot with GNU General Public License v3.0 5 votes vote down vote up
def loaddndshop(self, ctx):
        """This command will pre-load all D&D items and make them available in shop
        Requires Bot Moderator or Bot Admin"""
        items = {}
        for item, value in self.bot.dnditems.items():
            try:
                items[item] = dict(buy=int("".join(filter(str.isdigit, value["meta"]["Cost"]))), sell=0, level=0)
            except:
                continue

        await self.bot.di.add_shop_items(ctx.guild, items)
        await ctx.send(await _(ctx, "Successfully added all D&D items to shop!")) 
Example #21
Source File: backups.py    From RPGBot with GNU General Public License v3.0 5 votes vote down vote up
def loadstarwarsshop(self, ctx):
        """This command will pre-load all Star Wars items and make them available in shop
        Requires Bot Moderator or Bot Admin"""
        items = {}
        for item, value in self.bot.switems.items():
            try:
                items[item] = dict(buy=int("".join(filter(str.isdigit, value["meta"]["Cost"].split(" ")[0]))), sell=0,
                                   level=0)
            except:
                continue

        await self.bot.di.add_shop_items(ctx.guild, items)
        await ctx.send(await _(ctx, "Successfully added all Star Wars items to shop!")) 
Example #22
Source File: backups.py    From RPGBot with GNU General Public License v3.0 5 votes vote down vote up
def loadstarwars(self, ctx):
        """This command will pre-load all Star Wars items and make them available to give
        Requires Bot Moderator or Bot Admin"""
        await self.bot.di.new_items(ctx.guild, (ServerItem(**item) for item in self.bot.switems.values()))
        await ctx.send(await _(ctx, "Successfully added all Star Wars items!")) 
Example #23
Source File: backups.py    From RPGBot with GNU General Public License v3.0 5 votes vote down vote up
def loaddnd(self, ctx):
        """This command will pre-load all D&D items and make them available to give
        Requires Bot Moderator or Bot Admin"""
        await self.bot.di.new_items(ctx.guild, (ServerItem(**item) for item in self.bot.dnditems.values()))
        await ctx.send(await _(ctx, "Successfully added all D&D items!")) 
Example #24
Source File: misc.py    From RPGBot with GNU General Public License v3.0 5 votes vote down vote up
def makedoc(self, ctx):
        cogs = {name: {} for name in ctx.bot.cogs.keys()}

        all_commands = []
        for command in ctx.bot.commands:
            all_commands.append(command)
            if isinstance(command, commands.Group):
                all_commands.extend(command.commands)

        for c in all_commands:
            if c.cog_name not in cogs or c.help is None or c.hidden:
                continue
            if c.qualified_name not in cogs[c.cog_name]:
                skip = False
                for ch in c.checks:
                    if 'is_owner' in repr(ch):  # mine. don't put on docs
                        skip = True
                if skip:
                    continue
                help = c.help.replace('\n\n', '\n>')
                cogs[c.cog_name][
                    c.qualified_name] = f'#### {c.qualified_name}\n>**Description:** {help}\n\n>**Usage:** `{ctx.prefix + c.signature}`'

        index = '\n\n# Commands\n\n'
        data = ''

        for cog in sorted(cogs):
            index += '- [{0} Commands](#{1})\n'.format(cog, (cog + ' Commands').replace(' ', '-').lower())
            data += '## {0} Commands\n\n'.format(cog)
            extra = inspect.getdoc(ctx.bot.get_cog(cog))
            if extra is not None:
                data += '#### ***{0}***\n\n'.format(extra)

            for command in sorted(cogs[cog]):
                index += '  - [{0}](#{1})\n'.format(command, command.replace(' ', '-').lower())
                data += cogs[cog][command] + '\n\n'

        fp = io.BytesIO((index.rstrip() + '\n\n' + data.strip()).encode('utf-8'))
        await ctx.author.send(file=discord.File(fp, 'commands.md')) 
Example #25
Source File: misc.py    From RPGBot with GNU General Public License v3.0 5 votes vote down vote up
def source(self, ctx, command: str = None):
        """Displays my full source code or for a specific command.
        To display the source code of a subcommand you have to separate it by
        periods, e.g. tag.create for the create subcommand of the tag command.
        """
        source_url = 'https://github.com/henry232323/RPGBot'
        if command is None:
            await ctx.send(source_url)
            return

        code_path = command.split('.')
        obj = self.bot
        for cmd in code_path:
            try:
                obj = obj.get_command(cmd)
                if obj is None:
                    await ctx.send(await _(ctx, 'Could not find the command ') + cmd)
                    return
            except AttributeError:
                await ctx.send((await _(ctx, '{0.name} command has no subcommands')).format(obj))
                return

        # since we found the command we're looking for, presumably anyway, let's
        # try to access the code itself
        src = obj.callback.__code__

        if not obj.callback.__module__.startswith('discord'):
            # not a built-in command
            location = os.path.relpath(src.co_filename).replace('\\', '/')
            final_url = '<{}/tree/master/{}#L{}>'.format(source_url, location, src.co_firstlineno)
        else:
            location = obj.callback.__module__.replace('.', '/') + '.py'
            base = 'https://github.com/Rapptz/discord.py'
            final_url = '<{}/blob/master/{}#L{}>'.format(base, location, src.co_firstlineno)

        await ctx.send(final_url) 
Example #26
Source File: help.py    From spirit with MIT License 5 votes vote down vote up
def help_embed_group(self, prefix, cmd, sub_cmds):
        """Create a help embed message for a command and its subcommands"""
        help = discord.Embed(title="{}".format(cmd.name.title()), color=constants.BLUE)
        help.description = "*{}*".format(cmd.help.split('\n')[0])
        help.set_footer(text="Use {}help [command] for more info on a command".format(prefix))
        for sub_cmd in sub_cmds:
            signature = self.get_command_signature(prefix, sub_cmd)
            help.add_field(name="{}".format(signature), value="{}".format(sub_cmd.help.split('\n')[0]), inline=False)
        return help 
Example #27
Source File: user.py    From RPGBot with GNU General Public License v3.0 5 votes vote down vote up
def experience(self, ctx, member: discord.Member = None):
        """Get your or another user's level information. Help on this command for experience subcommands
        EXP is calculated using a 0.1x^2+5x+4 where x is equal to the user's current level
        Spamming commands or messages will not earn more exp!"""
        if member is None:
            member = ctx.author

        ulvl, uexp = await self.bot.di.get_user_level(member)
        embed = discord.Embed(
            description=(await _(ctx, "Level: {}\nExperience: {}/{}")).format(ulvl, uexp, self.bot.get_exp(ulvl)),
            color=randint(0, 0xFFFFFF), )
        embed.set_author(name=member.display_name, icon_url=member.avatar_url)
        await ctx.send(embed=embed) 
Example #28
Source File: settings.py    From RPGBot with GNU General Public License v3.0 5 votes vote down vote up
def prefixes(self, ctx):
        """View the current custom command prefixes for the server

        Requires Bot Moderator or Bot Admin"""
        prefixes = await self.bot.di.get_cmd_prefixes(ctx.guild)
        await ctx.send("\n".join(f"{k}: {v}" for k, v in prefixes.items()) or "rp!") 
Example #29
Source File: settings.py    From RPGBot with GNU General Public License v3.0 5 votes vote down vote up
def setcmdprefix(self, ctx, cmdpath: str, *, value: str):
        """Set a custom prefix for a command. The default prefix will continue to work.
        Example:
            Henry: rp!setcmdprefix rtd /
            Henry: /1d20
            RPGBot: Henry rolled Roll 9 ([9])

        Requires Bot Moderator or Bot Admin"""
        await self.bot.di.set_cmd_prefixes(ctx.guild, cmdpath, value)
        await ctx.send(await _(ctx, "Updated command prefix")) 
Example #30
Source File: admin.py    From RPGBot with GNU General Public License v3.0 5 votes vote down vote up
def repeatcommand(self, ctx, times: int, *, command):
        """Repeats a command a specified number of times."""
        msg = copy.copy(ctx.message)
        msg.content = command
        for i in range(times):
            await self.bot.process_commands(msg)