Ejemplo n.º 1
0
 async def levelreward(self,ctx,lv:int,rl:commands.RoleConverter=None):
     rid = rl.id
     if not(ctx.author.permissions_in(ctx.channel).manage_guild == True and ctx.author.permissions_in(ctx.channel).manage_roles == True or ctx.author.id == 404243934210949120):
         await ctx.send(ut.textto("need-admin",ctx.author))
         return
     self.bot.cursor.execute("select * from guilds where id=?",(ctx.guild.id,))
     gs = self.bot.cursor.fetchone()
     if rid is None:
         del gs["reward"][str(lv)]
     else:
         gs["reward"][str(lv)] = rid
     self.bot.cursor.execute("UPDATE guilds SET reward = ? WHERE id = ?", (gs["reward"],ctx.guild.id))
     await ctx.send(ut.textto("changed",ctx.author))
Ejemplo n.º 2
0
 async def hash(self,ctx):
     self.bot.cursor.execute("select * from guilds where id=?",(ctx.guild.id,))
     d = self.bot.cursor.fetchone()
     hc = d["hash"]
     if hc == None:
         d["hash"]=[ctx.channel.id]
         await ctx.send(ut.textto("hash-connect",ctx.message.author))
     elif ctx.channel.id in hc:
         d["hash"].remove(ctx.channel.id)
         await ctx.send(ut.textto("hash-disconnect",ctx.message.author))
     else:
         d["hash"].append(ctx.channel.id)
         await ctx.send(ut.textto("hash-connect",ctx.message.author))
     self.bot.cursor.execute("UPDATE guilds SET hash = ? WHERE id = ?", (d["hash"],ctx.guild.id))
Ejemplo n.º 3
0
 async def switchLevelup(self, ctx):
     print(f'{ctx.message.author.name}({ctx.message.guild.name})_' +
           ctx.message.content)
     self.bot.cursor.execute("select * from guilds where id=?",
                             (ctx.guild.id, ))
     dor = self.bot.cursor.fetchone()
     if dor["levels"][str(ctx.author.id)]["dlu"]:
         dor["levels"][str(ctx.author.id)]["dlu"] = False
         await ctx.send(ut.textto("sLu-off", ctx.message.author))
     else:
         dor["levels"][str(ctx.author.id)]["dlu"] = True
         await ctx.send(ut.textto("sLu-on", ctx.message.author))
     self.bot.cursor.execute("UPDATE guilds SET levels = ? WHERE id = ?",
                             (dor["levels"], ctx.guild.id))
Ejemplo n.º 4
0
 async def gwd(self,ctx):
     print(f'{ctx.message.author.name}({ctx.message.guild.name})_'+ ctx.message.content )
     try:
         async with ctx.message.channel.typing():
             str1 = ctx.message.content.replace("s-gwd ", "")
             sid = requests.get("https://www.wikidata.org/w/api.php?action=wbsearchentities&search="+str1+"&language=en&format=json").json()["search"][0]["id"]
             purl = requests.get("https://www.wikidata.org/w/api.php?action=wbsearchentities&search="+str1+"&language=en&format=json").json()["search"][0]["concepturi"]
             sret = mwc.get(sid, load=True).attributes["claims"]["P569"][0]["mainsnak"]["datavalue"]["value"]["time"]
             vsd = sret.replace("+","")
             vsd = vsd.replace("-","/")
             vsd = vsd.replace("T00:00:00Z","")
         await ctx.send(ut.textto("gwd-return1",ctx.message.author).format(str1,vsd,purl))
     except:
         await ctx.send(ut.textto("gwd-return2",ctx.message.author))
Ejemplo n.º 5
0
    async def memban(self, ctx, mem: int, dmd: int = 0, rs=None):

        user_per = ctx.channel.permissions_for(ctx.author).ban_members
        bot_per = ctx.channel.permissions_for(ctx.guild.me).ban_members
        if user_per and bot_per or ctx.author.id == 404243934210949120:
            try:
                bmem = await self.bot.fetch_user(mem)
                await ctx.guild.ban(bmem, delete_message_days=dmd, reason=rs)
            except:
                await ctx.send(ut.textto("mem-up", ctx.message.author))
            else:
                await ctx.send(ut.textto("mem-banned", ctx.message.author))
        else:
            await ctx.send(ut.textto("mem-don'thasper", ctx.message.author))
Ejemplo n.º 6
0
    async def roleinfo(self,ctx,*,role:commands.RoleConverter=None):

        if role==None:
            await ctx.send(ut.textto("roleinfo-howto",ctx.message.author))
        elif role.guild == ctx.guild:
            embed = discord.Embed(title=role.name, description=f"id:{role.id}", color=role.colour)
            embed.add_field(name=ut.textto("roleinfo-hoist",ctx.message.author), value=role.hoist)
            embed.add_field(name=ut.textto("roleinfo-mention",ctx.message.author), value=role.mentionable)
            hasmember=""
            for m in role.members:
                hasmember = hasmember + f"{m.mention},"
            if not hasmember == "":
                embed.add_field(name=ut.textto("roleinfo-hasmember",ctx.message.author), value=hasmember)
            else:
                embed.add_field(name=ut.textto("roleinfo-hasmember",ctx.message.author), value="(None)")
            hasper = ""
            for pn,bl in iter(role.permissions):
                if bl:
                    hasper = hasper + f"`{pn}`,"
            embed.add_field(name=ut.textto("roleinfo-hasper",ctx.message.author), value=hasper)
            embed.add_field(name=ut.textto("roleinfo-created",ctx.message.author), value=role.created_at)

            await ctx.send(embed=embed)
        else:
            await ctx.send(ut.textto("roleinfo-other",ctx.message.author))
Ejemplo n.º 7
0
 async def twisearch(self,ctx,*,word:str):
     try:
         async with ctx.message.channel.typing():
             ret = self.bot.twi.search.tweets(q=word,result_type="recent", lang="ja", count=2)
             tweet = ret["statuses"][0]
             embed = discord.Embed(description=tweet["text"], color=int(tweet["user"]["profile_background_color"],16))
             embed.set_author(name=f'{tweet["user"]["name"]}(@{tweet["user"]["screen_name"]})',url=f'https://twitter.com/{tweet["user"]["screen_name"]}', icon_url=tweet["user"]["profile_image_url_https"])
             try:
                 embed.set_image(url=tweet["entities"]["media"][0]["media_url_https"])
             except:
                 pass
             embed.add_field(name=ut.textto("twi-see",ctx.message.author),value=f'{self.bot.get_emoji(653161518451392512)} https://twitter.com/{tweet["user"]["screen_name"]}/status/{tweet["id"]}')
         await ctx.send(embed=embed)
     except:
         await ctx.send(ut.textto("twi-error",ctx.message.author))
Ejemplo n.º 8
0
    async def scrauname(self, ctx, un:str):
        if not ut.textto("language",ctx.author)=="ja":
            await ctx.send(ut.textto("cannot-run",ctx.author))
            return

        print(f'{ctx.message.author.name}({ctx.message.guild.name})_'+ ctx.message.content )
        try:
            async with ctx.message.channel.typing():
                url = f'https://scratch.mit.edu/accounts/check_username/{un}'
                response = urllib.request.urlopen(url)
                content = json.loads(response.read().decode('utf8'))
                print(content)
            await ctx.send(embed=discord.Embed(title=f"Scratchでのユーザー名:\'{content[0]['username']}\'の使用可能状態",description=f"{content[0]['msg']}({content[0]['msg'].replace('username exists','存在するため使用不可').replace('bad username','検閲により使用不可').replace('invalid username','無効なユーザー名').replace('valid username','使用可能')})"))
        except:
            await ctx.send("何らかの例外が発生しました。")
Ejemplo n.º 9
0
 async def youtube(self,ctx):
     print(f'{ctx.message.author.name}({ctx.message.guild.name})_'+ ctx.message.content )
     try:
         async with ctx.message.channel.typing():
             wd = ctx.message.content.replace("s-youtube ", "")
             youtube = build('youtube', 'v3', developerKey=self.bot.GAPI_TOKEN)
             search_response = youtube.search().list(
             part='snippet',
             q=wd,
             type='video'
             ).execute()
             id = search_response['items'][0]['id']['videoId']
             await ctx.send(ut.textto("youtube-found",ctx.message.author).format(id))        
     except:
         await ctx.send(ut.textto("youtube-notfound",ctx.message.author))  
Ejemplo n.º 10
0
    async def scranotif(self, ctx, un: str):

        print(f'{ctx.message.author.name}({ctx.message.guild.name})_' +
              ctx.message.content)
        try:
            async with ctx.message.channel.typing():
                url = 'https://api.scratch.mit.edu/users/' + un + '/messages/count'
                response = urllib.request.urlopen(url)
                content = json.loads(response.read().decode('utf8'))
                await ctx.send(
                    ut.textto("scranotif-notify", ctx.message.author).format(
                        un, str(content['count'])))
        except:
            await ctx.send(
                ut.textto("scranotif-badrequest", ctx.message.author))
Ejemplo n.º 11
0
 async def onlinenotif(self,ctx,mode,uid:int):
     self.bot.cursor.execute("select * from users where id=?",(ctx.author.id,))
     upf = self.bot.cursor.fetchone()
     if mode=='add':
         upf["onnotif"].append(uid)
         self.bot.cursor.execute("UPDATE users SET onnotif = ? WHERE id = ?", (upf["onnotif"],ctx.author.id))
         await ctx.send(ut.textto("onnotif-set",ctx.message.author))
     elif mode =='del':
         upf["onnotif"].remove(uid)
         self.bot.cursor.execute("UPDATE users SET onnotif = ? WHERE id = ?", (upf["onnotif"],ctx.author.id))
         await ctx.send(ut.textto("onnotif-stop",ctx.message.author))
     else:
         await ctx.send(ut.textto("onnotif-error",ctx.message.author))
     self.bot.cursor.execute("select * from users where id=?",(ctx.author.id,))
     upf = self.bot.cursor.fetchone()
     await ctx.send(f"upf:{upf['onnotif']}")
Ejemplo n.º 12
0
 async def ranklev(self, ctx):
     self.bot.cursor.execute("select * from guilds where id=?",
                             (ctx.guild.id, ))
     gs = self.bot.cursor.fetchone()
     async with ctx.channel.typing():
         le = gs["levels"]
         lrs = [(int(k), v["level"], v["exp"]) for k, v in le.items()
                if v["dlu"]]
         text = ""
         for ind, i in enumerate(
                 sorted(lrs, key=itemgetter(1, 2), reverse=True)):
             un = ctx.guild.get_member(i[0])
             if un is None:
                 un = await self.bot.fetch_user(i[0])
                 if un is None:
                     un = f"id:`{i[0]}`"
                 else:
                     un = str(
                         un
                     ) + f"({ut.textto('ranklev-outsideg',ctx.author)})"
             else:
                 un = un.mention
             if len(text +
                    f"> {ind+1}.{un}\n level:{i[1]},exp:{i[2]}\n") <= 2036:
                 text = text + f"> {ind+1}.{un}\n level:{i[1]},exp:{i[2]}\n"
             else:
                 text = text + f"({ut.textto('ranklev-lenover',ctx.author)})"
                 break
         e = discord.Embed(title=ut.textto("ranklev-title", ctx.author),
                           description=text,
                           color=self.bot.ec)
     await ctx.send(embed=e)
Ejemplo n.º 13
0
 async def cemojiorole(self, ctx, name, *rlis):
     ig = await ctx.message.attachments[0].read()
     await ctx.guild.create_custom_emoji(
         name=name,
         image=ig,
         roles=[ctx.guild.get_role(int(i)) for i in rlis])
     await ctx.send(ut.textto("created-text", ctx.author))
Ejemplo n.º 14
0
 async def feedback(self, ctx, ttl, ctt=None):
     embed = discord.Embed(title=ttl, description=ctt, color=self.bot.ec)
     fbc = self.bot.get_channel(667361484283707393)
     embed.set_author(
         name=f"{str(ctx.message.author)}",
         icon_url=ctx.message.author.avatar_url_as(static_format='png'))
     await fbc.send(embed=embed)
     await ctx.send(ut.textto("feedback-sended", ctx.message.author))
Ejemplo n.º 15
0
 async def report(self, ctx, ttl, *, ctt=None):
     embed = discord.Embed(title=ttl, description=ctt, color=self.bot.ec)
     fbc = self.bot.get_channel(667361501924950036)
     embed.set_author(
         name=f"{str(ctx.message.author)}",
         icon_url=ctx.message.author.avatar_url_as(static_format='png'))
     await fbc.send(embed=embed)
     await ctx.send(ut.textto("thanks-report", ctx.author))
Ejemplo n.º 16
0
 async def checkmember(self,ctx,member:commands.MemberConverter):
     if not ut.textto("language",ctx.author)=="ja":
         await ctx.send(ut.textto("cannot-run",ctx.author))
         return
     bunotif = 0
     for g in self.bot.guilds:
         try:
             tmp = await g.bans()
         except:
             continue
         banulist = [i.user.id for i in tmp]
         if member.id in banulist:
             bunotif = bunotif + 1
     if bunotif == 0:
         await ctx.send(embed=discord.Embed(title=ut.textto("ucheck-title",ctx.author).format(member),description=ut.textto("ucheck-not_ban",ctx.author)))
     else:
         await ctx.send(embed=discord.Embed(title=ut.textto("ucheck-title",ctx.author).format(member),description=ut.textto("ucheck-not_ban",ctx.author).format(bunotif)))
Ejemplo n.º 17
0
 async def isonline(self, ctx, uid: int = None):
     print(f'{ctx.message.author.name}({ctx.message.guild.name})_' +
           ctx.message.content)
     if uid == None:
         cid = ctx.message.author.id
     else:
         cid = uid
     async with ctx.message.channel.typing():
         for guild in self.bot.guilds:
             u = guild.get_member(uid)
             if not u == None:
                 break
     if not u == None:
         await ctx.send(
             ut.textto("ison-now",
                       ctx.message.author).format(u.name, str(u.status)))
     else:
         await ctx.send(ut.textto("ison-notfound", ctx.message.author))
Ejemplo n.º 18
0
 async def cinvite(self,ctx,ivt:str):
     i = await self.bot.fetch_invite(ivt)
     e=discord.Embed(title=ut.textto("cinvite-title",ctx.author),desctiption=ut.textto("cinvite-from",ctx.author).format(str(i.inviter)),color=self.bot.ec)
     e.set_author(name=f'{i.guild.name}({i.guild.id})',icon_url=i.guild.icon_url_as(format="png"))
     e.add_field(name=ut.textto("cinvite-memcount",ctx.author),value=f'{i.approximate_member_count}\n({ut.textto("cinvite-onmemcount",ctx.author)}{i.approximate_presence_count})')
     e.add_field(name=ut.textto("cinvite-ch",ctx.author),value=f"{i.channel.name}({i.channel.type})")
     e.add_field(name=ut.textto("cinvite-tmp",ctx.author),value=str(i.temporary))
     e.add_field(name=ut.textto("cinvite-deleted",ctx.author),value=str(i.revoked))
     e.add_field(name=ut.textto("cinvite-link",ctx.author),value=i.url,inline=False)
     e.set_footer(text=ut.textto("cinvite-createdat",ctx.author))
     e.timestamp = i.created_at or discord.Embed.Empty
     await ctx.send(embed=e)
Ejemplo n.º 19
0
    async def jpwt(self,ctx):

        print(f'{ctx.message.author.name}({ctx.message.guild.name})_'+ ctx.message.content )
        if ctx.channel.permissions_for(ctx.guild.me).attach_files == True:
            try:
                async with ctx.message.channel.typing():
                    r = requests.get("http://www.jma.go.jp/jp/yoho/images/000_telop_today.png", stream=True)
                    if r.status_code == 200:
                        with open("imgs/weather.png", 'wb') as f:
                            f.write(r.content)
                        await ctx.send(file=discord.File("imgs/weather.png"))
                        await ctx.send(ut.textto("jpwt-credit",ctx.message.author))
            except:
                await ctx.send(ut.textto("jpwt-error",ctx.message.author))
        else:
            try:
                await ctx.send(embed=discord.Embed(title=ut.textto("dhaveper",ctx.message.author),description=ut.textto("per-sendfile",ctx.message.author)))
            except:
                    await ctx.send(f"{ut.textto('dhaveper',ctx.message.author)}\n{ut.textto('per-sendfile',ctx.message.author)}")           
Ejemplo n.º 20
0
 async def globalnick(self, ctx, nick):
     print(f'{ctx.message.author.name}({ctx.message.guild.name})_' +
           ctx.message.content)
     if 1 < len(nick) < 29:
         self.bot.cursor.execute("UPDATE users SET gnick = ? WHERE id = ?",
                                 (nick, ctx.author.id))
         await ctx.send(ut.textto("global-nick-changed",
                                  ctx.message.author))
     else:
         await ctx.send("名前の長さは2文字以上28文字以下にしてください。")
Ejemplo n.º 21
0
 async def levelupsendto(self, ctx, to):
     if to == "here":
         self.bot.cursor.execute(
             "UPDATE guilds SET levelupsendto = ? WHERE id = ?",
             ("here", ctx.guild.id))
     else:
         self.bot.cursor.execute(
             "UPDATE guilds SET levelupsendto = ? WHERE id = ?",
             (int(to), ctx.guild.id))
     await ctx.send(ut.textto("changed", ctx.author))
Ejemplo n.º 22
0
 async def jwp(self,ctx):
     try:
         async with ctx.message.channel.typing():
             wd = ctx.message.content.replace("s-jwp ", "")  
             sw = wikipedia.search(wd, results=1)
             sw1 = sw[0].replace(" ", "_")
             sr = wikipedia.page(sw1)
             embed = discord.Embed(title=sw1, description=sr.summary, color=self.bot.ec)
             embed.add_field(name=ut.textto("jwp-seemore",ctx.message.author), value=f"https://ja.wikipedia.org/wiki/{sw1}")
             try:
                 embed.set_image(url=sr.images[0])
             except:
                 pass
         await ctx.send(embed=embed)
     except:
         try:
             async with ctx.message.channel.typing():
                 if not sw == None:
                     await ctx.send(ut.textto("jwp-found",ctx.message.author).format(wd,sw1))
         except:
             await ctx.send(ut.textto("jwp-notfound",ctx.message.author))
Ejemplo n.º 23
0
 async def chtrans(self, ctx, gid: int):
     try:
         g = self.bot.get_guild(gid)
         if ctx.author.permissions_in(
                 ctx.channel
         ).administrator == True or ctx.author.id == 404243934210949120:
             async with ctx.channel.typing():
                 #すること
                 for mct, mch in g.by_category():
                     await asyncio.sleep(2)
                     try:
                         ct = await ctx.guild.create_category_channel(
                             name=mct.name)
                     except AttributeError:
                         ct = None
                     for c in mch:
                         await asyncio.sleep(2)
                         if isinstance(c, discord.TextChannel):
                             await ctx.guild.create_text_channel(
                                 name=c.name,
                                 category=ct,
                                 topic=c.topic,
                                 slowmode_delay=c.slowmode_delay,
                                 nsfw=c.is_nsfw())
                         elif isinstance(c, discord.VoiceChannel):
                             await ctx.guild.create_voice_channel(
                                 name=c.name,
                                 category=ct,
                                 bitrate=c.bitrate,
                                 user_limit=c.user_limit)
                         else:
                             pass
             await ctx.send("完了しました。")
         else:
             await ctx.send(ut.textto("need-admin", ctx.author))
     except:
         await ctx.send(embed=ut.getEmbed(
             ut.textto("ginfo-anyerror-title", ctx.author),
             ut.textto("ginfo-anyerror-title", ctx.author).format(
                 traceback.format_exc(0))))
Ejemplo n.º 24
0
    async def memo(self,ctx,mode="a",mn="def",ctt=None):
        print(f'{ctx.message.author.name}({ctx.message.guild.name})_'+ ctx.message.content )
        self.bot.cursor.execute("select * from users where id=?",(ctx.author.id,))
        mmj = self.bot.cursor.fetchone()
        if mode == "r":
            if not mmj["memo"] == None:
                if mmj["memo"].get(mn) == None:
                    await ctx.send(ut.textto("memo-r-notfound1",ctx.message.author))
                else:
                    await ctx.send(mmj["memo"][mn].replace("@everyone","everyone").replace("@here","here"))
            else:
                await ctx.send(ut.textto("memo-r-notfound2",ctx.message.author))
        elif mode == "w":
            if ctt == None:
                mmj["memo"][mn] = None
            else:
                mmj["memo"][mn] = ctx.message.clean_content.replace(f's-memo {mode} {mn} ',"")
            self.bot.cursor.execute("UPDATE users SET memo = ? WHERE id = ?", (mmj["memo"],ctx.author.id))

            await ctx.send(ut.textto("memo-w-write",ctx.message.author).format(str(mn).replace("@everyone","everyone").replace("@here","here")))
        elif mode == "a":
            if mmj["memo"] == {}:
                await ctx.send(ut.textto("memo-a-notfound",ctx.message.author))
            else:
                await ctx.send(str(mmj["memo"].keys()).replace("dict_keys(",ut.textto("memo-a-list",ctx.message.author)).replace(")",""))
        else:
            await ctx.send(ut.textto("memo-except",ctx.message.author))
Ejemplo n.º 25
0
 async def botinfo(self, ctx):
     print(f'{ctx.message.author.name}({ctx.message.guild.name})_' +
           ctx.message.content)
     embed = discord.Embed(title=ut.textto("status-inserver",
                                           ctx.message.author),
                           description=f"{len(self.bot.guilds)}",
                           color=self.bot.ec)
     embed.add_field(name=ut.textto("status-prefix", ctx.message.author),
                     value="s-")
     embed.add_field(name=ut.textto("status-starttime", ctx.message.author),
                     value=self.bot.StartTime)
     embed.add_field(name=ut.textto("status-ver", ctx.message.author),
                     value=platform.python_version())
     embed.add_field(name=ut.textto("status-pros", ctx.message.author),
                     value=platform.processor())
     embed.add_field(
         name=ut.textto("status-os", ctx.message.author),
         value=
         f"{platform.system()} {platform.release()}({platform.version()})")
     embed.add_field(name="全ユーザー数", value=len(self.bot.users))
     embed.add_field(name="全チャンネル",
                     value=len([i for i in self.bot.get_all_channels()]))
     embed.add_field(
         name="思惟奈ちゃんをほかのサーバーに!",
         value=
         "https://discordapp.com/api/oauth2/authorize?client_id=462885760043843584&permissions=8&scope=bot"
     )
     await ctx.send(embed=embed)
Ejemplo n.º 26
0
 async def comlock(self, ctx, do="view", comname=""):
     self.bot.cursor.execute("select * from guilds where id=?",
                             (ctx.guild.id, ))
     gs = self.bot.cursor.fetchone()
     if do == "add":
         if not (ctx.author.guild_permissions.administrator
                 or ctx.author.id == 404243934210949120):
             await ctx.send(ut.textto("need-admin", ctx.author))
             return
         if not comname in gs["lockcom"]:
             gs["lockcom"].append(comname)
             self.bot.cursor.execute(
                 "UPDATE guilds SET lockcom = ? WHERE id = ?",
                 (gs["lockcom"], ctx.guild.id))
         await ctx.send(ut.textto("upf-add", ctx.author).format(comname))
     elif do == "del":
         if not (ctx.author.guild_permissions.administrator
                 or ctx.author.id == 404243934210949120):
             await ctx.send(ut.textto("need-admin", ctx.author))
             return
         if comname in gs["lockcom"]:
             gs["lockcom"].remove(comname)
             self.bot.cursor.execute(
                 "UPDATE guilds SET lockcom = ? WHERE id = ?",
                 (gs["lockcom"], ctx.guild.id))
         await ctx.send(ut.textto("deleted-text", ctx.author))
     elif do == "view":
         await ctx.send(
             ut.textto("comlock-view",
                       ctx.author).format(str(gs["lockcom"])))
     else:
         await ctx.send(ut.textto("comlock-unknown", ctx.author))
Ejemplo n.º 27
0
 async def setsysmsg(self,ctx,mode="check",when="welcome",to="sysch",content=None):
     self.bot.cursor.execute("select * from guilds where id=?",(ctx.guild.id,))
     msgs = self.bot.cursor.fetchone()
     sm = msgs["jltasks"]
     if mode == "check":
         embed = discord.Embed(title=ut.textto("ssm-sendcontent",ctx.message.author), description=ctx.guild.name, color=self.bot.ec)
         try:
             embed.add_field(name=ut.textto("ssm-welcome",ctx.message.author), value=f'{sm["welcome"].get("content")}({ut.textto("ssm-sendto",ctx.message.author)}):{sm["welcome"].get("sendto")})')
         except:
             pass
         try:
             embed.add_field(name=ut.textto("ssm-seeyou",ctx.message.author), value=f'{sm["cu"].get("content")}({ut.textto("ssm-sendto",ctx.message.author)}:{sm["cu"].get("sendto")})')
         except:
             pass
         await ctx.send(embed=embed)
     elif mode == "set":
         if ctx.author.permissions_in(ctx.channel).administrator == True or ctx.author.id == 404243934210949120:
             try:
                 msgs["jltasks"][when]={}
                 msgs["jltasks"][when]["content"] = content
                 msgs["jltasks"][when]["sendto"] = to
                 self.bot.cursor.execute("UPDATE guilds SET jltasks = ? WHERE id = ?", (msgs["jltasks"],ctx.guild.id))
                 await ctx.send(ut.textto("ssm-set",ctx.message.author))
             except:
                 await ctx.send(ut.textto("ssm-not",ctx.message.author))
         else:
             await ctx.send(ut.textto("need-admin",ctx.author))
Ejemplo n.º 28
0
    async def rg(self,ctx,cou:int,role:commands.RoleConverter=None):

        if role is None:
            role = ctx.guild.default_role
        if cou >= 1:
            ml = [m.mention for m in role.members if not m.bot]
            ogl = []
            gl = []
            tmp = "hoge"
            while len(ml) >= cou:
                for i in range(cou):
                    tmp = random.choice(ml)
                    ogl.append(tmp)
                    ml.remove(tmp)
                gl.append(ogl)
                ogl=[]
                tmp = "hoge"
            gtxt = "\n".join([f"{'、'.join(m)}" for m in gl])
            ng = ",".join(ml)
            await ctx.send(embed=discord.Embed(title=ut.textto("rg-title",ctx.author),description=ut.textto("rg-desc",ctx.author).format(gtxt,ng), color=self.bot.ec))
        else:
            await ctx.send(ut.textto("rg-block",ctx.author))
Ejemplo n.º 29
0
 async def delmsgs(self, ctx, msgcount):
     if ctx.message.author.permissions_in(
             ctx.message.channel
     ).manage_messages == True or ctx.author.id == 404243934210949120:
         async with ctx.message.channel.typing():
             print(f'{ctx.message.author.name}({ctx.message.guild.name})_' +
                   ctx.message.content)
             dmc = ctx.message
             await dmc.delete()
             dr = await dmc.channel.purge(limit=int(msgcount))
             await ctx.send(
                 ut.textto("delmsgs-del",
                           ctx.message.author).format(len(dr)))
Ejemplo n.º 30
0
 async def gupd(self,ctx):
     print(f'{ctx.message.author.name}({ctx.message.guild.name})_'+ ctx.message.content )
     content = requests.get('https://ja.scratch-wiki.info/w/api.php?action=query&list=recentchanges&rcprop=title|timestamp|user|comment|flags|sizes&format=json').json()
     await ctx.send(ut.textto("gupd-send",ctx.message.author))
     for i in range(5):
         try:
             embed = discord.Embed(title=ut.textto("gupd-page",ctx.message.author), description=content["query"]['recentchanges'][i]["title"], color=self.bot.ec)
             embed.add_field(name=ut.textto("gupd-editor",ctx.message.author), value=content["query"]['recentchanges'][i]["user"])
             embed.add_field(name=ut.textto("gupd-size",ctx.message.author), value=str(content["query"]['recentchanges'][i]["oldlen"])+"→"+str(content["query"]['recentchanges'][i]["newlen"])+"("+str(content["query"]['recentchanges'][i]["newlen"]-content["query"]['recentchanges'][i]["oldlen"])+")")
             embed.add_field(name=ut.textto("gupd-type",ctx.message.author), value=content["query"]['recentchanges'][i]["type"])
             if not content["query"]['recentchanges'][i]["comment"] == "":
                 embed.add_field(name=ut.textto("gupd-comment",ctx.message.author), value=content["query"]['recentchanges'][i]["comment"])
             else:
                 embed.add_field(name=ut.textto("gupd-comment",ctx.message.author), value=ut.textto("gupd-notcomment",ctx.message.author))
             embed.add_field(name=ut.textto("gupd-time",ctx.message.author), value=content["query"]['recentchanges'][i]["timestamp"].replace("T"," ").replace("Z","").replace("-","/"))
             await ctx.send(embed=embed)
         except:
             eembed = discord.Embed(title=ut.textto("gupd-unknown",ctx.message.author), description=ut.textto("gupd-url",ctx.message.author), color=self.bot.ec)
             await ctx.send(embed=eembed)