This repository was archived by the owner on Jun 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbot.py
More file actions
99 lines (84 loc) · 2.38 KB
/
bot.py
File metadata and controls
99 lines (84 loc) · 2.38 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import discord, asyncio
from discord.ext import commands
from random import choice
from modules.database import trigger_emojis
import data
from loader import load_extensions
# GETS THE TOKENS
from dotenv import load_dotenv
import os
load_dotenv()
if input("Start as (DEBUG, RELEASE)? ").lower() == "release":
TOKEN = os.getenv("DISCORD_TOKEN")
print("Successfully set to release.")
else:
TOKEN = os.getenv("DISCORD_TOKEN_DEBUG")
print("Successfully set to debug.")
intents = discord.Intents(messages=True, guilds=True, members=True, reactions=True)
client = commands.Bot(command_prefix="cg.", case_insensitive=True, intents=intents)
client.remove_command("help")
loaded = load_extensions(client)
if "cogs.owner" not in loaded:
raise ImportError("Owner cog not loaded")
for file in loaded:
print(f"Loaded {file}")
async def status_task():
langs = (
"python",
"ruby",
"C++",
"C",
"C#",
"javascript",
"java",
"GO",
"R",
"perl",
"PHP",
"assembly",
"objective-c",
"haskell",
"lua",
"pascal",
"prolog",
"lisp",
"scala",
"scheme",
"TCL",
"D",
"R",
"ada",
"bash",
"elixir",
"kotlin",
"brainf***",
"fortran",
"rust",
"clojure",
"swift",
)
while True:
await client.change_presence(
activity=discord.Game(name="with " + choice(langs) + " codes!", type=0)
)
await asyncio.sleep(100)
await client.change_presence(
activity=discord.Activity(
type=discord.ActivityType.watching, name="for a ping!"
)
)
await asyncio.sleep(30)
@client.event
async def on_ready():
print(f"{client.user.name} has connected to Discord!")
client.loop.create_task(status_task())
@client.event
async def on_message(message):
if not message.author.bot:
if client.user in message.mentions:
await message.channel.send(
f"Trigger emoji in this guild is set to {await trigger_emojis.get(message.guild.id,'▶️')}\nBot Prefix: `cg.`"
)
else:
await client.process_commands(message)
client.run(TOKEN)