-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
287 lines (223 loc) · 8.54 KB
/
bot.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
#Importing Modules
from importlib.resources import path
import discord
from discord.ext import commands
import random
import os
from dotenv import load_dotenv
from gtts import gTTS
#Importing useful functions from main.py
from main import ask, scraper, getImg
#Declaring token variable for discord bot
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
#Initialise bot object
bots = commands.Bot(case_insensitive=True, command_prefix=['ahegao ', 'a!', 'sext ', 'Sext '], help_command=None, )
#Help related commands
class help(commands.Cog):
bots = commands.Bot(case_insensitive=True, command_prefix=['ahegao ', 'a!', 'sext ', 'Sext '], help_command=None, )
def __init__(self, bot):
self.bot = bot
@bots.command(aliases=['help','h'])
async def _help(self, ctx):
title = '**__Bot Commands__**'
description = '''
**__Help__**
**help/h** - displays this message
**__Sexting__**
**sext/s** - initialises sexting interaction with the bot. The bot will respond to every message you send in the chat. Use **end** to stop the interaction.
**__Media__**
**ahegaopic/ap** - sends a random high quality Ahegao Pic
**sauce/doujin** - sends a random handpicked doujin link from nhentai
'''
z = int('fffeee', 16)
print(type(discord.Colour(z)))
embed = discord.Embed(title=title, description=description, colour=discord.Colour(z))
embed.set_image(url='https://imgur.com/Mzukcha.jpg')
await ctx.send(embed=embed)
#Sexting related commands using OpenAi
class sexting(commands.Cog):
bots = commands.Bot(case_insensitive=True, command_prefix=['ahegao ', 'a!', 'sext ', 'Sext '], help_command=None, )
def __init__(self, bot):
self.bot = bot
@bots.command(aliases=['sext','s'])
async def _sext(self, ctx):
channel=ctx.message.channel
answer = 0
msg_cont=""
greetings=['Heyaa!', "Hi babyy!", "Hewoo!", "Hey hottie!"]
greet=random.choice(greetings)
await channel.send(greet)
while True:
f = 0
def check(m):
return m.author == ctx.author
try:
msg = await bots.wait_for('message', timeout=120.0, check=check)
msg_cont = msg.content
except:
f = 1
a = msg_cont.lower() == 'end'
b = f == 1
if a or b:
byes=['bbye baby <3 UwU','bye! I will miss ya!','Take care! <3','Cya later ^^', 'Bye! love ya!']
bye=random.choice(byes)
await channel.send(bye)
break
try:
answer = ask(msg_cont)
except:
answer = "YOUR MOTHER"
continue
await channel.send(answer)
#Media related commands
class Media(commands.Cog):
bots = commands.Bot(case_insensitive=True, command_prefix=['ahegao ', 'a!', 'sext ', 'Sext '], help_command=None, )
def __init__(self, bots):
self.bot = bots
@bots.command(aliases=['ahegaopic','ap'])
async def _ahegaopic(self, ctx):
if ctx.channel.is_nsfw():
file = discord.File(fp = await getImg(), filename = 'Ahegao.jpg')
await ctx.send(file = file)
else:
await ctx.send("You can only use this command in NSFW channels!")
@bots.command(aliases = ['sauce','doujin'])
async def _sauce(self, ctx):
if ctx.channel.is_nsfw():
file = open('codes.csv', 'r').read()
a = list(file.split(", "))
await ctx.send("https://nhentai.net/g/"+ a[random.randint(0, len(a)+1)])
else:
await ctx.send("You can only use this command in NSFW channels!")
#porn command
class porn(commands.Cog):
bots = commands.Bot(case_insensitive=True, command_prefix=['ahegao ', 'a!', 'sext ', 'Sext '], help_command=None, )
def __init__(self, bot):
self.bot = bot
@bots.command(name='rlporn')
async def porn(self, ctx):
if ctx.channel.is_nsfw():
a=ctx.message.content.split()
n=1
if len(a)==3:
try:
n=int(a[-1])
if n>15:
n=15
except:
n=1
elif len(a)==2 and a[0]=="a!rlporn":
try:
n=int(a[-1])
if n>15:
n=15
except:
n=1
for i in range (n):
link = f"https://realbooru.com/index.php?page=post&s=list&tags=gif&pid={random.randint(1,500)}"
hyperlink = scraper(url_link = link, remove = 5)
if hyperlink == "Error":
continue
h=hyperlink.split('thumbnail_')
h1=h[0].split('thumbnails/')
h2=h[-1]
hyperlink="https://realbooru.com//images/"+h1[-1]+h2
hp=hyperlink.split('.')
hp[-1]='gif'
hyperlink=""
for i in hp:
if hp.index(i)!=2:
hyperlink += i+'.'
else:
hyperlink += i
await ctx.send(hyperlink)
else:
await ctx.send("You can only use this command in NSFW channels!")
#tts command
class tts(commands.Cog):
bots = commands.Bot(command_prefix=['tts'], help_command=None)
def __init__(self, bot):
self.bot = bot
@bots.command(name = 'tts')
async def tts(self,ctx):
global vc
channel = ctx.message.channel
voicechannel = ctx.author.voice.channel
try:
vc = await voicechannel.connect()
except:
vc
while True:
f = 0
def check(m):
return m.author == ctx.author
try:
msg = await bots.wait_for('message', timeout=120.0, check=check)
msg_cont = msg.content
except:
f = 1
a = msg_cont.lower() == 'end'
b = f == 1
if a or b:
await channel.send('tts disconnected due to inactivity')
await vc.disconnect()
break
try:
output = gTTS(text=msg_cont, lang="en", tld="co.in")
output.save(f"tts.mp3")
vc.play(discord.FFmpegPCMAudio(source="tts.mp3"))
except:
continue
#vc command
class vc(commands.Cog):
bots = commands.Bot(command_prefix=['vc '], help_command=None)
def __init__(self, bot):
self.bot = bot
@bots.command(name= 'vc')
async def vc(self, ctx):
global vc
channel=ctx.message.channel
answer = 0
voicechannel = ctx.author.voice.channel
try:
vc = await voicechannel.connect()
except:
vc
greetings=['Heyaa!', "Hi babyy!", "Hewoo!", "Hey hottie!"]
greet=random.choice(greetings)
output = gTTS(text=greet, lang="en", tld="co.in")
output.save(f"tts.mp3")
vc.play(discord.FFmpegPCMAudio(source="tts.mp3"))
while True:
f = 0
def check(m):
return m.author == ctx.author
try:
msg = await bots.wait_for('message', timeout=120.0, check=check)
msg_cont = msg.content
except:
f = 1
a = msg_cont.lower() == 'end'
b = f == 1
if a or b:
byes=['bbye baby <3 UwU','bye! I will miss ya!','Take care! <3','Cya later ^^', 'Bye! love ya!']
bye=random.choice(byes)
await channel.send(bye)
await vc.disconnect()
break
try:
answer = ask(msg_cont)
output = gTTS(text=answer, lang="en", tld="co.in")
output.save(f"tts.mp3")
vc.play(discord.FFmpegPCMAudio(source="tts.mp3"))
except:
answer = "weird"
continue
bots.add_cog(help(bots))
bots.add_cog(sexting(bots))
bots.add_cog(Media(bots))
bots.add_cog(porn(bots))
bots.add_cog(tts(bots))
bots.add_cog(vc(bots))
bots.run(TOKEN)