1
1
import discord
2
2
from discord .errors import Forbidden
3
3
4
- """
5
- The color presets, send_message() and make_embed() functions are included in the discord-bot template by nonchris
6
- https://github.com/nonchris/discord-bot
7
- """
4
+ ### @package utils
5
+ #
6
+ # The color presets, send_message() and make_embed() functions are
7
+ # included in the [discord-bot template by
8
+ # nonchris](https://github.com/nonchris/discord-bot)
8
9
9
10
10
11
# color scheme for embeds as rbg
11
12
blue_light = discord .Color .from_rgb (20 , 255 , 255 ) # default color
12
13
green = discord .Color .from_rgb (142 , 250 , 60 ) # success green
13
- yellow = discord .Color .from_rgb (245 , 218 , 17 ) # waring like 'hey, that's not cool'
14
- orange = discord .Color .from_rgb (245 , 139 , 17 ) # waring - rather critical like 'no more votes left'
14
+ yellow = discord .Color .from_rgb (245 , 218 , 17 ) # warning like 'hey, that's not cool'
15
+ orange = discord .Color .from_rgb (245 , 139 , 17 ) # warning - rather critical like 'no more votes left'
15
16
red = discord .Color .from_rgb (255 , 28 , 25 ) # error red
16
17
18
+ ### @package utils
19
+ #
20
+ # Utilities and helper functions
21
+ #
17
22
18
23
async def send_embed (ctx , embed ):
19
- """
24
+ """!
20
25
Handles the sending of embeds
21
- -> Takes context and embed to send
26
+ @param ctx context to send to
27
+ @param embed embed to send
28
+
22
29
- tries to send embed in channel
23
30
- tries to send normal message when that fails
24
31
- tries to send embed private with information abot missing permissions
@@ -35,18 +42,17 @@ async def send_embed(ctx, embed):
35
42
f"May you inform the server team about this issue? :slight_smile:" , embed = embed )
36
43
37
44
38
- # creating and returning an embed with keyword arguments
39
- # please note that name and value can't be empty - name and value contain a zero width non-joiner
40
45
def make_embed (title = "" , color = blue_light , name = "" , value = "" , footer = None ) -> discord .Embed :
41
- """
46
+ """!
42
47
Function to generate generate an embed in one function call
43
-
44
- :param title: Headline of embed
45
- :param color: RGB Tuple (Red, Green, Blue)
46
- :param name: Of field (sub-headline)
47
- :param value: Text of field (actual text)
48
- :param footer: Text in footer
49
- :return: Embed ready to send
48
+ please note that name and value can't be empty - name and value contain a zero width non-joiner
49
+
50
+ @param title Headline of embed
51
+ @param color RGB Tuple (Red, Green, Blue)
52
+ @param name: Of field (sub-headline)
53
+ @param value: Text of field (actual text)
54
+ @param footer: Text in footer
55
+ @return Embed ready to send
50
56
"""
51
57
# make color object
52
58
emb = discord .Embed (title = title , color = color )
0 commit comments