Compare commits
3 commits
065ff678a8
...
7f70c2afc8
Author | SHA1 | Date | |
---|---|---|---|
7f70c2afc8 | |||
0093c92a7e | |||
fac4fec25f |
2 changed files with 9 additions and 5 deletions
|
@ -79,7 +79,7 @@ class Nomen(Bot):
|
||||||
return prefix
|
return prefix
|
||||||
|
|
||||||
async def set_guild_prefix(self, guild: Guild, prefix):
|
async def set_guild_prefix(self, guild: Guild, prefix):
|
||||||
await self.db.execute("REPLACE INTO guilds (guild_id, prefix) VALUES(?, ?)", (guild.id, prefix))
|
await self.db.execute("UPDATE guilds SET prefix = ? WHERE guild_id=?", (prefix, guild.id))
|
||||||
self.prefixes[guild.id] = prefix
|
self.prefixes[guild.id] = prefix
|
||||||
|
|
||||||
async def start(self, *args, **kwargs):
|
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,))
|
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):
|
async def set_setting(self, user_id, setting, value: bool):
|
||||||
await self.db.execute(f"REPLACE INTO users (user_id, {setting}) VALUES(?, ?)", (user_id, value))
|
await self.db.execute(f"UPDATE users SET {setting} = ? WHERE user_id=?", (value, user_id))
|
||||||
await self.db.commit()
|
await self.db.commit()
|
||||||
|
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ async def admin_eval(ctx, *, body: str):
|
||||||
paginator.add_line(line)
|
paginator.add_line(line)
|
||||||
paginator.close_page()
|
paginator.close_page()
|
||||||
if ret:
|
if ret:
|
||||||
for line in str(ret).split("\n"):
|
for line in pprint.pformat(ret).split("\n"):
|
||||||
paginator.add_line(line)
|
paginator.add_line(line)
|
||||||
paginator.close_page()
|
paginator.close_page()
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,8 @@ You may want to `{ctx.clean_prefix}nomen export` first"""
|
||||||
}
|
}
|
||||||
|
|
||||||
notifications = self.bot.get_cog("Notifications")
|
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:
|
try:
|
||||||
await self.import_json(ctx, data)
|
await self.import_json(ctx, data)
|
||||||
|
@ -158,7 +160,8 @@ 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`"
|
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("REPLACE INTO users (user_id, disabled) VALUES(?, 1)", (ctx.author.id,))
|
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.commit()
|
await self.bot.db.commit()
|
||||||
|
|
||||||
@nomen.command(name="opt-in")
|
@nomen.command(name="opt-in")
|
||||||
|
@ -177,7 +180,8 @@ 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`"
|
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("REPLACE INTO users (user_id, disabled) VALUES(?, 0)", (ctx.author.id,))
|
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.commit()
|
await self.bot.db.commit()
|
||||||
|
|
||||||
@group(invoke_without_command=True)
|
@group(invoke_without_command=True)
|
||||||
|
|
Loading…
Reference in a new issue