Selaa lähdekoodia

Added utils to docs and moved invite and echo to core.

tags/v2.0.0
Roxie Gibson 5 vuotta sitten
vanhempi
commit
387d21b163
3 muutettua tiedostoa jossa 166 lisäystä ja 27 poistoa
  1. +129
    -2
      docs/commands.md
  2. +24
    -25
      roxbot/cogs/util.py
  3. +13
    -0
      roxbot/core.py

+ 129
- 2
docs/commands.md Näytä tiedosto



Before reading this, it is highly recommened you read the [quick start](quickstart.md) guide that will get you upto date with how Roxbot works and how to run her. This is handy if you expect to use commands that will edit Roxbot or Roxbot's guild settings. Before reading this, it is highly recommened you read the [quick start](quickstart.md) guide that will get you upto date with how Roxbot works and how to run her. This is handy if you expect to use commands that will edit Roxbot or Roxbot's guild settings.


## How to use the docs

When the command wants a CHANNEL, USER, MEMBER, or ROLE. This means the ID, name, or mention of that part of Discord. Role, User, and Member mentions start with a '@' and Channel mentions start with a '#'. A Member is the same as a User except a Member is explicitly a User in a Guild.

## Core Commands ## Core Commands
These are the base commands for Roxbot that are a part of the core bot. All of them deal with internal management and are, for the most part, unavalible to average users. These are the base commands for Roxbot that are a part of the core bot. All of them deal with internal management and are, for the most part, unavalible to average users.


!!! warning !!! warning
This command can only be exectuted by the owner of the Roxbot instance. This command can only be exectuted by the owner of the Roxbot instance.



### ;echo

!!! warning
This command can only be exectuted by the owner of the Roxbot instance.

Echos the given string to a given channel.

Command Structure:

`;echo channel message`

Example:

```py
# Post the message "Hello World" to the channel #general
;echo #general Hello World
```

#### ;help #### ;help





### ;invite

Posts [this](https://discordapp.com/oauth2/authorize?client_id=259869304369971200&scope=bot&permissions=871890001) invite. This allows you to invite Roxbot to your own server.

Command Structure:

`;invite`


#### ;printsettings #### ;printsettings


!!! warning !!! warning
!!! warning !!! warning
This command will only work in channels marked NSFW or DMs. This command will only work in channels marked NSFW or DMs.


Posts a random image from https://

### ;gelbooru ### ;gelbooru


!!! warning !!! warning


`;trivia kick user` `;trivia kick user`


Options:

- `user` - A name, ID, or mention of a user.

Example: Example:


```py ```py


## Util ## Util


This cog is filled with a number of utility commands.

### ;avatar ### ;avatar


### ;echo
Uploads a downloadable picture of an avatar.

Command Structure:

`;avatar [user: optional]`

Options:

- `user` - OPTIONAL: A name, ID, or mention of a user. If provided, the command will return the user's avatar, if not, it will provide your own.

Example:

```py
# Get my avatar
;avatar
# Get USER's avatar
;avatar USER#0001
```



### ;emote ### ;emote


Displays infomation (creation date, guild, ID) and an easily downloadable version of the given custom emote.

Command Structure:

`;emote EMOTE`

Aliases:

`emoji`

Options:

- `emote` - Needs to be a valid custom emoji

Example:

```py
# Get infomation of the emoji ":Kappa:"
;emote :Kappa:
```

### ;guild ### ;guild


!!! warning !!! warning
This command cannot be used in private messages. This command cannot be used in private messages.


Gives information (creation date, owner, ID) on the guild this command is executed in.

Command Structure:

`;guild`

Aliases:

`server`


### ;info ### ;info


### ;invite
Provides information (account creation date, ID, roles [if in a guild]) on your or another persons account.

Command Structure:

`;info [USER: optional]`

Aliases:

`user`

Options:

- `USER` - OPTIONAL: A name, ID, or mention of a user.

Examples:

```py
# Get account information for yourself
;info
# Get account information for a user called USER
;info @USER
```


### ;role ### ;role


!!! warning !!! warning
This command cannot be used in private messages. This command cannot be used in private messages.


Gives information (creation date, colour, ID) on the role given. Can only work if the role is in the guild you execute this command in.

Command Structure:

`;role ROLE`

Options:

- `ROLE` - Name, ID, or mention of the role you want the info for.

Example:

```py
# Get information on the role called Admin
;role Admin
```

--- ---


## Voice ## Voice

+ 24
- 25
roxbot/cogs/util.py Näytä tiedosto

@commands.command() @commands.command()
async def avatar(self, ctx, *, user: discord.User = None): async def avatar(self, ctx, *, user: discord.User = None):
""" """
Returns a mentioned users avatar
Uploads a downloadable picture of an avatar.

Example: Example:
{command_prefix}avatar @RoxBot#4170
{command_prefix}avatar RoxBot
# Get my avatar
;avatar
# Get USER's avatar
;avatar USER#0001
""" """
if not user: if not user:
user = ctx.author user = ctx.author
await ctx.send(file=discord.File(avaimg)) await ctx.send(file=discord.File(avaimg))
os.remove(avaimg) os.remove(avaimg)


@commands.command()
@commands.command(aliases=["user"])
async def info(self, ctx, member: discord.Member = None): async def info(self, ctx, member: discord.Member = None):
""" """
Gets info for a mentioned user
Provides information (account creation date, ID, roles [if in a guild]) on your or another persons account.

Example: Example:
{command_prefix}info @RoxBot#4170
{command_prefix}info RoxBot
# Get account information for yourself
;info
# Get account information for a user called USER
;info @USER
""" """
if not member: if not member:
member = ctx.author member = ctx.author
@commands.guild_only() @commands.guild_only()
@commands.command(aliases=["server"]) @commands.command(aliases=["server"])
async def guild(self, ctx): async def guild(self, ctx):
"""Returns info on the current guild(server)."""
"""Gives information (creation date, owner, ID) on the guild this command is executed in."""
guild = ctx.guild guild = ctx.guild
guild_icon_url = "https://cdn.discordapp.com/icons/{}/{}.png".format(guild.id, guild.icon) guild_icon_url = "https://cdn.discordapp.com/icons/{}/{}.png".format(guild.id, guild.icon)
guild_splash_url = "https:/cdn.discordapp.com/splashes/{}/{}.png".format(guild.id, guild.splash) guild_splash_url = "https:/cdn.discordapp.com/splashes/{}/{}.png".format(guild.id, guild.splash)
@commands.guild_only() @commands.guild_only()
@commands.command() @commands.command()
async def role(self, ctx, *, role: discord.Role): async def role(self, ctx, *, role: discord.Role):
"""Displays the info on a role"""
"""Gives information (creation date, colour, ID) on the role given. Can only work if the role is in the guild you execute this command in.
Examples:
# Get information on the role called Admin
;role Admin
"""
embed = discord.Embed(title="Role '{}'".format(role.name), colour=role.colour.value) embed = discord.Embed(title="Role '{}'".format(role.name), colour=role.colour.value)
embed.add_field(name="ID", value=role.id, inline=False) embed.add_field(name="ID", value=role.id, inline=False)
embed.add_field(name="Created at", value="{:%a %Y/%m/%d %H:%M:%S} UTC".format(discord.utils.snowflake_time(role.id)), inline=False) embed.add_field(name="Created at", value="{:%a %Y/%m/%d %H:%M:%S} UTC".format(discord.utils.snowflake_time(role.id)), inline=False)
@commands.command(aliases=["emoji"]) @commands.command(aliases=["emoji"])
async def emote(self, ctx, emote: roxbot.converters.Emoji): async def emote(self, ctx, emote: roxbot.converters.Emoji):
""" """
Displays info on the given emote.
Usage:
;emote [emote]
Displays infomation (creation date, guild, ID) and an easily downloadable version of the given custom emote.

Example:
# Get infomation of the emoji ":Kappa:"
;emote :Kappa:
""" """
try: try:
if isinstance(emote, str): if isinstance(emote, str):
except IndexError: except IndexError:
return await ctx.send("This command only supports custom emojis at the moment. Sorry.") return await ctx.send("This command only supports custom emojis at the moment. Sorry.")


@commands.command()
async def invite(self, ctx):
"""Returns an invite link to invite the bot to your server."""
link = discord.utils.oauth_url(self.bot.user.id, discord.Permissions.all_channel())
return await ctx.send("Invite me to your server! <{}>".format(link))

@commands.command()
@commands.is_owner()
async def echo(self, ctx, channel: discord.TextChannel, *, message: str):
"""Repeats after you, Roxie."""
await channel.send(message)
return await ctx.send(":point_left:")



def setup(bot_client): def setup(bot_client):
bot_client.add_cog(Util(bot_client)) bot_client.add_cog(Util(bot_client))

+ 13
- 0
roxbot/core.py Näytä tiedosto

await ctx.send(":wave:") await ctx.send(":wave:")
await self.bot.logout() await self.bot.logout()


@commands.command()
async def invite(self, ctx):
"""Returns an invite link to invite the bot to your server."""
link = discord.utils.oauth_url(self.bot.user.id, discord.Permissions.all_channel())
return await ctx.send("Invite me to your server! <{}>".format(link))

@commands.command()
@commands.is_owner()
async def echo(self, ctx, channel: discord.TextChannel, *, message: str):
"""Repeats after you, Roxie."""
await channel.send(message)
return await ctx.send(":point_left:")



def setup(bot_client): def setup(bot_client):
bot_client.add_cog(Core(bot_client)) bot_client.add_cog(Core(bot_client))

Loading…
Peruuta
Tallenna