Small fixes

This commit is contained in:
klemek
2020-11-06 20:48:09 +01:00
parent b501efd945
commit a862df2cb3
2 changed files with 19 additions and 16 deletions
+13 -10
View File
@@ -10,6 +10,7 @@
from miniscord import Bot
import discord
async def hello(client: discord.client, message: discord.Message):
await message.channel.send("Hello!")
@@ -22,12 +23,12 @@ bot.register_command(
"hello", # command text (regex)
hello, # command function
"hello: says 'Hello!'", # short help
f"```\n" # long help
f"* |help\n"
f"\tSays 'Hello!'.\n"
f"```"
"```\n" # long help
"* |help\n"
"\tSays 'Hello!'.\n"
"```"
)
bot.start() # this bot respond to "|help", "|info" and "|hello"
bot.start() # this bot respond to "|help", "|info" and "|hello"
```
![](./sample.jpg)
@@ -275,9 +276,10 @@ async def hello(client: discord.client, message: discord.Message, *args: str):
'''
if len(args) > 1:
await message.channel.send(f"Hello {args[1]}!")
else :
else:
await message.channel.send("Hello stranger!")
async def mention(client: discord.client, message: discord.Message, *args: str):
channels[channel_id(message)] += 1
senders[sender_id(message)] += 1
@@ -286,6 +288,7 @@ async def mention(client: discord.client, message: discord.Message, *args: str):
f"{channels[channel_id(message)]} mentions on this channel so far"
)
async def message(client: discord.client, message: discord.Message):
if "catapult" in message.content:
sent_msg = await message.channel.send(f"{message.author.mention} No profanity on this server")
@@ -304,10 +307,10 @@ bot.register_command(
"hello", # command text (regex)
hello, # command function
"hello: says 'Hello!'", # short help
f"```\n" # long help
f"* |help\n"
f"\tSays 'Hello!'.\n"
f"```"
"```\n" # long help
"* |help\n"
"\tSays 'Hello!'.\n"
"```"
)
bot.register_fallback(mention) # the bot was mentioned or the alias was used