from aiomysql import Pool, DictCursor
from basa.db import db_pool
class dbsql():
pool: Pool = db_pool
async def register(self):
async with self.pool.acquire() as conn:
async with conn.cursor() as cur:
result = await cur.execute("SELECT * FROM profile WHERE uid")
row = await cur.fetchall()
if result == 0:
await cur.execute(f'INSERT INTO profile(uid) VALUES(uid)')
else:
return await row
main = dbsql()
import requests
url = "https://series.naver.com/comic/recentList.series?page="
pagination_last_index = 1
while True:
r1 = requests.get(url + str(pagination_last_index))
r2 = requests.get(url + str(pagination_last_index + 1))
if r1.text == r2.text:
print(pagination_last_index)
break
pagination_last_index += 1
@commands.Cog.listener()
async def on_guild_join(self, guild):
cli = self.client
ctx = cli.get_context
await ctx.create_text_channel("announcements-and-suggestions")
await ctx.create_text_channel("log")
general = find(lambda x: x.name == 'announcements-and-suggestions', guild.text_channels)
if general and general.permissions_for(guild.me).send_messages:
await ctx.send(f"Hello {guild.name}! I am {self.client.user.display_name}. Thank you for inviting me.\n\nTo see what commands I have available type `r?help`.\nIf you want to see my available AutoResponse Triggers type `gethelp`.")