Browse Source

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

tags/v2.0.0
Roxie Gibson 5 years ago
parent
commit
387d21b163
3 changed files with 166 additions and 27 deletions
  1. +129
    -2
      docs/commands.md
  2. +24
    -25
      roxbot/cogs/util.py
  3. +13
    -0
      roxbot/core.py

+ 129
- 2
docs/commands.md View File

@@ -10,6 +10,10 @@ date: 2018-10-27

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
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.

@@ -43,9 +47,38 @@ These are the base commands for Roxbot that are a part of the core bot. All of t
!!! warning
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



### ;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

!!! warning
@@ -387,6 +420,8 @@ Example:
!!! warning
This command will only work in channels marked NSFW or DMs.

Posts a random image from https://

### ;gelbooru

!!! warning
@@ -664,6 +699,10 @@ Command Structure:

`;trivia kick user`

Options:

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

Example:

```py
@@ -675,27 +714,115 @@ Example:

## Util

This cog is filled with a number of utility commands.

### ;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

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

!!! warning
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

### ;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

!!! warning
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

+ 24
- 25
roxbot/cogs/util.py View File

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

Example:
{command_prefix}avatar @RoxBot#4170
{command_prefix}avatar RoxBot
# Get my avatar
;avatar
# Get USER's avatar
;avatar USER#0001
"""
if not user:
user = ctx.author
@@ -59,13 +62,16 @@ class Util():
await ctx.send(file=discord.File(avaimg))
os.remove(avaimg)

@commands.command()
@commands.command(aliases=["user"])
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:
{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:
member = ctx.author
@@ -113,7 +119,7 @@ class Util():
@commands.guild_only()
@commands.command(aliases=["server"])
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_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)
@@ -150,7 +156,11 @@ class Util():
@commands.guild_only()
@commands.command()
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.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)
@@ -201,9 +211,11 @@ class Util():
@commands.command(aliases=["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:
if isinstance(emote, str):
@@ -225,19 +237,6 @@ class Util():
except IndexError:
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):
bot_client.add_cog(Util(bot_client))

+ 13
- 0
roxbot/core.py View File

@@ -434,6 +434,19 @@ class Core(ErrorHandling, Logging):
await ctx.send(":wave:")
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):
bot_client.add_cog(Core(bot_client))

Loading…
Cancel
Save