Skip to content

Commit bea22b6

Browse files
0.10.1
1 parent f42abd3 commit bea22b6

File tree

4 files changed

+26
-34
lines changed

4 files changed

+26
-34
lines changed

DimBot.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
intent.guilds = intent.members = intent.messages = intent.reactions = intent.voice_states = intent.typing = True
2727
intent.presences = True
2828
bot = missile.Bot(intents=intent)
29-
nickname = f"DimBot {'S ' if dimsecret.debug else ''}| 0.10"
29+
nickname = f"DimBot {'S ' if dimsecret.debug else ''}| 0.10.1"
3030
logger = missile.get_logger('DimBot')
3131
sponsor_txt = '世界の未来はあなたの手の中にあります <https://streamlabs.com/pythonic_rainbow/tip> <https://www.patreon.com/ChingDim>'
3232
reborn_channel = None
@@ -145,7 +145,7 @@ async def botinfo(ctx):
145145
embed.add_field('Uptime', datetime.now() - bot.boot_time)
146146
embed.add_field('Python', python_version())
147147
embed.add_field('Discord.py', discord.__version__)
148-
embed.add_field('Codename', '')
148+
embed.add_field('Codename', 'みずはら')
149149
embed.add_field('Devblog', '[Instagram](https://www.instagram.com/techdim)')
150150
embed.add_field('Source code', '[GitHub](https://github.com/TCLRainbow/DimBot)')
151151
embed.add_field('Discord server', '[6PjhjCD](https://discord.gg/6PjhjCD)')
@@ -449,18 +449,9 @@ async def modrole(ctx: commands.Context, role: discord.Role):
449449
async def changelog(ctx):
450450
"""Shows the latest release notes of DimBot"""
451451
await ctx.reply("""
452-
**__0.10 (Jul 3, 2021 2:45PM GMT+8)__ The UI update**
453-
454-
After 2 months of somewhat relaxing development, I am pleased to announce v0.10, with 29 modified files, 2236 new lines and 1068 deleted lines.
455-
456-
The development began with a database interconnect rewrite, which not only supports concurrent access,
457-
but also an easier way to code SQL.
458-
Followed by the addition of `d.xp` commands, I've stored over 1000 entries of xp records, before the 128BB incident.
459-
Next, the UI of the entire help & quote commands, as well as `xp lb` are redesigned to be menu-driven, allowing users to
460-
access the commands in a much easier fashion.
461-
462-
In the near future, I am focusing on resolving GitHub issues, which are basically features to be added. A major goal is
463-
to make Aegis much more configurable.
452+
**__0.10.1 (Jul 3, 2021 8:33PM GMT+8)__**
453+
You can now mention others as well as having multiple lines in quote message.
454+
You can now mention others as a Quoter (but not quoter group).
464455
""")
465456

466457

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,9 @@ The following are the variables that should be in the file:
2222
`Barbados` is the codename given to the discord.py implementation of DimBot.
2323
|Name|Represents|English|
2424
|------|-----------|---------|
25+
|みずはら|0.10|Mizuhara|
2526
||0.9|Bbwaelp|
26-
|ζ|0.8|Zeta|
27+
|ζ|0.8|Zeta|
28+
29+
# Icon links
30+
Not sure why, but I'll still document this. https://imgur.com/a/9h6DyhE

echo.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,19 @@ def split_quoter(quoter: str):
1313
return quoter[0], quoter[1] if len(quoter) > 1 else None
1414

1515

16+
async def verify_quoter(ctx, quoter, quoter_group):
17+
if quoter_group:
18+
if '<@' in quoter_group:
19+
await ctx.reply('You can only mention a user as a quoter, but not a quoter group.')
20+
raise commands.errors.CheckFailure
21+
if '\n' in quoter or '\n' in quoter_group:
22+
await ctx.reply('Quoter must be single line!')
23+
raise commands.errors.CheckFailure
24+
25+
1626
class Bottas(commands.Cog):
1727
"""Storing messages.
18-
Version 3.2"""
28+
Version 3.2.1"""
1929

2030
def __init__(self, bot):
2131
self.bot = bot
@@ -66,8 +76,6 @@ async def quote_add(self, ctx: commands.Context, *, quote):
6676
"""d.quote a <quote>
6777
quote: The new quote to be added
6878
"""
69-
# Quote message validation
70-
await missile.check_arg(ctx, quote)
7179
# Check if a quote with the same content already exists in the database
7280
rowid = await self.bot.sql.quote_msg_exists(self.bot.db, msg=quote)
7381
if rowid:
@@ -76,9 +84,8 @@ async def quote_add(self, ctx: commands.Context, *, quote):
7684
# Asks for the quoter who said the quote
7785
quoter = await self.bot.ask_msg(ctx, 'Quoter?')
7886
if quoter:
79-
# Quote message validation
80-
await missile.check_arg(ctx, quoter)
8187
quoter, quoter_group = split_quoter(quoter)
88+
await verify_quoter(ctx, quoter, quoter_group) # Quoter validation
8289
# Determines the ROWID to be used for inserting the quote
8390
rowid = await self.bot.sql.get_next_row_id(self.bot.db)
8491
if rowid: # Use ROWID from QuoteRowID if available. These IDs exist when a quote was deleted
@@ -136,14 +143,12 @@ async def edit(self, ctx: commands.Context, index: int):
136143
if quote and (quote[2] == ctx.author.id or ctx.author.id == self.bot.owner_id):
137144
quote = Quote(index, *quote)
138145
content = await self.bot.ask_msg(ctx, 'Enter the new quote: (wait 10 seconds if it is the same)')
139-
if content: # Quote message validation
140-
await missile.check_arg(ctx, content)
141-
else:
146+
if not content:
142147
content = quote.msg
143148
quoter = await self.bot.ask_msg(ctx, "Enter new quoter: (wait 10 seconds if it is the same)")
144-
if quoter: # Quoter validation
145-
await missile.check_arg(ctx, quoter)
149+
if quoter:
146150
quoter, quoter_group = split_quoter(quoter)
151+
await verify_quoter(ctx, quoter, quoter_group) # Quoter validation
147152
else:
148153
quoter = quote.quoter
149154
quoter_group = quote.quoter_group

missile.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def decode(text: str) -> str:
4242
decoded: bytes = base64.b64decode(b)
4343
return decoded.decode()
4444

45+
4546
async def append_msg(msg: discord.Message, content: str, delimiter: str = '\n'):
4647
await msg.edit(content=f'{msg.content}{delimiter}{content}')
4748

@@ -152,15 +153,6 @@ async def no_guild():
152153
return commands.check(check)
153154

154155

155-
async def check_arg(ctx, arg: str, user_mention=True, newline=True):
156-
if user_mention and '<@' in arg:
157-
await ctx.reply("You can't mention others!")
158-
raise commands.errors.CheckFailure
159-
if newline and '\n' in arg:
160-
await ctx.reply('It should only be a single line!')
161-
raise commands.errors.CheckFailure
162-
163-
164156
class Bot(commands.Bot):
165157

166158
def __init__(self, **options):

0 commit comments

Comments
 (0)