@commands.Cog.listener()
async def on_ready(self, amount=1):
self.guild = await self.bot.fetch_guild(970690442553327706)
self.mutedrole = discord.utils.get(self.guild.roles, name='mute')
self.check_mutes.start()
print("Logged on as BearBot")
await self.bot.change_presence(status=discord.Status.online, activity=discord.Streaming(name=f'*help', url='http://mihutka.ml'))
channel = self.bot.get_channel(979456916713504869)
button6 = Button(label="Verify", style=discord.ButtonStyle.primary)
await channel.purge(limit = amount)
view=View()
view.add_item(button6)
emb = discord.Embed( title = f'Нажми на кнопку ниже чтобы получить роль', description = 'Нажимая на данныю кнопку вы подтвержаете что ознакомлены со всеми правилами', colour = discord.Color.blue())
await channel.send (embed=emb, view=view)
global base, cur
base = sqlite3.connect('cogs/Warn.db')
cur = base.cursor()
if base:
print('Database подключен')
@commands.Cog.listener()
async def on_button_click(self, interaction):
emb4 = discord.Embed( title = f'Верефикация пройдена успешно', colour = discord.Color.blue() )
await interaction.response.send_message(embed=emb4, ephemeral = True)
verify = discord.utils.get(self.guild.roles, name='verify')
await interaction.user.add_roles( verify )
@commands.Cog.listener()
async def on_message(self, message):
if not message.author.bot:
if not message.content.startswith('*'):
base = sqlite3.connect('cogs/Warn.db')
cur = base.cursor()
base.execute('CREATE TABLE IF NOT EXISTS users(userid INT, count INT)')
base.commit()
messages = cur.execute(f'SELECT userid FROM users WHERE userid == {message.author.id}').fetchone()
if messages == None:
cur.execute(f"INSERT INTO users VALUES ({message.author.id}, 1)")
base.commit()
else:
cur.execute(f"SELECT * FROM users WHERE userid={message.author.id}")
if len(message.content) >= 1:
cur.execute(f"UPDATE users SET count = count + 1 WHERE userid={message.author.id}")
base.commit()