-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
319 lines (272 loc) · 11.8 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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
import discord
from datetime import datetime as dt
import pytz
from discord.ext import commands, tasks
import discord.utils
from discord.utils import get
import random
import os.path
import pickle
import Database
from discord_slash import SlashCommand, SlashContext
import os
import asyncio
import EmbedsGen
TOKEN = pickle.load(open("Token.p", "rb"))
AwesomePlaylistUrl = "https://open.spotify.com/playlist/48zKTHYlstmgrRZSbRPIaY?si=097fa6be533d4f8e"
ReplyDict = {1: "Aller Anfang ist schwer.",
2: "Doppelt Gemoppelt hält besser",
3: "Aller guten Dinge sind 3.",
4: "4 me!",
5: "High Five",
6: ";)",
10: "Zehn zahme Ziegen ziehen Zehn Zuckerzuber zum Zoo!"
}
ReplyPicDict = {69: "69.gif",
420: "420.gif"}
WordDict = {}
CountList = ["naja", "tho", "lol", "fdp", "nice", "fuck", "ahhh", "hurensohn", "arcane", "genshin impact", "kino"]
Fucking = False
random.seed()
Prefix = "LMAO!"
src = "xD/"
intents = discord.Intents().all()
client = commands.Bot(command_prefix=Prefix, description="Verkündet den wichtigsten Tag.", intents=intents)
slash = SlashCommand(client, sync_commands=True)
Vahlo = client.get_user(563044022835347492)
VahloID = 563044022835347492
SlashOption = [
{
"name": f"channel",
"description": f"Dein neuer Mittwoch Channel",
"required": True,
"type": 7
}
]
List = []
EckeDerSchandeID = 826069082984939590
EckeDerSchande = client.get_channel(EckeDerSchandeID)
QuantiID = 293443718319570964 # 318299815786053633
Quanti = client.get_user(QuantiID)
Troll = False
for guild in client.guilds:
List.append(guild.id)
OptionDict = {
"Fucking": False,
"Troll": []
}
Settings = {}
ServerDict = {"ServerID": OptionDict}
OmoriList = [704975440963698768, 293443718319570964, 508365874223251457]
Reminders = {508365874223251457: [6, "CWIMI ABEND"],
508365874223251457: [3, "CWIMI ABEND"]}
@client.event
async def on_ready():
await client.change_presence(activity=discord.Game(name="SlashCommands"))
await slash.sync_all_commands(delete_from_unused_guilds=True)
for Guild in client.guilds:
Settings[Guild.id] = Database.getSettings(Guild.id)
Quanti = Guild.get_member(QuantiID)
Database.AddEntry(Guild.id)
print("Done")
@client.command(pass_context=True)
async def play(ctx):
VoiceClient = discord.utils.get(client.voice_clients, guild=ctx.guild)
if ctx.message.author.voice is not None:
VoiceChannel = ctx.message.author.voice.channel
if VoiceClient is None:
await VoiceChannel.connect()
VoiceClient = discord.utils.get(client.voice_clients, guild=ctx.guild)
await LoopSchmoop(ctx, VoiceClient)
async def LoopSchmoop(ctx, VoiceClient):
await ctx.send('Playing: "FORTNITE SONG "Skybase" Standart Skill feat. Ayanda (Official Music Video)"')
await VoiceClient.play(discord.PCMVolumeTransformer(discord.FFmpegPCMAudio(f"OneAndOnly.mp3"), 0.5))
await LoopSchmoop(ctx, VoiceClient)
@client.command(pass_context=True)
async def EndeDenSchmerz(ctx):
VoiceClient = discord.utils.get(client.voice_clients, guild=ctx.guild)
if VoiceClient.is_connected():
await ctx.send(embed=EmbedsGen.genLeaveEmbed())
await VoiceClient.disconnect()
@client.event
async def on_message(message):
if message.author == client.user:
return
for word in CountList:
if word in message.content.lower():
WordCount = Database.getCount(message.author.id, word)
WordCount = WordCount + 1
WordText = f"Das ist dein {WordCount}. {word}."
ReplyFile = None
for key, val in ReplyDict.items():
if WordCount == key:
WordText = f"{WordText} {val}"
await message.reply(WordText, mention_author=False, file=ReplyFile)
for key, val in ReplyPicDict.items():
if WordCount == key:
ReplyFile = discord.File(val)
await message.reply(WordText, mention_author=False, file=ReplyFile)
Database.UpdateCount(message.author.id, word, WordCount)
if Troll:
if message.author.id == VahloID:
await message.reply(file=discord.File("CryAbout.gif"))
if "5,3" in message.content.lower():
await message.reply(f"<@{VahloID}>")
if message.content.lower() in ["lol", "League", "League of Legends"]:
await message.reply(f"<@{VahloID}>")
if Fucking:
if "fucking" in message.content.lower():
await message.reply("Die Stadt ?", mention_author=False, )
await client.process_commands(message)
@client.event
async def on_message(message):
if message.author == client.user:
return
print(message.mentions)
for ReminderUser, Reminder in Reminders.items():
for mention in message.mentions:
print(mention.id, ReminderUser, Reminder)
if mention.id == ReminderUser and Reminder[0] == dt.now().weekday():
print("Haha")
await message.reply(Reminder[1])
@client.event
async def on_voice_state_update(member, before, after):
members = after.channel.members
MemId = []
for meberino in after.channel.members:
MemId.append(meberino.id)
for meberino in before.channel.members:
MemId.append(meberino.id)
if False:
if all(x in OmoriList for x in MemId) and len(MemId) == 2 and OmoriPing:
for CoolDud in OmoriList:
if CoolDud not in MemId:
Channel = Database.getMitChan(ServerID)
MissingPep = await client.get_user(CoolDud)
await Channel.send("")
if member.id == VahloID:
if not after.channel == None or after.channel == EckeDerSchande:
await member.move_to(EckeDerSchande)
VoiceChannel = after.channel
guild = member.guild
voiceClient = discord.utils.get(client.voice_clients, guild=member.guild)
players[guild.id] = voiceClient
ydl_opts = {
"format": "bestaudio/best",
"postprocessors": [{
"key": "FFmpegExtractAudio",
"preferredcodec": "mp3",
"preferredquality": "192",
}],
}
player = await YTDLSource.from_url(url, loop=client.loop, stream=True)
voiceClient.play(player)
await asyncio.sleep(30)
await VoiceChannel.disconnect()
@client.command(pass_context=True)
async def Channel(ctx):
Chan = client.get_channel(Database.getMitChan(ctx.guild.id))
await ctx.send(
f"Der aktuelle Mittwoch Channel ist: {Chan.mention}. \n Du kannst ihn ändern mit {Prefix}SetChannel #[Neuer "
f"Channel].")
@client.command(pass_context=True)
async def SetChannel(ctx, channel: discord.TextChannel):
text_channel_list = []
Chan = client.get_channel(Database.getMitChan(ctx.guild.id))
for channäl in ctx.guild.text_channels:
text_channel_list.append(channäl.id)
if channel.id in text_channel_list:
Database.UpdateMitChan(ctx.guild.id, channel.id)
await ctx.send(f"Der neue Mittwoch Channel ist: {Chan.mention}.")
else:
await ctx.send(f"Bitte benutze einen Channl der Existiert und auf den der Bot zugriff hat.\nDer Mittwoch "
f"Channel bleibt {Chan.mention}")
@slash.slash(guild_ids=[701051127612964964, 776823258385088552])
async def Channel(ctx):
Chan = client.get_channel(Database.getMitChan(ctx.guild.id))
await ctx.send(
f"Der aktuelle Mittwoch Channel ist: {Chan.mention}. \n Du kannst ihn mit /SetChannel ändern.")
@slash.slash(guild_ids=[701051127612964964, 776823258385088552], options=SlashOption) # ,aliases=self.aliases)
async def SetChannel(ctx: SlashContext, channel):
text_channel_list = []
Chan = client.get_channel(Database.getMitChan(ctx.guild.id))
for channäl in ctx.guild.text_channels:
text_channel_list.append(channäl.id)
if channel.id in text_channel_list:
Database.UpdateMitChan(ctx.guild.id, channel.id)
await ctx.send(f"Der neue Mittwoch Channel ist: {Chan.mention}.")
else:
await ctx.send(f"Bitte benutze einen Channl der Existiert und auf den der Bot zugriff hat.\nDer Mittwoch "
f"Channel bleibt {Chan.mention}")
@slash.slash(guild_ids=[919734517881778186, 701051127612964964, 776823258385088552],
description="Funktioniert nicht. Was du heute kannst besorgen und so...")
async def SetOmori(ctx: SlashContext):
pass
@slash.slash(guild_ids=[919734517881778186, 701051127612964964, 776823258385088552],
description="Ping den Rest der OMORIII GANG!!!")
async def OmoriPing(ctx: SlashContext):
PingPong = f""
nichtIchList = []
ichList = []
for ID in OmoriList:
if ID == ctx.author.id:
continue
nichtIchList.append(client.get_user(ID))
ichList.append(ctx.author)
for usr in nichtIchList:
PingPong = PingPong + f"{usr.mention}"
await ctx.send(PingPong, embed=EmbedsGen.genOmoriPing(nichtIchList, ichList))
@slash.slash(guild_ids=[919734517881778186, 701051127612964964, 776823258385088552],
description="Interessante Fakten über Diego Garcia")
async def GarciaFacts(ctx: SlashContext):
await ctx.send(embed=EmbedsGen.genGarciaEmbed())
@client.command(pass_context=True)
async def GarciaFacts():
await ctx.send(embed=EmbedsGen.genGarciaEmbed())
@slash.slash(guild_ids=[919734517881778186])
async def TestEmbed(ctx: SlashContext):
nichtIchList = []
ichList = []
for ID in IDList:
nichtIchList.append(client.get_user(ID))
ichList.append(client.get_user(293443718319570964))
await ctx.send(embed=EmbedsGen.genOmoriPing(nichtIchList, ichList))
@client.command(pass_context=True)
async def TestEmbed(ctx):
print(ctx)
await ctx.send(file=discord.File(EmbedsGen.genCounterImg(ctx.author), "3UhrMOrgensDrip.gif"))
@tasks.loop(minutes=60)
async def Mittwoch_check():
await client.wait_until_ready()
print("Looking for Wednesday")
for guilds in client.guilds:
if dt.now(tz=pytz.timezone("Europe/Amsterdam")).weekday() == 2:
print("Ahh yes meine Kerle")
if dt.now(tz=pytz.timezone("Europe/Amsterdam")).strftime("%e.%m.%y") != Database.getLast(guilds.id):
print("Zeit für ein nices Meme")
MitChanID = Database.getMitChan(guilds.id)
try:
if MitChanID is not None:
channel = client.get_channel(MitChanID)
else:
continue
await client.change_presence(
activity=discord.Game(name="Amogus"))
await channel.send(content="@everyone Es ist Mittwoch meine Kerle!!!!",
file=discord.File(f"Mittwoch/Mittwoch{str(Database.rando())}.png"))
Database.UpdateLastTime(guilds.id,
dt.now(tz=pytz.timezone("Europe/Amsterdam")).strftime("%e.%m.%y"))
except AttributeError:
pass
# Database.UpdateMitChan(guilds.id, 0)
else:
# await client.change_presence(activity=discord.Game(name="Fortnait"))
await client.change_presence(activity=discord.Game(name="SlashCommands"))
@slash.slash(guild_ids=[701051127612964964, 776823258385088552, 919734517881778186])
async def counter(ctx):
await ctx.reply(embed=EmbedsGen.genCounterEmbed(ctx.author))
@client.command(pass_context=True)
async def counter(ctx):
await ctx.reply(embed=EmbedsGen.genCounterEmbed(ctx.author))
Mittwoch_check.start()
client.run(TOKEN)