Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Commit

Permalink
Updated mentions of /setworld to new /settings command
Browse files Browse the repository at this point in the history
- If the server owner has disabled PMs when the bot joins, send a message in the server instead.
- Bumped to version 1.2.1
  • Loading branch information
Galarzaa90 committed Jun 14, 2018
1 parent 6f1b3ba commit 1d84222
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Changelog
## Version 1.2.1 (2018-06-14)
- Updated mentions of `/setworld` and similar to `/settings world`.
- If the server owner has PMs disabled when the bot joins, the bot will send the initial message in the server.

## Version 1.2.0 (2018-06-14)
- New `/help` style, with reaction pagination.
Expand Down
8 changes: 4 additions & 4 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ Depending on your privacy settings, you (or the owner of the server) should have
## Initial configuration
In order for the bot to have access to most of its features, you must configure the world the server tracks.

Use the command `/setworld`, for example: `/setworld Fidera`. Then the bot will ask for confirmation.
Once accepted, users can start registering their chars using `\im charName`
Use the command [settings world](commands/settings.md#settings-world), for example: `/settings world Gladera`. Then the bot will ask for confirmation.
Once accepted, users can start registering their chars using `\im charName`.

By default, events, level ups and deaths announcements are made on the highest channel available for the bot.
In order to customize this, you can use the following commands: `/seteventchannel` and `/setleveldeathchannel`.
In order to customize this, you can use the following commands: `/settings levelschannel`.

The bot usually shortens command replies on public channels to reduce spam a bit.
Commands used via DM display more information.
Expand All @@ -63,4 +63,4 @@ The bot will give longer responses here and it will delete any message that is n
Additionally, you can create a channel named **#server-log**. Whenever a user registers characters, they will be shown here, along with their levels and guilds.
Other changes are shown here, such as users leaving, getting banned, changing display names and more.

Further customization can be done by editing the `config.yml` file. More information [here](customizing/config.md).
Further customization can be done on a per-server basis by using the command [settings](commands/settings.md#settings).
19 changes: 13 additions & 6 deletions nabbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self):
# A list version is created from the dictionary
self.tracked_worlds = {}
self.tracked_worlds_list = []
self.__version__ = "1.2.0"
self.__version__ = "1.2.1"

async def on_ready(self):
"""Called when the bot is ready."""
Expand Down Expand Up @@ -112,19 +112,26 @@ async def on_command_error(self, ctx: context.NabCtx, error):
async def on_guild_join(self, guild: discord.Guild):
"""Called when the bot joins a guild (server)."""
log.info("Nab Bot added to server: {0.name} (ID: {0.id})".format(guild))
message = "Hello! I'm now in **{0.name}**. To see my available commands, type \help\n" \
"I will reply to commands from any channel I can see, but if you create a channel called *{1}*," \
message = "Hello! I'm now in **{0.name}**. To see my available commands, type `{3}help`\n" \
"I will reply to commands from any channel I can see, but if you create a channel called *{1}*, " \
"I will give longer replies and more information there.\n" \
"If you want a server log channel, create a channel called *{2}*, I will post logs in there." \
"You might want to make it private though.\n" \
"To have all of Nab Bot's features, use `/setworld <tibia_world>`"
formatted_message = message.format(guild, config.ask_channel_name, config.log_channel_name)
await guild.owner.send(formatted_message)
"To tweak NabBot settings, use `{3}settings` in your server."
formatted_message = message.format(guild, config.ask_channel_name, config.log_channel_name,
config.command_prefix[0])
for member in guild.members:
if member.id in self.members:
self.members[member.id].append(guild.id)
else:
self.members[member.id] = [guild.id]
try:
await guild.owner.send(formatted_message)
except discord.Forbidden:
# Owner doesn't allow PMs
top_channel = self.get_top_channel(guild, True)
if top_channel is not None:
await top_channel.send(formatted_message)

async def on_guild_remove(self, guild: discord.Guild):
"""Called when the bot leaves a guild (server)."""
Expand Down

0 comments on commit 1d84222

Please sign in to comment.