Compare commits

..

No commits in common. "7f70c2afc86b41783c3fcb776eca9c90c349fff5" and "065ff678a86379b1667fe5a3a32d10ca76024c2e" have entirely different histories.

2 changed files with 5 additions and 9 deletions

View file

@ -79,7 +79,7 @@ class Nomen(Bot):
return prefix
async def set_guild_prefix(self, guild: Guild, prefix):
await self.db.execute("UPDATE guilds SET prefix = ? WHERE guild_id=?", (prefix, guild.id))
await self.db.execute("REPLACE INTO guilds (guild_id, prefix) VALUES(?, ?)", (guild.id, prefix))
self.prefixes[guild.id] = prefix
async def start(self, *args, **kwargs):
@ -94,7 +94,7 @@ class Nomen(Bot):
return await self.db.fetch_singleton(f"SELECT {setting} FROM users WHERE user_id=?", (user_id,))
async def set_setting(self, user_id, setting, value: bool):
await self.db.execute(f"UPDATE users SET {setting} = ? WHERE user_id=?", (value, user_id))
await self.db.execute(f"REPLACE INTO users (user_id, {setting}) VALUES(?, ?)", (user_id, value))
await self.db.commit()
@ -256,7 +256,7 @@ async def admin_eval(ctx, *, body: str):
paginator.add_line(line)
paginator.close_page()
if ret:
for line in pprint.pformat(ret).split("\n"):
for line in str(ret).split("\n"):
paginator.add_line(line)
paginator.close_page()

View file

@ -121,8 +121,6 @@ You may want to `{ctx.clean_prefix}nomen export` first"""
}
notifications = self.bot.get_cog("Notifications")
await ctx.bot.db.execute("INSERT OR IGNORE INTO users (user_id) VALUES(?)", (ctx.author.id,))
await ctx.bot.db.commit()
try:
await self.import_json(ctx, data)
@ -160,8 +158,7 @@ You may want to `{ctx.clean_prefix}nomen export` first"""
f"You have now opted-out and will no longer trigger or receive notifications. To opt back in, run `{ctx.clean_prefix}nomen opt-in`"
)
await self.bot.db.execute("INSERT OR IGNORE INTO users (user_id) VALUES(?)", (ctx.author.id,))
await self.bot.db.execute("UPDATE users SET disabled=1 WHERE user_id=?", (ctx.author.id,))
await self.bot.db.execute("REPLACE INTO users (user_id, disabled) VALUES(?, 1)", (ctx.author.id,))
await self.bot.db.commit()
@nomen.command(name="opt-in")
@ -180,8 +177,7 @@ You may want to `{ctx.clean_prefix}nomen export` first"""
f"You have opted back in and will now trigger and receive notifications. To opt out, run `{ctx.clean_prefix}nomen opt-out`"
)
await self.bot.db.execute("INSERT OR IGNORE INTO users (user_id) VALUES(?)", (ctx.author.id,))
await self.bot.db.execute("UPDATE users SET disabled=0 WHERE user_id=?", (ctx.author.id,))
await self.bot.db.execute("REPLACE INTO users (user_id, disabled) VALUES(?, 0)", (ctx.author.id,))
await self.bot.db.commit()
@group(invoke_without_command=True)