Skip to content

Commit

Permalink
0.10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Pythonic-Rainbow committed Jul 3, 2021
1 parent f42abd3 commit bea22b6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 34 deletions.
19 changes: 5 additions & 14 deletions DimBot.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
intent.guilds = intent.members = intent.messages = intent.reactions = intent.voice_states = intent.typing = True
intent.presences = True
bot = missile.Bot(intents=intent)
nickname = f"DimBot {'S ' if dimsecret.debug else ''}| 0.10"
nickname = f"DimBot {'S ' if dimsecret.debug else ''}| 0.10.1"
logger = missile.get_logger('DimBot')
sponsor_txt = '世界の未来はあなたの手の中にあります <https://streamlabs.com/pythonic_rainbow/tip> <https://www.patreon.com/ChingDim>'
reborn_channel = None
Expand Down Expand Up @@ -145,7 +145,7 @@ async def botinfo(ctx):
embed.add_field('Uptime', datetime.now() - bot.boot_time)
embed.add_field('Python', python_version())
embed.add_field('Discord.py', discord.__version__)
embed.add_field('Codename', '')
embed.add_field('Codename', 'みずはら')
embed.add_field('Devblog', '[Instagram](https://www.instagram.com/techdim)')
embed.add_field('Source code', '[GitHub](https://github.com/TCLRainbow/DimBot)')
embed.add_field('Discord server', '[6PjhjCD](https://discord.gg/6PjhjCD)')
Expand Down Expand Up @@ -449,18 +449,9 @@ async def modrole(ctx: commands.Context, role: discord.Role):
async def changelog(ctx):
"""Shows the latest release notes of DimBot"""
await ctx.reply("""
**__0.10 (Jul 3, 2021 2:45PM GMT+8)__ The UI update**
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.
The development began with a database interconnect rewrite, which not only supports concurrent access,
but also an easier way to code SQL.
Followed by the addition of `d.xp` commands, I've stored over 1000 entries of xp records, before the 128BB incident.
Next, the UI of the entire help & quote commands, as well as `xp lb` are redesigned to be menu-driven, allowing users to
access the commands in a much easier fashion.
In the near future, I am focusing on resolving GitHub issues, which are basically features to be added. A major goal is
to make Aegis much more configurable.
**__0.10.1 (Jul 3, 2021 8:33PM GMT+8)__**
You can now mention others as well as having multiple lines in quote message.
You can now mention others as a Quoter (but not quoter group).
""")


Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@ The following are the variables that should be in the file:
`Barbados` is the codename given to the discord.py implementation of DimBot.
|Name|Represents|English|
|------|-----------|---------|
|みずはら|0.10|Mizuhara|
||0.9|Bbwaelp|
|ζ|0.8|Zeta|
|ζ|0.8|Zeta|

# Icon links
Not sure why, but I'll still document this. https://imgur.com/a/9h6DyhE
25 changes: 15 additions & 10 deletions echo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,19 @@ def split_quoter(quoter: str):
return quoter[0], quoter[1] if len(quoter) > 1 else None


async def verify_quoter(ctx, quoter, quoter_group):
if quoter_group:
if '<@' in quoter_group:
await ctx.reply('You can only mention a user as a quoter, but not a quoter group.')
raise commands.errors.CheckFailure
if '\n' in quoter or '\n' in quoter_group:
await ctx.reply('Quoter must be single line!')
raise commands.errors.CheckFailure


class Bottas(commands.Cog):
"""Storing messages.
Version 3.2"""
Version 3.2.1"""

def __init__(self, bot):
self.bot = bot
Expand Down Expand Up @@ -66,8 +76,6 @@ async def quote_add(self, ctx: commands.Context, *, quote):
"""d.quote a <quote>
quote: The new quote to be added
"""
# Quote message validation
await missile.check_arg(ctx, quote)
# Check if a quote with the same content already exists in the database
rowid = await self.bot.sql.quote_msg_exists(self.bot.db, msg=quote)
if rowid:
Expand All @@ -76,9 +84,8 @@ async def quote_add(self, ctx: commands.Context, *, quote):
# Asks for the quoter who said the quote
quoter = await self.bot.ask_msg(ctx, 'Quoter?')
if quoter:
# Quote message validation
await missile.check_arg(ctx, quoter)
quoter, quoter_group = split_quoter(quoter)
await verify_quoter(ctx, quoter, quoter_group) # Quoter validation
# Determines the ROWID to be used for inserting the quote
rowid = await self.bot.sql.get_next_row_id(self.bot.db)
if rowid: # Use ROWID from QuoteRowID if available. These IDs exist when a quote was deleted
Expand Down Expand Up @@ -136,14 +143,12 @@ async def edit(self, ctx: commands.Context, index: int):
if quote and (quote[2] == ctx.author.id or ctx.author.id == self.bot.owner_id):
quote = Quote(index, *quote)
content = await self.bot.ask_msg(ctx, 'Enter the new quote: (wait 10 seconds if it is the same)')
if content: # Quote message validation
await missile.check_arg(ctx, content)
else:
if not content:
content = quote.msg
quoter = await self.bot.ask_msg(ctx, "Enter new quoter: (wait 10 seconds if it is the same)")
if quoter: # Quoter validation
await missile.check_arg(ctx, quoter)
if quoter:
quoter, quoter_group = split_quoter(quoter)
await verify_quoter(ctx, quoter, quoter_group) # Quoter validation
else:
quoter = quote.quoter
quoter_group = quote.quoter_group
Expand Down
10 changes: 1 addition & 9 deletions missile.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def decode(text: str) -> str:
decoded: bytes = base64.b64decode(b)
return decoded.decode()


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

Expand Down Expand Up @@ -152,15 +153,6 @@ async def no_guild():
return commands.check(check)


async def check_arg(ctx, arg: str, user_mention=True, newline=True):
if user_mention and '<@' in arg:
await ctx.reply("You can't mention others!")
raise commands.errors.CheckFailure
if newline and '\n' in arg:
await ctx.reply('It should only be a single line!')
raise commands.errors.CheckFailure


class Bot(commands.Bot):

def __init__(self, **options):
Expand Down

0 comments on commit bea22b6

Please sign in to comment.