This repository has been archived by the owner on Nov 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
65 lines (57 loc) · 2.81 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
async def main():
activity_name = "Bread 🍞"
from disnake.ext import commands
from disnake import Status, Activity, ActivityType, Intents, utils, Message, Embed
from datetime import datetime, timezone
import sqlite3
import logging
intents = Intents.default()
intents.message_content = True
intents.members = True
intents.guilds = True
bot = commands.Bot(command_prefix="dsfgdsdfg", intents=intents)
bot.sqlite_connection = sqlite3.connect("database.db")
bot.sqlite_cursor = bot.sqlite_connection.cursor()
bot.sqlite_cursor.execute("CREATE TABLE IF NOT EXISTS Admins (id INTEGER PRIMARY KEY UNIQUE)")
bot.sqlite_cursor.execute("CREATE TABLE IF NOT EXISTS Config (log INTEGER, role INTEGER, freddie INTEGER)")
bot.sqlite_cursor.execute("SELECT * FROM Config")
config = bot.sqlite_cursor.fetchall()
if len(config) < 1:
bot.sqlite_cursor.execute("INSERT INTO Config (log, role, freddie) VALUES (?, ?, ?)", (0, 0, 0))
try:
bot.sqlite_cursor.execute("INSERT INTO Admins (id) VALUES (?)", (855948446540496896,))
except sqlite3.IntegrityError:
pass
bot.sqlite_connection.commit()
@bot.event
async def on_ready():
print("ready")
await bot.wait_until_ready()
await bot.change_presence(status=Status.idle)
origins = bot.get_guild(826685546772168734).get_channel(1161528232965836931)
council = bot.get_guild(1166799644362276967).get_channel(1282534413430689963)
for message in await origins.history().flatten():
if message.author.id == bot.user.id:
await message.delete()
for message in await council.history().flatten():
if message.author.id == bot.user.id:
await message.delete()
@bot.event
async def on_message(message:Message):
if message.channel.id == 1166799644970467411 and not message.author.bot:
delta_time = datetime.now(timezone.utc) - message.author.joined_at
if delta_time.days < 8:
reply = await message.reply(embed=Embed(title="You don't meet requirements!", description=f"You must have been in this server for 7 days. you have been in for {delta_time.days} days"))
await sleep(5)
try:
await message.delete()
await reply.delete()
except Exception:
await reply.edit(embed=Embed(title="You don't meet requirements!", description=f"You must have been in this server for 7 days. you have been in for {delta_time.days} days\n-# Failed to delete message chain"))
bot.reload = True
bot.load_extensions("plugins/")
TOKEN = open("token.txt", 'r').read()
await bot.start(TOKEN)
if __name__ == "__main__":
from asyncio import run, sleep
run(main())