forked from Pcpkomputer/Miuna-Heroku
-
Notifications
You must be signed in to change notification settings - Fork 0
/
miuna.py
97 lines (88 loc) · 4.22 KB
/
miuna.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
import discord
import asyncio
from discord.ext.commands import Bot
from discord.ext import commands
import platform
from urllib.request import urlopen
from bs4 import BeautifulSoup
import argparse
import re
from re import *
import sys
import subprocess
import string
import os
from subprocess import Popen, PIPE, STDOUT
import glob, os
client = Bot(description="??????????????", command_prefix=".", pm_help = False)
@client.event
async def on_ready():
print('Logged in as '+client.user.name+' (ID:'+client.user.id+') | Connected to '+str(len(client.servers))+' servers | Connected to '+str(len(set(client.get_all_members())))+' users')
print('--------')
print('Use this link to invite {}:'.format(client.user.name))
print('https://discordapp.com/oauth2/authorize?client_id={}&scope=bot&permissions=8'.format(client.user.id))
print('--------')
return await client.change_presence(game=discord.Game(name='PyCharm'))
@client.command(pass_context=True)
async def an8(ctx, x, *z):
try:
if x=='baru':
regex = re.compile(r"<td>(\d)</td>\s*<.*>(.*)\s*</td>\s*<.*>(.*)</td>\s*</tr>\s*<!--Posting-->")
tautan = 'http://garismiring-an8.github.io/index.html'
halaman = urlopen(tautan)
ah=BeautifulSoup(halaman, 'html.parser')
tabel = re.search(regex,str(ah))
no = tabel.group(1)
rilisan = tabel.group(2)
ukuran = tabel.group(3)+'MB'
togel=int(no)
string='''```
Rilisan paling terbaru!
No :'''+no+'''
Berkas :'''+rilisan+'''
Ukuran :'''+ukuran+'''
```'''
await client.say(string)
await client.say("`Gunakan perintah: .an8 getlink "+str(togel)+" untuk mengambil tautan`")
#else:
#await client.say("`Perintah tidak ditemukan!`")
elif x=='list':
listregex = re.compile(r"<td class=\"name\">(.*)\s*</td>")
tautan = 'http://garismiring-an8.github.io/index.html'
halaman = urlopen(tautan)
ah=BeautifulSoup(halaman, 'html.parser')
xxx=listregex.findall(str(ah))
duar=0
hasil=[]
for x in xxx:
duar=duar+1
hasil.append('['+str(duar)+']'+x+'\n')
b=''.join(hasil)
await client.say("```"+b+"```")
await client.say("`Gunakan perintah: .an8 getlink [index] untuk mengambil tautan`")
elif x=='getlink':
##############
listregex = re.compile(r"<td class=\"name\">(.*)\s*</td>")
tautan = 'http://garismiring-an8.github.io/index.html'
halaman = urlopen(tautan)
ah=BeautifulSoup(halaman, 'html.parser')
boom=listregex.findall(str(ah))
a=0
for l in boom:
a+=1
#############
#if int(z[0])>a:
# await client.say("`Index enggak nyampe sana GBLKKK!!!!!`")
regetlink=re.compile(r"<tr class=\"\" kode=\"..(.*)\">\s*<td>"+z[0]+"</td>")
tautan = 'http://garismiring-an8.github.io/index.html'
halaman = urlopen(tautan)
ah=BeautifulSoup(halaman, 'html.parser')
cari=re.search(regetlink,str(ah))
dude="https://drive.google.com/file/d/"+cari.group(1)
await client.say(dude)
else:
await client.say("`Perintah tidak ditemukan!`")
except Exception as l:
await client.say("`????????????????????????`")
print(l)
client.run(os.environ['TOKEN'])