async def daily(): now_turkey = get() nowmo = int(now_turkey.month) nowd = int(now_turkey.day) nowh = int(now_turkey.hour) nowmi = int(now_turkey.minute) lastmo = weekly["aygünsaat"][0] lastd = weekly["aygünsaat"][1] lasth = weekly["aygünsaat"][2] lastmi = weekly["aygünsaat"][3] if ((nowd > lastd) or (nowd <= lastd and nowmo > lastmo)) and nowh == lasth and nowmi >= lastmi: for i in weekly.keys(): if i != "aygünsaat": for j in weekly[i].keys(): if j != "ZmxhZw==": if weekly[i][j] != None or weekly[i] != []: for z in weekly[i][j]: try: b = await bot.fetch_channel(z[0]) d = await bot.fetch_user(z[1]) url = "https://cdn.discordapp.com" + d.avatar_url._url await secret(j, b, str(d), url) except: weekly[i][j].remove([z[0], z[1]]) weekly[i]["ZmxhZw=="] -= 1 await oops_log(bot, z[0], z[1], j) weekly["aygünsaat"] = [nowmo, nowd, 12, 0] with open('hello.json', 'w') as outfile: json.dump(weekly, outfile)
def for_log(gid,user,channel,name): trtime = get() if len(str(trtime.minute)) == 1: minute = "0"+ str(trtime.minute) else: minute = trtime.minute if len(str(trtime.second)) == 1: second = "0"+ str(trtime.second) else: second = trtime.second print(f"[{trtime.hour}:{minute}:{second} {trtime.day}/{trtime.month}/{trtime.year}] {user} created oto message protocol #{channel} city: {name} guild: {gid}")
async def help(ctx): now_turkey = get() if len(str(now_turkey.minute)) == 1: minute = "0" + str(now_turkey.minute) else: minute = now_turkey.minute embed = discord.Embed(title="YARDIM", colour=discord.Colour(0xA3FFA9)) embed.add_field( name="<:map:832150636228247553>", value= "**!weather** ``<şehir>``\nAtlasta bulabildiğim kadar şehrin hava durumunu getirebilirim\n||öyle, değil mi?||", inline=True) embed.add_field( name="<:screwdriver:832150872221548564>", value= "**!setup** ``<şehir>``\nYazdığınız kanala her gün hava durumu raporu gönderebilirim", inline=True) embed.add_field( name="<:track_previous:832152345399525377>", value= "**!resetup** ``<şehir>``\nYazdığınız kanala her gün gönderdiğim hava durumu raporunu kaldırabilirim", inline=True) embed.add_field( name="", value= "|||| [Sunucuya ekle](https://discord.com/oauth2/authorize?client_id=829685204641513532&permissions=93184&scope=bot) | [Oy ver](https://top.gg/bot/829685204641513532)", inline=True) embed.set_image( url= "https://raw.githubusercontent.com/Deja-Vu1/WeatherBot/main/Img/discordimage-1.png" ) embed.set_footer( text=footext + " bugün saat " + str(now_turkey.hour) + ":" + str(minute), icon_url= "https://cdn.discordapp.com/avatars/596455467585110016/b96ac044a4382f62ad36637c6021ef80.png?size=256" ) await ctx.message.channel.send(embed=embed)
async def secret(name,channel,author_name,author_url): dictofdays = {"Thursday":"Perşembe","Wednesday":"Çarşamba","Tuesday":"Salı","Monday":"Pazartesi","Sunday":"Pazar","Saturday":"Cumartesi","Friday":"Cuma"} footext = "Developed by bis ❤️ " a = requests.post(f"https://openweathermap.org/data/2.5/find?q={name}&appid=439d4b804bc8187953eb36d2a8c26a02&units=metric") a = json.loads(a.text) b = requests.post(f'https://openweathermap.org/data/2.5/onecall?lat={a["list"][0]["coord"]["lat"]}&lon={a["list"][0]["coord"]["lon"]}&units=metric&appid=439d4b804bc8187953eb36d2a8c26a02') b = json.loads(b.text) des = a["list"][0]["weather"][0]["description"] arr = a["list"][0]["weather"][0]["main"] deg = a["list"][0]["main"]["temp"] - 273.15 feel = a["list"][0]["main"]["feels_like"] - 273.15 dmin = a["list"][0]["main"]["temp_min"] - 273.15 dmax = a["list"][0]["main"]["temp_max"] - 273.15 press = a["list"][0]["main"]["pressure"] hum = a["list"][0]["main"]["humidity"] if a["list"][0]["rain"] != None:footext+=" 🌧" if a["list"][0]["snow"] != None:footext+=" ❄️" now_turkey = get() if len(str(now_turkey.minute)) == 1: minute = "0"+ str(now_turkey.minute) else: minute = now_turkey.minute embed = discord.Embed(title=name.upper(), colour=discord.Colour(0x9beec), url="https://discordapp.com") embed.set_thumbnail(url=f'http://openweathermap.org/img/wn/{a["list"][0]["weather"][0]["icon"]}.png') embed.set_author(name=author_name, url="https://discordapp.com", icon_url=author_url) embed.set_footer(text="Bu mesaj BIS❤️ ailesi tarafından otomatik olarak atılmıştır•bugün saat "+str(now_turkey.hour)+":"+str(minute), icon_url="https://cdn.discordapp.com/avatars/596455467585110016/b96ac044a4382f62ad36637c6021ef80.png?size=256") embed.add_field(name=f"🌸 Hava Durumu : **{arr}**", value=f"Açıklama : **{des}**",inline=True) embed.add_field(name=f"🌡️ Sıcaklık : **{round(deg, 5)}**°C", value=f"\t🔺max: **{round(dmax, 5)}**°C\n🔻min: **{round(dmin, 5)}**°C", inline=True) embed.add_field(name=f"Hissedilen : **{round(feel, 5)}**°C", value="", inline=True) embed.add_field(name=f"💨 Basınç : **{press}**hPa", value="",inline=True) embed.add_field(name=f"Nem : **{round(hum, 5)}**%", value="", inline=True) daily="" days=[] for i in range(1,8): dt = str(b["daily"][i]["dt"]) deg = str(round(b["daily"][i]["temp"]["day"],2)) arr = str(b["daily"][i]["weather"][0]["main"]) press = str(b["daily"][i]["pressure"]) hum = str(round(b["daily"][i]["humidity"],2)) day = dictofdays[str(datetime.fromtimestamp(int(dt)).strftime("%A"))] days.append([day,deg,arr,press,hum]) day2day = f"önümüzdeki {days[0][0]} ──► önümüzdeki {days[6][0]}" template = f"""{day2day} ┌─────────┐┌─────────┐ │{days[0][0].center(9, " ")}││{days[1][0].center(9, " ")}│ ├─────────┤├─────────┤ │°C:{days[0][1].rjust(6, " ")}││°C:{days[1][1].rjust(6, " ")}│ │{days[0][2].center(9, " ")}││{days[1][2].center(9, " ")}│ │hPa:{days[0][3].rjust(5, " ")}││hPa:{days[1][3].rjust(5, " ")}│ │Nem:{days[0][4].rjust(5, " ")}││Nem:{days[1][4].rjust(5, " ")}│ └─────────┘└─────────┘ ┌─────────┐┌─────────┐ │{days[2][0].center(9, " ")}││{days[3][0].center(9, " ")}│ ├─────────┤├─────────┤ │°C:{days[2][1].rjust(6, " ")}││°C:{days[3][1].rjust(6, " ")}│ │{days[2][2].center(9, " ")}││{days[3][2].center(9, " ")}│ │hPa:{days[2][3].rjust(5, " ")}││hPa:{days[3][3].rjust(5, " ")}│ │Nem:{days[2][4].rjust(5, " ")}││Nem:{days[3][4].rjust(5, " ")}│ └─────────┘└─────────┘ ┌─────────┐┌─────────┐ │{days[4][0].center(9, " ")}││{days[5][0].center(9, " ")}│ ├─────────┤├─────────┤ │°C:{days[4][1].rjust(6, " ")}││°C:{days[5][1].rjust(6, " ")}│ │{days[4][2].center(9, " ")}││{days[5][2].center(9, " ")}│ │hPa:{days[4][3].rjust(5, " ")}││hPa:{days[5][3].rjust(5, " ")}│ │Nem:{days[4][4].rjust(5, " ")}││Nem:{days[5][4].rjust(5, " ")}│ └─────────┘└─────────┘ ┌─────────┐ │{days[6][0].center(9, " ")}│ ├─────────┤ │°C:{days[6][1].rjust(6, " ")}│ │{days[6][2].center(9, " ")}│ │hPa:{days[6][3].rjust(5, " ")}│ │Nem:{days[6][4].rjust(5, " ")}│ └─────────┘""" embed.add_field(name="", value=f"```{template}```",inline=False) ctx = await channel.send(embed=embed)
async def weather(ctx, *args): footext = "Developed by bis ❤️ " name = " " name = name.join(args) now_turkey = get() if len(str(now_turkey.minute)) == 1: minute = "0" + str(now_turkey.minute) else: minute = now_turkey.minute a = {} a["list"] = [] if len(name) != 0: a = requests.post( f"https://openweathermap.org/data/2.5/find?q={name}&appid=439d4b804bc8187953eb36d2a8c26a02&units=metric" ) a = json.loads(a.text) try: a["list"] = a["list"] a["cod"] = 200 except: a["cod"] = 500 if a["cod"] == 200 and a["list"] != []: b = requests.post( f'https://openweathermap.org/data/2.5/onecall?lat={a["list"][0]["coord"]["lat"]}&lon={a["list"][0]["coord"]["lon"]}&units=metric&appid=439d4b804bc8187953eb36d2a8c26a02' ) b = json.loads(b.text) des = a["list"][0]["weather"][0]["description"] arr = a["list"][0]["weather"][0]["main"] deg = a["list"][0]["main"]["temp"] - 273.15 feel = a["list"][0]["main"]["feels_like"] - 273.15 dmin = a["list"][0]["main"]["temp_min"] - 273.15 dmax = a["list"][0]["main"]["temp_max"] - 273.15 press = a["list"][0]["main"]["pressure"] hum = a["list"][0]["main"]["humidity"] url = "https://openweathermap.org/city/" + str(a['list'][0]['id']) if a["list"][0]["rain"] != None: footext += " 🌧" if a["list"][0]["snow"] != None: footext += " ❄️" embed = discord.Embed(title=name.upper(), colour=discord.Colour(0x9beec), url=url) embed.set_thumbnail( url= f'http://openweathermap.org/img/wn/{a["list"][0]["weather"][0]["icon"]}.png' ) embed.set_author(name=ctx.author.name, url=url, icon_url=ctx.author.avatar_url) embed.set_footer( text=footext + " • bugün saat " + str(now_turkey.hour) + ":" + str(minute), icon_url= "https://cdn.discordapp.com/avatars/596455467585110016/b96ac044a4382f62ad36637c6021ef80.png?size=256" ) embed.add_field(name=f"🌸 Hava Durumu : **{arr}**", value=f"Açıklama : **{des}**", inline=True) embed.add_field( name=f"🌡️ Sıcaklık : **{round(deg, 5)}**°C", value= f"\t🔺max: **{round(dmax, 5)}**°C\n🔻min: **{round(dmin, 5)}**°C", inline=True) embed.add_field(name=f"Hissedilen : **{round(feel, 5)}**°C", value="", inline=True) embed.add_field(name=f"💨 Basınç : **{press}**hPa", value="", inline=True) embed.add_field(name=f"Nem : **{round(hum, 5)}**%", value="", inline=True) embed2 = discord.Embed(title=name.upper(), colour=discord.Colour(0x9beec), url=url) embed2.set_thumbnail( url= f'http://openweathermap.org/img/wn/{a["list"][0]["weather"][0]["icon"]}.png' ) embed2.set_author(name=ctx.author.name, url=url, icon_url=ctx.author.avatar_url) embed2.set_footer( text=footext + " • bugün saat " + str(now_turkey.hour) + ":" + str(minute), icon_url= "https://cdn.discordapp.com/avatars/596455467585110016/b96ac044a4382f62ad36637c6021ef80.png?size=256" ) daily = "" days = [] for i in range(1, 8): dt = str(b["daily"][i]["dt"]) deg = str(round(b["daily"][i]["temp"]["day"], 2)) arr = str(b["daily"][i]["weather"][0]["main"]) press = str(b["daily"][i]["pressure"]) hum = str(round(b["daily"][i]["humidity"], 2)) day = dictofdays[str( datetime.fromtimestamp(int(dt)).strftime("%A"))] days.append([day, deg, arr, press, hum]) day2day = f"önümüzdeki {days[0][0]},{days[1][0]}" template = f"""{day2day} ┌─────────┐┌─────────┐ │{days[0][0].center(9, " ")}││{days[1][0].center(9, " ")}│ ├─────────┤├─────────┤ │°C:{days[0][1].rjust(6, " ")}││°C:{days[1][1].rjust(6, " ")}│ │{days[0][2].center(9, " ")}││{days[1][2].center(9, " ")}│ │hPa:{days[0][3].rjust(5, " ")}││hPa:{days[1][3].rjust(5, " ")}│ │Nem:{days[0][4].rjust(5, " ")}││Nem:{days[1][4].rjust(5, " ")}│ └─────────┘└─────────┘""" embed.add_field(name="", value=f"```{template}```", inline=False) day2day = f"önümüzdeki {days[2][0]} ──► önümüzdeki {days[6][0]}" template = f"""{day2day} ┌─────────┐┌─────────┐ │{days[2][0].center(9, " ")}││{days[3][0].center(9, " ")}│ ├─────────┤├─────────┤ │°C:{days[2][1].rjust(6, " ")}││°C:{days[3][1].rjust(6, " ")}│ │{days[2][2].center(9, " ")}││{days[3][2].center(9, " ")}│ │hPa:{days[2][3].rjust(5, " ")}││hPa:{days[3][3].rjust(5, " ")}│ │Nem:{days[2][4].rjust(5, " ")}││Nem:{days[3][4].rjust(5, " ")}│ └─────────┘└─────────┘ ┌─────────┐┌─────────┐ │{days[4][0].center(9, " ")}││{days[5][0].center(9, " ")}│ ├─────────┤├─────────┤ │°C:{days[4][1].rjust(6, " ")}││°C:{days[5][1].rjust(6, " ")}│ │{days[4][2].center(9, " ")}││{days[5][2].center(9, " ")}│ │hPa:{days[4][3].rjust(5, " ")}││hPa:{days[5][3].rjust(5, " ")}│ │Nem:{days[4][4].rjust(5, " ")}││Nem:{days[5][4].rjust(5, " ")}│ └─────────┘└─────────┘ ┌─────────┐ │{days[6][0].center(9, " ")}│ ├─────────┤ │°C:{days[6][1].rjust(6, " ")}│ │{days[6][2].center(9, " ")}│ │hPa:{days[6][3].rjust(5, " ")}│ │Nem:{days[6][4].rjust(5, " ")}│ └─────────┘""" embed2.add_field(name="", value=f"```{template}```", inline=False) embeds = [embed, embed2] await multi(embeds).start(ctx) else: embed = discord.Embed(title="Pardon bulamadım :/", colour=discord.Colour(0x9beec)) embed.set_image(url="https://sinbawebtasarim.com/images/404.png") embed.set_author(name=ctx.author.name, url="https://discordapp.com", icon_url=ctx.author.avatar_url) embed.set_footer( text=footext + "• bugün saat " + str(now_turkey.hour) + ":" + str(minute), icon_url= "https://cdn.discordapp.com/avatars/596455467585110016/b96ac044a4382f62ad36637c6021ef80.png?size=256" ) await ctx.send(embed=embed, delete_after=5) await ctx.message.delete()
async def setup(ctx,*args): if ctx.message.author.guild_permissions.administrator: author = "" name=" " name = name.join(args) if not name.islower(): await ctx.send("en iyi kullanım için bütün karakterleri küçük yazarak giriş yapın", delete_after=5) else: flag = 0 flag2 = 0 if flag ==0: a = requests.post(f"https://openweathermap.org/data/2.5/find?q={name}&appid=439d4b804bc8187953eb36d2a8c26a02&units=metric") a = json.loads(a.text) if a["cod"] == "200" and a["list"] != []: flag = 1 if flag ==1: guild_id = str(ctx.guild.id) if not guild_id in weekly.keys(): weekly[guild_id] = {"ZmxhZw==":1,name:[[ctx.channel.id,ctx.author.id]]} await completed(ctx) await oops_log2(bot,ctx.channel,ctx.author,ctx.guild,name) for_log(guild_id,ctx.message.author,ctx.message.channel.name,name) else: if weekly[guild_id]["ZmxhZw=="] != 3: for i in weekly[guild_id][name]: if i[0] == ctx.message.channel.id: flag2=1 author = i[1] if not name in weekly[guild_id].keys(): weekly[guild_id][name] = [[ctx.channel.id,ctx.author.id]] weekly[guild_id]["ZmxhZw=="] += 1 await completed(ctx) for_log(guild_id,ctx.message.author,ctx.message.channel.name,name) elif flag2 == 1: await failed(ctx,author) await ctx.message.delete() else: weekly[guild_id][name].append([ctx.channel.id,ctx.author.id]) weekly[guild_id]["ZmxhZw=="] += 1 await completed(ctx) await oops_log2(bot,ctx.channel,ctx.author,ctx.guild,name) for_log(guild_id,ctx.message.author,ctx.message.channel.name,name) else: now_turkey = get() if len(str(now_turkey.minute)) == 1: minute = "0"+ str(now_turkey.minute) else: minute = now_turkey.minute embed = discord.Embed(title="PREMİUM", colour=discord.Colour(0xA3FFA9)) embed.add_field(name="Sunucu limiti", value="Özel ayrıcalığa sahip olmadığınız sürece sunucu başına 3 otomatik mesaj oluşturma hakkınız olur", inline=True) embed.add_field(name="", value="|||| [İLETİŞİME GEÇ !](https://deja-vu1.github.io/) | [Sunucuya ekle](https://discord.com/oauth2/authorize?client_id=829685204641513532&permissions=93184&scope=bot) | [Oy ver](https://top.gg/bot/829685204641513532)", inline=True) embed.set_image(url="https://raw.githubusercontent.com/Deja-Vu1/WeatherBot/main/Img/discordimage-1.png") embed.set_footer(text=footext+" bugün saat "+str(now_turkey.hour)+":"+str(minute),icon_url="https://cdn.discordapp.com/avatars/596455467585110016/b96ac044a4382f62ad36637c6021ef80.png?size=256") await ctx.message.channel.send(embed=embed) with open('hello.json', 'w') as outfile: json.dump(weekly, outfile) else: await ctx.send("Aradığınız şehir bulunamadı!",delete_after=5) await ctx.message.delete() else: await ctx.send("Bu komudu kullanmaya yetkiniz yok !")